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/pci/xen-pcifront.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/pci/xen-pcifront.c')
-rw-r--r-- | drivers/pci/xen-pcifront.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 90832a955991..7cf3d2fcf56a 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -1126,14 +1126,11 @@ static const struct xenbus_device_id xenpci_ids[] = { | |||
1126 | {""}, | 1126 | {""}, |
1127 | }; | 1127 | }; |
1128 | 1128 | ||
1129 | static struct xenbus_driver xenbus_pcifront_driver = { | 1129 | static DEFINE_XENBUS_DRIVER(xenpci, "pcifront", |
1130 | .name = "pcifront", | ||
1131 | .owner = THIS_MODULE, | ||
1132 | .ids = xenpci_ids, | ||
1133 | .probe = pcifront_xenbus_probe, | 1130 | .probe = pcifront_xenbus_probe, |
1134 | .remove = pcifront_xenbus_remove, | 1131 | .remove = pcifront_xenbus_remove, |
1135 | .otherend_changed = pcifront_backend_changed, | 1132 | .otherend_changed = pcifront_backend_changed, |
1136 | }; | 1133 | ); |
1137 | 1134 | ||
1138 | static int __init pcifront_init(void) | 1135 | static int __init pcifront_init(void) |
1139 | { | 1136 | { |
@@ -1142,12 +1139,12 @@ static int __init pcifront_init(void) | |||
1142 | 1139 | ||
1143 | pci_frontend_registrar(1 /* enable */); | 1140 | pci_frontend_registrar(1 /* enable */); |
1144 | 1141 | ||
1145 | return xenbus_register_frontend(&xenbus_pcifront_driver); | 1142 | return xenbus_register_frontend(&xenpci_driver); |
1146 | } | 1143 | } |
1147 | 1144 | ||
1148 | static void __exit pcifront_cleanup(void) | 1145 | static void __exit pcifront_cleanup(void) |
1149 | { | 1146 | { |
1150 | xenbus_unregister_driver(&xenbus_pcifront_driver); | 1147 | xenbus_unregister_driver(&xenpci_driver); |
1151 | pci_frontend_registrar(0 /* disable */); | 1148 | pci_frontend_registrar(0 /* disable */); |
1152 | } | 1149 | } |
1153 | module_init(pcifront_init); | 1150 | module_init(pcifront_init); |