2006-01-06 09:19:14 +01:00
|
|
|
/*
|
|
|
|
* drivers/s390/s390_rdev.c
|
|
|
|
* s390 root device
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH,
|
|
|
|
* IBM Corporation
|
2006-01-14 22:21:04 +01:00
|
|
|
* Author(s): Cornelia Huck (cornelia.huck@de.ibm.com)
|
2006-01-06 09:19:14 +01:00
|
|
|
* Carsten Otte (cotte@de.ibm.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <asm/s390_rdev.h>
|
|
|
|
|
|
|
|
static void
|
|
|
|
s390_root_dev_release(struct device *dev)
|
|
|
|
{
|
|
|
|
kfree(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct device *
|
|
|
|
s390_root_dev_register(const char *name)
|
|
|
|
{
|
|
|
|
struct device *dev;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!strlen(name))
|
|
|
|
return ERR_PTR(-EINVAL);
|
2006-03-24 12:15:31 +01:00
|
|
|
dev = kzalloc(sizeof(struct device), GFP_KERNEL);
|
2006-01-06 09:19:14 +01:00
|
|
|
if (!dev)
|
|
|
|
return ERR_PTR(-ENOMEM);
|
2008-10-10 21:33:10 +02:00
|
|
|
dev_set_name(dev, name);
|
2006-01-06 09:19:14 +01:00
|
|
|
dev->release = s390_root_dev_release;
|
|
|
|
ret = device_register(dev);
|
|
|
|
if (ret) {
|
|
|
|
kfree(dev);
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
}
|
|
|
|
return dev;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
s390_root_dev_unregister(struct device *dev)
|
|
|
|
{
|
|
|
|
if (dev)
|
|
|
|
device_unregister(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPORT_SYMBOL(s390_root_dev_register);
|
|
|
|
EXPORT_SYMBOL(s390_root_dev_unregister);
|