diff options
author | Len Brown <len.brown@intel.com> | 2006-01-06 16:34:21 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-01-06 16:34:21 -0500 |
commit | 25da0974601fc8096461f3d3f7ca3aab8e79adfb (patch) | |
tree | f9b3c1bfbc63fdb6a94e82177b8c3ae891125422 /drivers/s390/s390_rdev.c | |
parent | 036d25f79ddfbc9878da24ef8e468a6d22caa605 (diff) | |
parent | d99cf9d679a520d67f81d805b7cb91c68e1847f0 (diff) |
Auto-update from upstream
Diffstat (limited to 'drivers/s390/s390_rdev.c')
-rw-r--r-- | drivers/s390/s390_rdev.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/s390/s390_rdev.c b/drivers/s390/s390_rdev.c new file mode 100644 index 00000000000..566cc3d185b --- /dev/null +++ b/drivers/s390/s390_rdev.c @@ -0,0 +1,53 @@ +/* + * drivers/s390/s390_rdev.c + * s390 root device + * $Revision: 1.2 $ + * + * Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH, + * IBM Corporation + * Author(s): Cornelia Huck (cohuck@de.ibm.com) + * 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); + dev = kmalloc(sizeof(struct device), GFP_KERNEL); + if (!dev) + return ERR_PTR(-ENOMEM); + memset(dev, 0, sizeof(struct device)); + strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); + 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); |