[IPV6] NDISC: Take source address into account for redirects.
[hh.org.git] / drivers / s390 / s390_rdev.c
blob3c7145d9f9a1f74189b655b54afbae05c8d22202
1 /*
2 * drivers/s390/s390_rdev.c
3 * s390 root device
5 * Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH,
6 * IBM Corporation
7 * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com)
8 * Carsten Otte (cotte@de.ibm.com)
9 */
11 #include <linux/slab.h>
12 #include <linux/err.h>
13 #include <linux/device.h>
14 #include <asm/s390_rdev.h>
16 static void
17 s390_root_dev_release(struct device *dev)
19 kfree(dev);
22 struct device *
23 s390_root_dev_register(const char *name)
25 struct device *dev;
26 int ret;
28 if (!strlen(name))
29 return ERR_PTR(-EINVAL);
30 dev = kzalloc(sizeof(struct device), GFP_KERNEL);
31 if (!dev)
32 return ERR_PTR(-ENOMEM);
33 strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE));
34 dev->release = s390_root_dev_release;
35 ret = device_register(dev);
36 if (ret) {
37 kfree(dev);
38 return ERR_PTR(ret);
40 return dev;
43 void
44 s390_root_dev_unregister(struct device *dev)
46 if (dev)
47 device_unregister(dev);
50 EXPORT_SYMBOL(s390_root_dev_register);
51 EXPORT_SYMBOL(s390_root_dev_unregister);