aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/vio.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-03-26 15:06:30 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-03-27 20:33:24 -0400
commitcb52d8970eee65bf2c47d9a91bd4f58b17f595f4 (patch)
tree43521ba99805f293e09a284901cb5435afeab789 /arch/powerpc/kernel/vio.c
parent1d9a47315042606b4217691bcea36cfa6ccbde66 (diff)
powerpc+sparc/vio: Modernize driver registration
This makes vio_register_driver() get the module owner & name at compile time like PCI drivers do, and adds a name pointer directly in struct vio_driver to avoid having to explicitly initialize the embedded struct device. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/powerpc/kernel/vio.c')
-rw-r--r--arch/powerpc/kernel/vio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index bca3fc427b45..b2f7c8480bf6 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1159,17 +1159,21 @@ static int vio_bus_remove(struct device *dev)
1159 * vio_register_driver: - Register a new vio driver 1159 * vio_register_driver: - Register a new vio driver
1160 * @drv: The vio_driver structure to be registered. 1160 * @drv: The vio_driver structure to be registered.
1161 */ 1161 */
1162int vio_register_driver(struct vio_driver *viodrv) 1162int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
1163 const char *mod_name)
1163{ 1164{
1164 printk(KERN_DEBUG "%s: driver %s registering\n", __func__, 1165 pr_debug("%s: driver %s registering\n", __func__, viodrv->name);
1165 viodrv->driver.name);
1166 1166
1167 /* fill in 'struct driver' fields */ 1167 /* fill in 'struct driver' fields */
1168 viodrv->driver.name = viodrv->name;
1169 viodrv->driver.pm = viodrv->pm;
1168 viodrv->driver.bus = &vio_bus_type; 1170 viodrv->driver.bus = &vio_bus_type;
1171 viodrv->driver.owner = owner;
1172 viodrv->driver.mod_name = mod_name;
1169 1173
1170 return driver_register(&viodrv->driver); 1174 return driver_register(&viodrv->driver);
1171} 1175}
1172EXPORT_SYMBOL(vio_register_driver); 1176EXPORT_SYMBOL(__vio_register_driver);
1173 1177
1174/** 1178/**
1175 * vio_unregister_driver - Remove registration of vio driver. 1179 * vio_unregister_driver - Remove registration of vio driver.