diff options
author | Jan Beulich <JBeulich@suse.com> | 2011-12-22 04:08:13 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-01-04 17:01:17 -0500 |
commit | 73db144b58a32fc39733db6a7e1fe582072ad26a (patch) | |
tree | f03edee848be5aa085c30d493c02a5ee1b8fc3da /drivers/block/xen-blkfront.c | |
parent | 2e16341438c9eca15a2e0bb2ad8555bbdf24b86d (diff) |
Xen: consolidate and simplify struct xenbus_driver instantiation
The 'name', 'owner', and 'mod_name' members are redundant with the
identically named fields in the 'driver' sub-structure. Rather than
switching each instance to specify these fields explicitly, introduce
a macro to simplify this.
Eliminate further redundancy by allowing the drvname argument to
DEFINE_XENBUS_DRIVER() to be blank (in which case the first entry from
the ID table will be used for .driver.name).
Also eliminate the questionable xenbus_register_{back,front}end()
wrappers - their sole remaining purpose was the checking of the
'owner' field, proper setting of which shouldn't be an issue anymore
when the macro gets used.
v2: Restore DRV_NAME for the driver name in xen-pciback.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r-- | drivers/block/xen-blkfront.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 7b2ec590841..9fd3ee203b1 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -1437,16 +1437,13 @@ static const struct xenbus_device_id blkfront_ids[] = { | |||
1437 | { "" } | 1437 | { "" } |
1438 | }; | 1438 | }; |
1439 | 1439 | ||
1440 | static struct xenbus_driver blkfront = { | 1440 | static DEFINE_XENBUS_DRIVER(blkfront, , |
1441 | .name = "vbd", | ||
1442 | .owner = THIS_MODULE, | ||
1443 | .ids = blkfront_ids, | ||
1444 | .probe = blkfront_probe, | 1441 | .probe = blkfront_probe, |
1445 | .remove = blkfront_remove, | 1442 | .remove = blkfront_remove, |
1446 | .resume = blkfront_resume, | 1443 | .resume = blkfront_resume, |
1447 | .otherend_changed = blkback_changed, | 1444 | .otherend_changed = blkback_changed, |
1448 | .is_ready = blkfront_is_ready, | 1445 | .is_ready = blkfront_is_ready, |
1449 | }; | 1446 | ); |
1450 | 1447 | ||
1451 | static int __init xlblk_init(void) | 1448 | static int __init xlblk_init(void) |
1452 | { | 1449 | { |
@@ -1461,7 +1458,7 @@ static int __init xlblk_init(void) | |||
1461 | return -ENODEV; | 1458 | return -ENODEV; |
1462 | } | 1459 | } |
1463 | 1460 | ||
1464 | ret = xenbus_register_frontend(&blkfront); | 1461 | ret = xenbus_register_frontend(&blkfront_driver); |
1465 | if (ret) { | 1462 | if (ret) { |
1466 | unregister_blkdev(XENVBD_MAJOR, DEV_NAME); | 1463 | unregister_blkdev(XENVBD_MAJOR, DEV_NAME); |
1467 | return ret; | 1464 | return ret; |
@@ -1474,7 +1471,7 @@ module_init(xlblk_init); | |||
1474 | 1471 | ||
1475 | static void __exit xlblk_exit(void) | 1472 | static void __exit xlblk_exit(void) |
1476 | { | 1473 | { |
1477 | return xenbus_unregister_driver(&blkfront); | 1474 | return xenbus_unregister_driver(&blkfront_driver); |
1478 | } | 1475 | } |
1479 | module_exit(xlblk_exit); | 1476 | module_exit(xlblk_exit); |
1480 | 1477 | ||