diff options
author | Carsten Otte <cotte@de.ibm.com> | 2006-01-06 03:19:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:49 -0500 |
commit | cfb1b55595a0dfd87b5849e8d0216c029f34445f (patch) | |
tree | 86d73bda5e9c82e70a4bdbacfac6be5644c8a987 /drivers/s390/s390_rdev.c | |
parent | 6810a2bce3aa6573faa9920487274f166fe95c6e (diff) |
[PATCH] s390: move s390_root_dev_* out of the cio layer
Extract the s390_root_dev_* functions from the common I/O layer as they are
also used by non-ccw device drivers.
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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 000000000000..566cc3d185b6 --- /dev/null +++ b/drivers/s390/s390_rdev.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * drivers/s390/s390_rdev.c | ||
3 | * s390 root device | ||
4 | * $Revision: 1.2 $ | ||
5 | * | ||
6 | * Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH, | ||
7 | * IBM Corporation | ||
8 | * Author(s): Cornelia Huck (cohuck@de.ibm.com) | ||
9 | * Carsten Otte (cotte@de.ibm.com) | ||
10 | */ | ||
11 | |||
12 | #include <linux/slab.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <asm/s390_rdev.h> | ||
16 | |||
17 | static void | ||
18 | s390_root_dev_release(struct device *dev) | ||
19 | { | ||
20 | kfree(dev); | ||
21 | } | ||
22 | |||
23 | struct device * | ||
24 | s390_root_dev_register(const char *name) | ||
25 | { | ||
26 | struct device *dev; | ||
27 | int ret; | ||
28 | |||
29 | if (!strlen(name)) | ||
30 | return ERR_PTR(-EINVAL); | ||
31 | dev = kmalloc(sizeof(struct device), GFP_KERNEL); | ||
32 | if (!dev) | ||
33 | return ERR_PTR(-ENOMEM); | ||
34 | memset(dev, 0, sizeof(struct device)); | ||
35 | strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); | ||
36 | dev->release = s390_root_dev_release; | ||
37 | ret = device_register(dev); | ||
38 | if (ret) { | ||
39 | kfree(dev); | ||
40 | return ERR_PTR(ret); | ||
41 | } | ||
42 | return dev; | ||
43 | } | ||
44 | |||
45 | void | ||
46 | s390_root_dev_unregister(struct device *dev) | ||
47 | { | ||
48 | if (dev) | ||
49 | device_unregister(dev); | ||
50 | } | ||
51 | |||
52 | EXPORT_SYMBOL(s390_root_dev_register); | ||
53 | EXPORT_SYMBOL(s390_root_dev_unregister); | ||