mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
[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>
This commit is contained in:
parent
98c13c283a
commit
25b7bb5838
@ -837,6 +837,33 @@ struct bus_type css_bus_type = {
|
|||||||
.shutdown = css_shutdown,
|
.shutdown = css_shutdown,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* css_driver_register - register a css driver
|
||||||
|
* @cdrv: css driver to register
|
||||||
|
*
|
||||||
|
* This is mainly a wrapper around driver_register that sets name
|
||||||
|
* and bus_type in the embedded struct device_driver correctly.
|
||||||
|
*/
|
||||||
|
int css_driver_register(struct css_driver *cdrv)
|
||||||
|
{
|
||||||
|
cdrv->drv.name = cdrv->name;
|
||||||
|
cdrv->drv.bus = &css_bus_type;
|
||||||
|
return driver_register(&cdrv->drv);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(css_driver_register);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* css_driver_unregister - unregister a css driver
|
||||||
|
* @cdrv: css driver to unregister
|
||||||
|
*
|
||||||
|
* This is a wrapper around driver_unregister.
|
||||||
|
*/
|
||||||
|
void css_driver_unregister(struct css_driver *cdrv)
|
||||||
|
{
|
||||||
|
driver_unregister(&cdrv->drv);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(css_driver_unregister);
|
||||||
|
|
||||||
subsys_initcall(init_channel_subsystem);
|
subsys_initcall(init_channel_subsystem);
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
@ -132,6 +132,7 @@ struct css_driver {
|
|||||||
int (*probe)(struct subchannel *);
|
int (*probe)(struct subchannel *);
|
||||||
int (*remove)(struct subchannel *);
|
int (*remove)(struct subchannel *);
|
||||||
void (*shutdown)(struct subchannel *);
|
void (*shutdown)(struct subchannel *);
|
||||||
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define to_cssdriver(n) container_of(n, struct css_driver, drv)
|
#define to_cssdriver(n) container_of(n, struct css_driver, drv)
|
||||||
@ -141,6 +142,9 @@ struct css_driver {
|
|||||||
*/
|
*/
|
||||||
extern struct bus_type css_bus_type;
|
extern struct bus_type css_bus_type;
|
||||||
|
|
||||||
|
extern int css_driver_register(struct css_driver *);
|
||||||
|
extern void css_driver_unregister(struct css_driver *);
|
||||||
|
|
||||||
extern void css_sch_device_unregister(struct subchannel *);
|
extern void css_sch_device_unregister(struct subchannel *);
|
||||||
extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
|
extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
|
||||||
extern int css_init_done;
|
extern int css_init_done;
|
||||||
|
@ -125,10 +125,7 @@ static void io_subchannel_shutdown(struct subchannel *);
|
|||||||
|
|
||||||
static struct css_driver io_subchannel_driver = {
|
static struct css_driver io_subchannel_driver = {
|
||||||
.subchannel_type = SUBCHANNEL_TYPE_IO,
|
.subchannel_type = SUBCHANNEL_TYPE_IO,
|
||||||
.drv = {
|
.name = "io_subchannel",
|
||||||
.name = "io_subchannel",
|
|
||||||
.bus = &css_bus_type,
|
|
||||||
},
|
|
||||||
.irq = io_subchannel_irq,
|
.irq = io_subchannel_irq,
|
||||||
.notify = io_subchannel_notify,
|
.notify = io_subchannel_notify,
|
||||||
.verify = io_subchannel_verify,
|
.verify = io_subchannel_verify,
|
||||||
@ -167,7 +164,8 @@ init_ccw_bus_type (void)
|
|||||||
if ((ret = bus_register (&ccw_bus_type)))
|
if ((ret = bus_register (&ccw_bus_type)))
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
if ((ret = driver_register(&io_subchannel_driver.drv)))
|
ret = css_driver_register(&io_subchannel_driver);
|
||||||
|
if (ret)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
wait_event(ccw_device_init_wq,
|
wait_event(ccw_device_init_wq,
|
||||||
@ -187,7 +185,7 @@ out_err:
|
|||||||
static void __exit
|
static void __exit
|
||||||
cleanup_ccw_bus_type (void)
|
cleanup_ccw_bus_type (void)
|
||||||
{
|
{
|
||||||
driver_unregister(&io_subchannel_driver.drv);
|
css_driver_unregister(&io_subchannel_driver);
|
||||||
bus_unregister(&ccw_bus_type);
|
bus_unregister(&ccw_bus_type);
|
||||||
destroy_workqueue(ccw_device_notify_work);
|
destroy_workqueue(ccw_device_notify_work);
|
||||||
destroy_workqueue(ccw_device_work);
|
destroy_workqueue(ccw_device_work);
|
||||||
|
Loading…
Reference in New Issue
Block a user