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 | |
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')
-rw-r--r-- | drivers/s390/Makefile | 2 | ||||
-rw-r--r-- | drivers/s390/block/dcssblk.c | 2 | ||||
-rw-r--r-- | drivers/s390/cio/css.c | 41 | ||||
-rw-r--r-- | drivers/s390/net/cu3088.c | 3 | ||||
-rw-r--r-- | drivers/s390/net/iucv.c | 2 | ||||
-rw-r--r-- | drivers/s390/net/qeth_main.c | 1 | ||||
-rw-r--r-- | drivers/s390/s390_rdev.c | 53 |
7 files changed, 59 insertions, 45 deletions
diff --git a/drivers/s390/Makefile b/drivers/s390/Makefile index c99a2fe92fb0..9803c9352d78 100644 --- a/drivers/s390/Makefile +++ b/drivers/s390/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the S/390 specific device drivers | 2 | # Makefile for the S/390 specific device drivers |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += s390mach.o sysinfo.o | 5 | obj-y += s390mach.o sysinfo.o s390_rdev.o |
6 | obj-y += cio/ block/ char/ crypto/ net/ scsi/ | 6 | obj-y += cio/ block/ char/ crypto/ net/ scsi/ |
7 | 7 | ||
8 | drivers-y += drivers/s390/built-in.o | 8 | drivers-y += drivers/s390/built-in.o |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 4fde41188996..2e727f49ad19 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <linux/completion.h> | 16 | #include <linux/completion.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <asm/ccwdev.h> // for s390_root_dev_(un)register() | 18 | #include <asm/s390_rdev.h> |
19 | 19 | ||
20 | //#define DCSSBLK_DEBUG /* Debug messages on/off */ | 20 | //#define DCSSBLK_DEBUG /* Debug messages on/off */ |
21 | #define DCSSBLK_NAME "dcssblk" | 21 | #define DCSSBLK_NAME "dcssblk" |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 555119cacc27..7e4d57b4266f 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -481,45 +481,6 @@ struct bus_type css_bus_type = { | |||
481 | 481 | ||
482 | subsys_initcall(init_channel_subsystem); | 482 | subsys_initcall(init_channel_subsystem); |
483 | 483 | ||
484 | /* | ||
485 | * Register root devices for some drivers. The release function must not be | ||
486 | * in the device drivers, so we do it here. | ||
487 | */ | ||
488 | static void | ||
489 | s390_root_dev_release(struct device *dev) | ||
490 | { | ||
491 | kfree(dev); | ||
492 | } | ||
493 | |||
494 | struct device * | ||
495 | s390_root_dev_register(const char *name) | ||
496 | { | ||
497 | struct device *dev; | ||
498 | int ret; | ||
499 | |||
500 | if (!strlen(name)) | ||
501 | return ERR_PTR(-EINVAL); | ||
502 | dev = kmalloc(sizeof(struct device), GFP_KERNEL); | ||
503 | if (!dev) | ||
504 | return ERR_PTR(-ENOMEM); | ||
505 | memset(dev, 0, sizeof(struct device)); | ||
506 | strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); | ||
507 | dev->release = s390_root_dev_release; | ||
508 | ret = device_register(dev); | ||
509 | if (ret) { | ||
510 | kfree(dev); | ||
511 | return ERR_PTR(ret); | ||
512 | } | ||
513 | return dev; | ||
514 | } | ||
515 | |||
516 | void | ||
517 | s390_root_dev_unregister(struct device *dev) | ||
518 | { | ||
519 | if (dev) | ||
520 | device_unregister(dev); | ||
521 | } | ||
522 | |||
523 | int | 484 | int |
524 | css_enqueue_subchannel_slow(unsigned long schid) | 485 | css_enqueue_subchannel_slow(unsigned long schid) |
525 | { | 486 | { |
@@ -564,6 +525,4 @@ css_slow_subchannels_exist(void) | |||
564 | 525 | ||
565 | MODULE_LICENSE("GPL"); | 526 | MODULE_LICENSE("GPL"); |
566 | EXPORT_SYMBOL(css_bus_type); | 527 | EXPORT_SYMBOL(css_bus_type); |
567 | EXPORT_SYMBOL(s390_root_dev_register); | ||
568 | EXPORT_SYMBOL(s390_root_dev_unregister); | ||
569 | EXPORT_SYMBOL_GPL(css_characteristics_avail); | 528 | EXPORT_SYMBOL_GPL(css_characteristics_avail); |
diff --git a/drivers/s390/net/cu3088.c b/drivers/s390/net/cu3088.c index 0075894c71db..77dacb465732 100644 --- a/drivers/s390/net/cu3088.c +++ b/drivers/s390/net/cu3088.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cu3088.c,v 1.35 2005/03/30 19:28:52 richtera Exp $ | 2 | * $Id: cu3088.c,v 1.36 2005/10/25 14:37:17 cohuck Exp $ |
3 | * | 3 | * |
4 | * CTC / LCS ccw_device driver | 4 | * CTC / LCS ccw_device driver |
5 | * | 5 | * |
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | 29 | ||
30 | #include <asm/s390_rdev.h> | ||
30 | #include <asm/ccwdev.h> | 31 | #include <asm/ccwdev.h> |
31 | #include <asm/ccwgroup.h> | 32 | #include <asm/ccwgroup.h> |
32 | 33 | ||
diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index ecb2f8fd7873..ea8177392564 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #include <asm/s390_ext.h> | 54 | #include <asm/s390_ext.h> |
55 | #include <asm/ebcdic.h> | 55 | #include <asm/ebcdic.h> |
56 | #include <asm/smp.h> | 56 | #include <asm/smp.h> |
57 | #include <asm/ccwdev.h> //for root device stuff | 57 | #include <asm/s390_rdev.h> |
58 | 58 | ||
59 | /* FLAGS: | 59 | /* FLAGS: |
60 | * All flags are defined in the field IPFLAGS1 of each function | 60 | * All flags are defined in the field IPFLAGS1 of each function |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 7b2663f27817..97f927c01a82 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <asm/timex.h> | 65 | #include <asm/timex.h> |
66 | #include <asm/semaphore.h> | 66 | #include <asm/semaphore.h> |
67 | #include <asm/uaccess.h> | 67 | #include <asm/uaccess.h> |
68 | #include <asm/s390_rdev.h> | ||
68 | 69 | ||
69 | #include "qeth.h" | 70 | #include "qeth.h" |
70 | #include "qeth_mpc.h" | 71 | #include "qeth_mpc.h" |
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); | ||