diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2008-01-26 08:10:41 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-01-26 08:10:58 -0500 |
commit | 25b7bb5838ab81b68a9de72df577103d8b4aba3c (patch) | |
tree | ccbef7d152370e7a770788c103776af0fbe7fc47 /drivers/s390 | |
parent | 98c13c283a4e8b7f844f1f470abd7c756248fcc4 (diff) |
[S390] cio: Add css_driver_{register,unregister}.
Add wrapper functions for driver_register and driver_unregister so
that css drivers don't need to muck with struct device_driver
directly.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/cio/css.c | 27 | ||||
-rw-r--r-- | drivers/s390/cio/css.h | 4 | ||||
-rw-r--r-- | drivers/s390/cio/device.c | 10 |
3 files changed, 35 insertions, 6 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index f558686a66dd..7d887f88bb73 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -837,6 +837,33 @@ struct bus_type css_bus_type = { | |||
837 | .shutdown = css_shutdown, | 837 | .shutdown = css_shutdown, |
838 | }; | 838 | }; |
839 | 839 | ||
840 | /** | ||
841 | * css_driver_register - register a css driver | ||
842 | * @cdrv: css driver to register | ||
843 | * | ||
844 | * This is mainly a wrapper around driver_register that sets name | ||
845 | * and bus_type in the embedded struct device_driver correctly. | ||
846 | */ | ||
847 | int css_driver_register(struct css_driver *cdrv) | ||
848 | { | ||
849 | cdrv->drv.name = cdrv->name; | ||
850 | cdrv->drv.bus = &css_bus_type; | ||
851 | return driver_register(&cdrv->drv); | ||
852 | } | ||
853 | EXPORT_SYMBOL_GPL(css_driver_register); | ||
854 | |||
855 | /** | ||
856 | * css_driver_unregister - unregister a css driver | ||
857 | * @cdrv: css driver to unregister | ||
858 | * | ||
859 | * This is a wrapper around driver_unregister. | ||
860 | */ | ||
861 | void css_driver_unregister(struct css_driver *cdrv) | ||
862 | { | ||
863 | driver_unregister(&cdrv->drv); | ||
864 | } | ||
865 | EXPORT_SYMBOL_GPL(css_driver_unregister); | ||
866 | |||
840 | subsys_initcall(init_channel_subsystem); | 867 | subsys_initcall(init_channel_subsystem); |
841 | 868 | ||
842 | MODULE_LICENSE("GPL"); | 869 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index 32acd24a407c..c9fd600411c4 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h | |||
@@ -132,6 +132,7 @@ struct css_driver { | |||
132 | int (*probe)(struct subchannel *); | 132 | int (*probe)(struct subchannel *); |
133 | int (*remove)(struct subchannel *); | 133 | int (*remove)(struct subchannel *); |
134 | void (*shutdown)(struct subchannel *); | 134 | void (*shutdown)(struct subchannel *); |
135 | const char *name; | ||
135 | }; | 136 | }; |
136 | 137 | ||
137 | #define to_cssdriver(n) container_of(n, struct css_driver, drv) | 138 | #define to_cssdriver(n) container_of(n, struct css_driver, drv) |
@@ -141,6 +142,9 @@ struct css_driver { | |||
141 | */ | 142 | */ |
142 | extern struct bus_type css_bus_type; | 143 | extern struct bus_type css_bus_type; |
143 | 144 | ||
145 | extern int css_driver_register(struct css_driver *); | ||
146 | extern void css_driver_unregister(struct css_driver *); | ||
147 | |||
144 | extern void css_sch_device_unregister(struct subchannel *); | 148 | extern void css_sch_device_unregister(struct subchannel *); |
145 | extern struct subchannel * get_subchannel_by_schid(struct subchannel_id); | 149 | extern struct subchannel * get_subchannel_by_schid(struct subchannel_id); |
146 | extern int css_init_done; | 150 | extern int css_init_done; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 000c64129ed8..7bccca9684e5 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -125,10 +125,7 @@ static void io_subchannel_shutdown(struct subchannel *); | |||
125 | 125 | ||
126 | static struct css_driver io_subchannel_driver = { | 126 | static struct css_driver io_subchannel_driver = { |
127 | .subchannel_type = SUBCHANNEL_TYPE_IO, | 127 | .subchannel_type = SUBCHANNEL_TYPE_IO, |
128 | .drv = { | 128 | .name = "io_subchannel", |
129 | .name = "io_subchannel", | ||
130 | .bus = &css_bus_type, | ||
131 | }, | ||
132 | .irq = io_subchannel_irq, | 129 | .irq = io_subchannel_irq, |
133 | .notify = io_subchannel_notify, | 130 | .notify = io_subchannel_notify, |
134 | .verify = io_subchannel_verify, | 131 | .verify = io_subchannel_verify, |
@@ -167,7 +164,8 @@ init_ccw_bus_type (void) | |||
167 | if ((ret = bus_register (&ccw_bus_type))) | 164 | if ((ret = bus_register (&ccw_bus_type))) |
168 | goto out_err; | 165 | goto out_err; |
169 | 166 | ||
170 | if ((ret = driver_register(&io_subchannel_driver.drv))) | 167 | ret = css_driver_register(&io_subchannel_driver); |
168 | if (ret) | ||
171 | goto out_err; | 169 | goto out_err; |
172 | 170 | ||
173 | wait_event(ccw_device_init_wq, | 171 | wait_event(ccw_device_init_wq, |
@@ -187,7 +185,7 @@ out_err: | |||
187 | static void __exit | 185 | static void __exit |
188 | cleanup_ccw_bus_type (void) | 186 | cleanup_ccw_bus_type (void) |
189 | { | 187 | { |
190 | driver_unregister(&io_subchannel_driver.drv); | 188 | css_driver_unregister(&io_subchannel_driver); |
191 | bus_unregister(&ccw_bus_type); | 189 | bus_unregister(&ccw_bus_type); |
192 | destroy_workqueue(ccw_device_notify_work); | 190 | destroy_workqueue(ccw_device_notify_work); |
193 | destroy_workqueue(ccw_device_work); | 191 | destroy_workqueue(ccw_device_work); |