Commit 3e2b32b69308e974cd1167beaf266d3c716e4734
Exists in
master
and in
4 other branches
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Showing 48 changed files Side-by-side Diff
- arch/arm/common/locomo.c
- arch/arm/common/sa1111.c
- arch/arm/kernel/ecard.c
- arch/arm/mach-integrator/lm.c
- arch/ia64/sn/kernel/tiocx.c
- arch/parisc/kernel/drivers.c
- arch/powerpc/kernel/of_device.c
- arch/powerpc/kernel/vio.c
- arch/ppc/syslib/ocp.c
- arch/sh/kernel/cpu/bus.c
- drivers/base/dd.c
- drivers/base/driver.c
- drivers/base/platform.c
- drivers/base/power/shutdown.c
- drivers/dio/dio-driver.c
- drivers/i2c/i2c-core.c
- drivers/ide/ide-cd.c
- drivers/ide/ide-disk.c
- drivers/ide/ide-floppy.c
- drivers/ide/ide-tape.c
- drivers/ide/ide.c
- drivers/input/gameport/gameport.c
- drivers/input/input.c
- drivers/input/serio/serio.c
- drivers/macintosh/macio_asic.c
- drivers/media/dvb/bt8xx/dvb-bt8xx.c
- drivers/media/video/bttv-gpio.c
- drivers/media/video/bttv.h
- drivers/mfd/mcp-core.c
- drivers/mmc/mmc_sysfs.c
- drivers/pci/pci-driver.c
- drivers/pcmcia/ds.c
- drivers/pnp/driver.c
- drivers/rapidio/rio-driver.c
- drivers/s390/cio/ccwgroup.c
- drivers/s390/cio/css.c
- drivers/s390/cio/css.h
- drivers/s390/cio/device.c
- drivers/scsi/scsi_debug.c
- drivers/sh/superhyway/superhyway.c
- drivers/usb/gadget/ether.c
- drivers/usb/gadget/inode.c
- drivers/usb/gadget/serial.c
- drivers/usb/gadget/zero.c
- drivers/usb/serial/bus.c
- drivers/zorro/zorro-driver.c
- include/linux/device.h
- include/linux/ide.h
arch/arm/common/locomo.c
| ... | ... | @@ -1103,14 +1103,14 @@ |
| 1103 | 1103 | struct bus_type locomo_bus_type = { |
| 1104 | 1104 | .name = "locomo-bus", |
| 1105 | 1105 | .match = locomo_match, |
| 1106 | + .probe = locomo_bus_probe, | |
| 1107 | + .remove = locomo_bus_remove, | |
| 1106 | 1108 | .suspend = locomo_bus_suspend, |
| 1107 | 1109 | .resume = locomo_bus_resume, |
| 1108 | 1110 | }; |
| 1109 | 1111 | |
| 1110 | 1112 | int locomo_driver_register(struct locomo_driver *driver) |
| 1111 | 1113 | { |
| 1112 | - driver->drv.probe = locomo_bus_probe; | |
| 1113 | - driver->drv.remove = locomo_bus_remove; | |
| 1114 | 1114 | driver->drv.bus = &locomo_bus_type; |
| 1115 | 1115 | return driver_register(&driver->drv); |
| 1116 | 1116 | } |
arch/arm/common/sa1111.c
| ... | ... | @@ -1247,14 +1247,14 @@ |
| 1247 | 1247 | struct bus_type sa1111_bus_type = { |
| 1248 | 1248 | .name = "sa1111-rab", |
| 1249 | 1249 | .match = sa1111_match, |
| 1250 | + .probe = sa1111_bus_probe, | |
| 1251 | + .remove = sa1111_bus_remove, | |
| 1250 | 1252 | .suspend = sa1111_bus_suspend, |
| 1251 | 1253 | .resume = sa1111_bus_resume, |
| 1252 | 1254 | }; |
| 1253 | 1255 | |
| 1254 | 1256 | int sa1111_driver_register(struct sa1111_driver *driver) |
| 1255 | 1257 | { |
| 1256 | - driver->drv.probe = sa1111_bus_probe; | |
| 1257 | - driver->drv.remove = sa1111_bus_remove; | |
| 1258 | 1258 | driver->drv.bus = &sa1111_bus_type; |
| 1259 | 1259 | return driver_register(&driver->drv); |
| 1260 | 1260 | } |
arch/arm/kernel/ecard.c
| ... | ... | @@ -1147,9 +1147,11 @@ |
| 1147 | 1147 | struct ecard_driver *drv = ECARD_DRV(dev->driver); |
| 1148 | 1148 | struct ecard_request req; |
| 1149 | 1149 | |
| 1150 | - if (drv->shutdown) | |
| 1151 | - drv->shutdown(ec); | |
| 1152 | - ecard_release(ec); | |
| 1150 | + if (dev->driver) { | |
| 1151 | + if (drv->shutdown) | |
| 1152 | + drv->shutdown(ec); | |
| 1153 | + ecard_release(ec); | |
| 1154 | + } | |
| 1153 | 1155 | |
| 1154 | 1156 | /* |
| 1155 | 1157 | * If this card has a loader, call the reset handler. |
| ... | ... | @@ -1164,9 +1166,6 @@ |
| 1164 | 1166 | int ecard_register_driver(struct ecard_driver *drv) |
| 1165 | 1167 | { |
| 1166 | 1168 | drv->drv.bus = &ecard_bus_type; |
| 1167 | - drv->drv.probe = ecard_drv_probe; | |
| 1168 | - drv->drv.remove = ecard_drv_remove; | |
| 1169 | - drv->drv.shutdown = ecard_drv_shutdown; | |
| 1170 | 1169 | |
| 1171 | 1170 | return driver_register(&drv->drv); |
| 1172 | 1171 | } |
| ... | ... | @@ -1195,6 +1194,9 @@ |
| 1195 | 1194 | .name = "ecard", |
| 1196 | 1195 | .dev_attrs = ecard_dev_attrs, |
| 1197 | 1196 | .match = ecard_match, |
| 1197 | + .probe = ecard_drv_probe, | |
| 1198 | + .remove = ecard_drv_remove, | |
| 1199 | + .shutdown = ecard_drv_shutdown, | |
| 1198 | 1200 | }; |
| 1199 | 1201 | |
| 1200 | 1202 | static int ecard_bus_init(void) |
arch/arm/mach-integrator/lm.c
| ... | ... | @@ -22,20 +22,6 @@ |
| 22 | 22 | return 1; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -static struct bus_type lm_bustype = { | |
| 26 | - .name = "logicmodule", | |
| 27 | - .match = lm_match, | |
| 28 | -// .suspend = lm_suspend, | |
| 29 | -// .resume = lm_resume, | |
| 30 | -}; | |
| 31 | - | |
| 32 | -static int __init lm_init(void) | |
| 33 | -{ | |
| 34 | - return bus_register(&lm_bustype); | |
| 35 | -} | |
| 36 | - | |
| 37 | -postcore_initcall(lm_init); | |
| 38 | - | |
| 39 | 25 | static int lm_bus_probe(struct device *dev) |
| 40 | 26 | { |
| 41 | 27 | struct lm_device *lmdev = to_lm_device(dev); |
| 42 | 28 | |
| 43 | 29 | |
| ... | ... | @@ -49,16 +35,30 @@ |
| 49 | 35 | struct lm_device *lmdev = to_lm_device(dev); |
| 50 | 36 | struct lm_driver *lmdrv = to_lm_driver(dev->driver); |
| 51 | 37 | |
| 52 | - lmdrv->remove(lmdev); | |
| 38 | + if (lmdrv->remove) | |
| 39 | + lmdrv->remove(lmdev); | |
| 53 | 40 | return 0; |
| 54 | 41 | } |
| 55 | 42 | |
| 43 | +static struct bus_type lm_bustype = { | |
| 44 | + .name = "logicmodule", | |
| 45 | + .match = lm_match, | |
| 46 | + .probe = lm_bus_probe, | |
| 47 | + .remove = lm_bus_remove, | |
| 48 | +// .suspend = lm_bus_suspend, | |
| 49 | +// .resume = lm_bus_resume, | |
| 50 | +}; | |
| 51 | + | |
| 52 | +static int __init lm_init(void) | |
| 53 | +{ | |
| 54 | + return bus_register(&lm_bustype); | |
| 55 | +} | |
| 56 | + | |
| 57 | +postcore_initcall(lm_init); | |
| 58 | + | |
| 56 | 59 | int lm_driver_register(struct lm_driver *drv) |
| 57 | 60 | { |
| 58 | 61 | drv->drv.bus = &lm_bustype; |
| 59 | - drv->drv.probe = lm_bus_probe; | |
| 60 | - drv->drv.remove = lm_bus_remove; | |
| 61 | - | |
| 62 | 62 | return driver_register(&drv->drv); |
| 63 | 63 | } |
| 64 | 64 |
arch/ia64/sn/kernel/tiocx.c
| ... | ... | @@ -77,12 +77,6 @@ |
| 77 | 77 | kfree(to_cx_dev(dev)); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | -struct bus_type tiocx_bus_type = { | |
| 81 | - .name = "tiocx", | |
| 82 | - .match = tiocx_match, | |
| 83 | - .uevent = tiocx_uevent, | |
| 84 | -}; | |
| 85 | - | |
| 86 | 80 | /** |
| 87 | 81 | * cx_device_match - Find cx_device in the id table. |
| 88 | 82 | * @ids: id table from driver |
| ... | ... | @@ -149,6 +143,14 @@ |
| 149 | 143 | return 0; |
| 150 | 144 | } |
| 151 | 145 | |
| 146 | +struct bus_type tiocx_bus_type = { | |
| 147 | + .name = "tiocx", | |
| 148 | + .match = tiocx_match, | |
| 149 | + .uevent = tiocx_uevent, | |
| 150 | + .probe = cx_device_probe, | |
| 151 | + .remove = cx_driver_remove, | |
| 152 | +}; | |
| 153 | + | |
| 152 | 154 | /** |
| 153 | 155 | * cx_driver_register - Register the driver. |
| 154 | 156 | * @cx_driver: driver table (cx_drv struct) from driver |
| ... | ... | @@ -162,8 +164,6 @@ |
| 162 | 164 | { |
| 163 | 165 | cx_driver->driver.name = cx_driver->name; |
| 164 | 166 | cx_driver->driver.bus = &tiocx_bus_type; |
| 165 | - cx_driver->driver.probe = cx_device_probe; | |
| 166 | - cx_driver->driver.remove = cx_driver_remove; | |
| 167 | 167 | |
| 168 | 168 | return driver_register(&cx_driver->driver); |
| 169 | 169 | } |
arch/parisc/kernel/drivers.c
| ... | ... | @@ -173,8 +173,6 @@ |
| 173 | 173 | WARN_ON(driver->drv.probe != NULL); |
| 174 | 174 | WARN_ON(driver->drv.remove != NULL); |
| 175 | 175 | |
| 176 | - driver->drv.probe = parisc_driver_probe; | |
| 177 | - driver->drv.remove = parisc_driver_remove; | |
| 178 | 176 | driver->drv.name = driver->name; |
| 179 | 177 | |
| 180 | 178 | return driver_register(&driver->drv); |
| ... | ... | @@ -575,6 +573,8 @@ |
| 575 | 573 | .name = "parisc", |
| 576 | 574 | .match = parisc_generic_match, |
| 577 | 575 | .dev_attrs = parisc_device_attrs, |
| 576 | + .probe = parisc_driver_probe, | |
| 577 | + .remove = parisc_driver_remove, | |
| 578 | 578 | }; |
| 579 | 579 | |
| 580 | 580 | /** |
arch/powerpc/kernel/of_device.c
| ... | ... | @@ -132,6 +132,8 @@ |
| 132 | 132 | struct bus_type of_platform_bus_type = { |
| 133 | 133 | .name = "of_platform", |
| 134 | 134 | .match = of_platform_bus_match, |
| 135 | + .probe = of_device_probe, | |
| 136 | + .remove = of_device_remove, | |
| 135 | 137 | .suspend = of_device_suspend, |
| 136 | 138 | .resume = of_device_resume, |
| 137 | 139 | }; |
| ... | ... | @@ -150,8 +152,6 @@ |
| 150 | 152 | /* initialize common driver fields */ |
| 151 | 153 | drv->driver.name = drv->name; |
| 152 | 154 | drv->driver.bus = &of_platform_bus_type; |
| 153 | - drv->driver.probe = of_device_probe; | |
| 154 | - drv->driver.remove = of_device_remove; | |
| 155 | 155 | |
| 156 | 156 | /* register with core */ |
| 157 | 157 | count = driver_register(&drv->driver); |
arch/powerpc/kernel/vio.c
| ... | ... | @@ -76,7 +76,7 @@ |
| 76 | 76 | struct vio_dev *viodev = to_vio_dev(dev); |
| 77 | 77 | struct vio_driver *viodrv = to_vio_driver(dev->driver); |
| 78 | 78 | |
| 79 | - if (viodrv->shutdown) | |
| 79 | + if (dev->driver && viodrv->shutdown) | |
| 80 | 80 | viodrv->shutdown(viodev); |
| 81 | 81 | } |
| 82 | 82 | |
| ... | ... | @@ -91,9 +91,6 @@ |
| 91 | 91 | |
| 92 | 92 | /* fill in 'struct driver' fields */ |
| 93 | 93 | viodrv->driver.bus = &vio_bus_type; |
| 94 | - viodrv->driver.probe = vio_bus_probe; | |
| 95 | - viodrv->driver.remove = vio_bus_remove; | |
| 96 | - viodrv->driver.shutdown = vio_bus_shutdown; | |
| 97 | 94 | |
| 98 | 95 | return driver_register(&viodrv->driver); |
| 99 | 96 | } |
| ... | ... | @@ -295,5 +292,8 @@ |
| 295 | 292 | .name = "vio", |
| 296 | 293 | .uevent = vio_hotplug, |
| 297 | 294 | .match = vio_bus_match, |
| 295 | + .probe = vio_bus_probe, | |
| 296 | + .remove = vio_bus_remove, | |
| 297 | + .shutdown = vio_bus_shutdown, | |
| 298 | 298 | }; |
arch/ppc/syslib/ocp.c
| ... | ... | @@ -189,6 +189,8 @@ |
| 189 | 189 | struct bus_type ocp_bus_type = { |
| 190 | 190 | .name = "ocp", |
| 191 | 191 | .match = ocp_device_match, |
| 192 | + .probe = ocp_driver_probe, | |
| 193 | + .remove = ocp_driver_remove, | |
| 192 | 194 | .suspend = ocp_device_suspend, |
| 193 | 195 | .resume = ocp_device_resume, |
| 194 | 196 | }; |
| ... | ... | @@ -210,8 +212,6 @@ |
| 210 | 212 | /* initialize common driver fields */ |
| 211 | 213 | drv->driver.name = drv->name; |
| 212 | 214 | drv->driver.bus = &ocp_bus_type; |
| 213 | - drv->driver.probe = ocp_device_probe; | |
| 214 | - drv->driver.remove = ocp_device_remove; | |
| 215 | 215 | |
| 216 | 216 | /* register with core */ |
| 217 | 217 | return driver_register(&drv->driver); |
arch/sh/kernel/cpu/bus.c
| ... | ... | @@ -53,21 +53,6 @@ |
| 53 | 53 | return 0; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | -static struct device sh_bus_devices[SH_NR_BUSES] = { | |
| 57 | - { | |
| 58 | - .bus_id = SH_BUS_NAME_VIRT, | |
| 59 | - }, | |
| 60 | -}; | |
| 61 | - | |
| 62 | -struct bus_type sh_bus_types[SH_NR_BUSES] = { | |
| 63 | - { | |
| 64 | - .name = SH_BUS_NAME_VIRT, | |
| 65 | - .match = sh_bus_match, | |
| 66 | - .suspend = sh_bus_suspend, | |
| 67 | - .resume = sh_bus_resume, | |
| 68 | - }, | |
| 69 | -}; | |
| 70 | - | |
| 71 | 56 | static int sh_device_probe(struct device *dev) |
| 72 | 57 | { |
| 73 | 58 | struct sh_dev *shdev = to_sh_dev(dev); |
| ... | ... | @@ -90,6 +75,23 @@ |
| 90 | 75 | return 0; |
| 91 | 76 | } |
| 92 | 77 | |
| 78 | +static struct device sh_bus_devices[SH_NR_BUSES] = { | |
| 79 | + { | |
| 80 | + .bus_id = SH_BUS_NAME_VIRT, | |
| 81 | + }, | |
| 82 | +}; | |
| 83 | + | |
| 84 | +struct bus_type sh_bus_types[SH_NR_BUSES] = { | |
| 85 | + { | |
| 86 | + .name = SH_BUS_NAME_VIRT, | |
| 87 | + .match = sh_bus_match, | |
| 88 | + .probe = sh_bus_probe, | |
| 89 | + .remove = sh_bus_remove, | |
| 90 | + .suspend = sh_bus_suspend, | |
| 91 | + .resume = sh_bus_resume, | |
| 92 | + }, | |
| 93 | +}; | |
| 94 | + | |
| 93 | 95 | int sh_device_register(struct sh_dev *dev) |
| 94 | 96 | { |
| 95 | 97 | if (!dev) |
| ... | ... | @@ -133,8 +135,6 @@ |
| 133 | 135 | return -EINVAL; |
| 134 | 136 | } |
| 135 | 137 | |
| 136 | - drv->drv.probe = sh_device_probe; | |
| 137 | - drv->drv.remove = sh_device_remove; | |
| 138 | 138 | drv->drv.bus = &sh_bus_types[drv->bus_id]; |
| 139 | 139 | |
| 140 | 140 | return driver_register(&drv->drv); |
drivers/base/dd.c
| ... | ... | @@ -78,7 +78,13 @@ |
| 78 | 78 | pr_debug("%s: Matched Device %s with Driver %s\n", |
| 79 | 79 | drv->bus->name, dev->bus_id, drv->name); |
| 80 | 80 | dev->driver = drv; |
| 81 | - if (drv->probe) { | |
| 81 | + if (dev->bus->probe) { | |
| 82 | + ret = dev->bus->probe(dev); | |
| 83 | + if (ret) { | |
| 84 | + dev->driver = NULL; | |
| 85 | + goto ProbeFailed; | |
| 86 | + } | |
| 87 | + } else if (drv->probe) { | |
| 82 | 88 | ret = drv->probe(dev); |
| 83 | 89 | if (ret) { |
| 84 | 90 | dev->driver = NULL; |
| ... | ... | @@ -203,7 +209,9 @@ |
| 203 | 209 | sysfs_remove_link(&dev->kobj, "driver"); |
| 204 | 210 | klist_remove(&dev->knode_driver); |
| 205 | 211 | |
| 206 | - if (drv->remove) | |
| 212 | + if (dev->bus->remove) | |
| 213 | + dev->bus->remove(dev); | |
| 214 | + else if (drv->remove) | |
| 207 | 215 | drv->remove(dev); |
| 208 | 216 | dev->driver = NULL; |
| 209 | 217 | put_driver(drv); |
drivers/base/driver.c
| ... | ... | @@ -171,6 +171,11 @@ |
| 171 | 171 | */ |
| 172 | 172 | int driver_register(struct device_driver * drv) |
| 173 | 173 | { |
| 174 | + if ((drv->bus->probe && drv->probe) || | |
| 175 | + (drv->bus->remove && drv->remove) || | |
| 176 | + (drv->bus->shutdown && drv->shutdown)) { | |
| 177 | + printk(KERN_WARNING "Driver '%s' needs updating - please use bus_type methods\n", drv->name); | |
| 178 | + } | |
| 174 | 179 | klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put); |
| 175 | 180 | init_completion(&drv->unloaded); |
| 176 | 181 | return bus_add_driver(drv); |
drivers/base/platform.c
| ... | ... | @@ -327,7 +327,7 @@ |
| 327 | 327 | * @pdev: platform device we're unregistering |
| 328 | 328 | * |
| 329 | 329 | * Unregistration is done in 2 steps. Fisrt we release all resources |
| 330 | - * and remove it from the sybsystem, then we drop reference count by | |
| 330 | + * and remove it from the subsystem, then we drop reference count by | |
| 331 | 331 | * calling platform_device_put(). |
| 332 | 332 | */ |
| 333 | 333 | void platform_device_unregister(struct platform_device * pdev) |
drivers/base/power/shutdown.c
| ... | ... | @@ -35,12 +35,15 @@ |
| 35 | 35 | */ |
| 36 | 36 | void device_shutdown(void) |
| 37 | 37 | { |
| 38 | - struct device * dev; | |
| 38 | + struct device * dev, *devn; | |
| 39 | 39 | |
| 40 | 40 | down_write(&devices_subsys.rwsem); |
| 41 | - list_for_each_entry_reverse(dev, &devices_subsys.kset.list, | |
| 41 | + list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list, | |
| 42 | 42 | kobj.entry) { |
| 43 | - if (dev->driver && dev->driver->shutdown) { | |
| 43 | + if (dev->bus && dev->bus->shutdown) { | |
| 44 | + dev_dbg(dev, "shutdown\n"); | |
| 45 | + dev->bus->shutdown(dev); | |
| 46 | + } else if (dev->driver && dev->driver->shutdown) { | |
| 44 | 47 | dev_dbg(dev, "shutdown\n"); |
| 45 | 48 | dev->driver->shutdown(dev); |
| 46 | 49 | } |
drivers/dio/dio-driver.c
| ... | ... | @@ -83,7 +83,6 @@ |
| 83 | 83 | /* initialize common driver fields */ |
| 84 | 84 | drv->driver.name = drv->name; |
| 85 | 85 | drv->driver.bus = &dio_bus_type; |
| 86 | - drv->driver.probe = dio_device_probe; | |
| 87 | 86 | |
| 88 | 87 | /* register with core */ |
| 89 | 88 | count = driver_register(&drv->driver); |
| ... | ... | @@ -145,7 +144,8 @@ |
| 145 | 144 | |
| 146 | 145 | struct bus_type dio_bus_type = { |
| 147 | 146 | .name = "dio", |
| 148 | - .match = dio_bus_match | |
| 147 | + .match = dio_bus_match, | |
| 148 | + .probe = dio_device_probe, | |
| 149 | 149 | }; |
| 150 | 150 | |
| 151 | 151 |
drivers/i2c/i2c-core.c
| ... | ... | @@ -63,13 +63,6 @@ |
| 63 | 63 | return rc; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -struct bus_type i2c_bus_type = { | |
| 67 | - .name = "i2c", | |
| 68 | - .match = i2c_device_match, | |
| 69 | - .suspend = i2c_bus_suspend, | |
| 70 | - .resume = i2c_bus_resume, | |
| 71 | -}; | |
| 72 | - | |
| 73 | 66 | static int i2c_device_probe(struct device *dev) |
| 74 | 67 | { |
| 75 | 68 | return -ENODEV; |
| ... | ... | @@ -80,6 +73,15 @@ |
| 80 | 73 | return 0; |
| 81 | 74 | } |
| 82 | 75 | |
| 76 | +struct bus_type i2c_bus_type = { | |
| 77 | + .name = "i2c", | |
| 78 | + .match = i2c_device_match, | |
| 79 | + .probe = i2c_device_probe, | |
| 80 | + .remove = i2c_device_remove, | |
| 81 | + .suspend = i2c_bus_suspend, | |
| 82 | + .resume = i2c_bus_resume, | |
| 83 | +}; | |
| 84 | + | |
| 83 | 85 | void i2c_adapter_dev_release(struct device *dev) |
| 84 | 86 | { |
| 85 | 87 | struct i2c_adapter *adap = dev_to_i2c_adapter(dev); |
| ... | ... | @@ -90,8 +92,6 @@ |
| 90 | 92 | .owner = THIS_MODULE, |
| 91 | 93 | .name = "i2c_adapter", |
| 92 | 94 | .bus = &i2c_bus_type, |
| 93 | - .probe = i2c_device_probe, | |
| 94 | - .remove = i2c_device_remove, | |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | 97 | static void i2c_adapter_class_dev_release(struct class_device *dev) |
| ... | ... | @@ -294,8 +294,6 @@ |
| 294 | 294 | /* add the driver to the list of i2c drivers in the driver core */ |
| 295 | 295 | driver->driver.owner = owner; |
| 296 | 296 | driver->driver.bus = &i2c_bus_type; |
| 297 | - driver->driver.probe = i2c_device_probe; | |
| 298 | - driver->driver.remove = i2c_device_remove; | |
| 299 | 297 | |
| 300 | 298 | res = driver_register(&driver->driver); |
| 301 | 299 | if (res) |
drivers/ide/ide-cd.c
| ... | ... | @@ -3256,9 +3256,8 @@ |
| 3256 | 3256 | } |
| 3257 | 3257 | #endif |
| 3258 | 3258 | |
| 3259 | -static int ide_cd_remove(struct device *dev) | |
| 3259 | +static void ide_cd_remove(ide_drive_t *drive) | |
| 3260 | 3260 | { |
| 3261 | - ide_drive_t *drive = to_ide_device(dev); | |
| 3262 | 3261 | struct cdrom_info *info = drive->driver_data; |
| 3263 | 3262 | |
| 3264 | 3263 | ide_unregister_subdriver(drive, info->driver); |
| ... | ... | @@ -3266,8 +3265,6 @@ |
| 3266 | 3265 | del_gendisk(info->disk); |
| 3267 | 3266 | |
| 3268 | 3267 | ide_cd_put(info); |
| 3269 | - | |
| 3270 | - return 0; | |
| 3271 | 3268 | } |
| 3272 | 3269 | |
| 3273 | 3270 | static void ide_cd_release(struct kref *kref) |
| ... | ... | @@ -3291,7 +3288,7 @@ |
| 3291 | 3288 | kfree(info); |
| 3292 | 3289 | } |
| 3293 | 3290 | |
| 3294 | -static int ide_cd_probe(struct device *); | |
| 3291 | +static int ide_cd_probe(ide_drive_t *); | |
| 3295 | 3292 | |
| 3296 | 3293 | #ifdef CONFIG_PROC_FS |
| 3297 | 3294 | static int proc_idecd_read_capacity |
| 3298 | 3295 | |
| ... | ... | @@ -3317,9 +3314,9 @@ |
| 3317 | 3314 | .owner = THIS_MODULE, |
| 3318 | 3315 | .name = "ide-cdrom", |
| 3319 | 3316 | .bus = &ide_bus_type, |
| 3320 | - .probe = ide_cd_probe, | |
| 3321 | - .remove = ide_cd_remove, | |
| 3322 | 3317 | }, |
| 3318 | + .probe = ide_cd_probe, | |
| 3319 | + .remove = ide_cd_remove, | |
| 3323 | 3320 | .version = IDECD_VERSION, |
| 3324 | 3321 | .media = ide_cdrom, |
| 3325 | 3322 | .supports_dsc_overlap = 1, |
| 3326 | 3323 | |
| ... | ... | @@ -3413,9 +3410,8 @@ |
| 3413 | 3410 | module_param(ignore, charp, 0400); |
| 3414 | 3411 | MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); |
| 3415 | 3412 | |
| 3416 | -static int ide_cd_probe(struct device *dev) | |
| 3413 | +static int ide_cd_probe(ide_drive_t *drive) | |
| 3417 | 3414 | { |
| 3418 | - ide_drive_t *drive = to_ide_device(dev); | |
| 3419 | 3415 | struct cdrom_info *info; |
| 3420 | 3416 | struct gendisk *g; |
| 3421 | 3417 | struct request_sense sense; |
drivers/ide/ide-disk.c
| ... | ... | @@ -997,9 +997,8 @@ |
| 997 | 997 | printk(KERN_INFO "%s: wcache flush failed!\n", drive->name); |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | -static int ide_disk_remove(struct device *dev) | |
| 1000 | +static void ide_disk_remove(ide_drive_t *drive) | |
| 1001 | 1001 | { |
| 1002 | - ide_drive_t *drive = to_ide_device(dev); | |
| 1003 | 1002 | struct ide_disk_obj *idkp = drive->driver_data; |
| 1004 | 1003 | struct gendisk *g = idkp->disk; |
| 1005 | 1004 | |
| ... | ... | @@ -1010,8 +1009,6 @@ |
| 1010 | 1009 | ide_cacheflush_p(drive); |
| 1011 | 1010 | |
| 1012 | 1011 | ide_disk_put(idkp); |
| 1013 | - | |
| 1014 | - return 0; | |
| 1015 | 1012 | } |
| 1016 | 1013 | |
| 1017 | 1014 | static void ide_disk_release(struct kref *kref) |
| 1018 | 1015 | |
| 1019 | 1016 | |
| ... | ... | @@ -1027,12 +1024,10 @@ |
| 1027 | 1024 | kfree(idkp); |
| 1028 | 1025 | } |
| 1029 | 1026 | |
| 1030 | -static int ide_disk_probe(struct device *dev); | |
| 1027 | +static int ide_disk_probe(ide_drive_t *drive); | |
| 1031 | 1028 | |
| 1032 | -static void ide_device_shutdown(struct device *dev) | |
| 1029 | +static void ide_device_shutdown(ide_drive_t *drive) | |
| 1033 | 1030 | { |
| 1034 | - ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); | |
| 1035 | - | |
| 1036 | 1031 | #ifdef CONFIG_ALPHA |
| 1037 | 1032 | /* On Alpha, halt(8) doesn't actually turn the machine off, |
| 1038 | 1033 | it puts you into the sort of firmware monitor. Typically, |
| ... | ... | @@ -1054,7 +1049,7 @@ |
| 1054 | 1049 | } |
| 1055 | 1050 | |
| 1056 | 1051 | printk("Shutdown: %s\n", drive->name); |
| 1057 | - dev->bus->suspend(dev, PMSG_SUSPEND); | |
| 1052 | + drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND); | |
| 1058 | 1053 | } |
| 1059 | 1054 | |
| 1060 | 1055 | static ide_driver_t idedisk_driver = { |
| 1061 | 1056 | |
| ... | ... | @@ -1062,10 +1057,10 @@ |
| 1062 | 1057 | .owner = THIS_MODULE, |
| 1063 | 1058 | .name = "ide-disk", |
| 1064 | 1059 | .bus = &ide_bus_type, |
| 1065 | - .probe = ide_disk_probe, | |
| 1066 | - .remove = ide_disk_remove, | |
| 1067 | - .shutdown = ide_device_shutdown, | |
| 1068 | 1060 | }, |
| 1061 | + .probe = ide_disk_probe, | |
| 1062 | + .remove = ide_disk_remove, | |
| 1063 | + .shutdown = ide_device_shutdown, | |
| 1069 | 1064 | .version = IDEDISK_VERSION, |
| 1070 | 1065 | .media = ide_disk, |
| 1071 | 1066 | .supports_dsc_overlap = 0, |
| 1072 | 1067 | |
| ... | ... | @@ -1182,9 +1177,8 @@ |
| 1182 | 1177 | |
| 1183 | 1178 | MODULE_DESCRIPTION("ATA DISK Driver"); |
| 1184 | 1179 | |
| 1185 | -static int ide_disk_probe(struct device *dev) | |
| 1180 | +static int ide_disk_probe(ide_drive_t *drive) | |
| 1186 | 1181 | { |
| 1187 | - ide_drive_t *drive = to_ide_device(dev); | |
| 1188 | 1182 | struct ide_disk_obj *idkp; |
| 1189 | 1183 | struct gendisk *g; |
| 1190 | 1184 |
drivers/ide/ide-floppy.c
| ... | ... | @@ -1871,9 +1871,8 @@ |
| 1871 | 1871 | idefloppy_add_settings(drive); |
| 1872 | 1872 | } |
| 1873 | 1873 | |
| 1874 | -static int ide_floppy_remove(struct device *dev) | |
| 1874 | +static void ide_floppy_remove(ide_drive_t *drive) | |
| 1875 | 1875 | { |
| 1876 | - ide_drive_t *drive = to_ide_device(dev); | |
| 1877 | 1876 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 1878 | 1877 | struct gendisk *g = floppy->disk; |
| 1879 | 1878 | |
| ... | ... | @@ -1882,8 +1881,6 @@ |
| 1882 | 1881 | del_gendisk(g); |
| 1883 | 1882 | |
| 1884 | 1883 | ide_floppy_put(floppy); |
| 1885 | - | |
| 1886 | - return 0; | |
| 1887 | 1884 | } |
| 1888 | 1885 | |
| 1889 | 1886 | static void ide_floppy_release(struct kref *kref) |
| 1890 | 1887 | |
| 1891 | 1888 | |
| ... | ... | @@ -1922,16 +1919,16 @@ |
| 1922 | 1919 | |
| 1923 | 1920 | #endif /* CONFIG_PROC_FS */ |
| 1924 | 1921 | |
| 1925 | -static int ide_floppy_probe(struct device *); | |
| 1922 | +static int ide_floppy_probe(ide_drive_t *); | |
| 1926 | 1923 | |
| 1927 | 1924 | static ide_driver_t idefloppy_driver = { |
| 1928 | 1925 | .gen_driver = { |
| 1929 | 1926 | .owner = THIS_MODULE, |
| 1930 | 1927 | .name = "ide-floppy", |
| 1931 | 1928 | .bus = &ide_bus_type, |
| 1932 | - .probe = ide_floppy_probe, | |
| 1933 | - .remove = ide_floppy_remove, | |
| 1934 | 1929 | }, |
| 1930 | + .probe = ide_floppy_probe, | |
| 1931 | + .remove = ide_floppy_remove, | |
| 1935 | 1932 | .version = IDEFLOPPY_VERSION, |
| 1936 | 1933 | .media = ide_floppy, |
| 1937 | 1934 | .supports_dsc_overlap = 0, |
| 1938 | 1935 | |
| ... | ... | @@ -2136,9 +2133,8 @@ |
| 2136 | 2133 | .revalidate_disk= idefloppy_revalidate_disk |
| 2137 | 2134 | }; |
| 2138 | 2135 | |
| 2139 | -static int ide_floppy_probe(struct device *dev) | |
| 2136 | +static int ide_floppy_probe(ide_drive_t *drive) | |
| 2140 | 2137 | { |
| 2141 | - ide_drive_t *drive = to_ide_device(dev); | |
| 2142 | 2138 | idefloppy_floppy_t *floppy; |
| 2143 | 2139 | struct gendisk *g; |
| 2144 | 2140 |
drivers/ide/ide-tape.c
| ... | ... | @@ -4682,9 +4682,8 @@ |
| 4682 | 4682 | idetape_add_settings(drive); |
| 4683 | 4683 | } |
| 4684 | 4684 | |
| 4685 | -static int ide_tape_remove(struct device *dev) | |
| 4685 | +static void ide_tape_remove(ide_drive_t *drive) | |
| 4686 | 4686 | { |
| 4687 | - ide_drive_t *drive = to_ide_device(dev); | |
| 4688 | 4687 | idetape_tape_t *tape = drive->driver_data; |
| 4689 | 4688 | |
| 4690 | 4689 | ide_unregister_subdriver(drive, tape->driver); |
| ... | ... | @@ -4692,8 +4691,6 @@ |
| 4692 | 4691 | ide_unregister_region(tape->disk); |
| 4693 | 4692 | |
| 4694 | 4693 | ide_tape_put(tape); |
| 4695 | - | |
| 4696 | - return 0; | |
| 4697 | 4694 | } |
| 4698 | 4695 | |
| 4699 | 4696 | static void ide_tape_release(struct kref *kref) |
| 4700 | 4697 | |
| 4701 | 4698 | |
| ... | ... | @@ -4745,16 +4742,16 @@ |
| 4745 | 4742 | |
| 4746 | 4743 | #endif |
| 4747 | 4744 | |
| 4748 | -static int ide_tape_probe(struct device *); | |
| 4745 | +static int ide_tape_probe(ide_drive_t *); | |
| 4749 | 4746 | |
| 4750 | 4747 | static ide_driver_t idetape_driver = { |
| 4751 | 4748 | .gen_driver = { |
| 4752 | 4749 | .owner = THIS_MODULE, |
| 4753 | 4750 | .name = "ide-tape", |
| 4754 | 4751 | .bus = &ide_bus_type, |
| 4755 | - .probe = ide_tape_probe, | |
| 4756 | - .remove = ide_tape_remove, | |
| 4757 | 4752 | }, |
| 4753 | + .probe = ide_tape_probe, | |
| 4754 | + .remove = ide_tape_remove, | |
| 4758 | 4755 | .version = IDETAPE_VERSION, |
| 4759 | 4756 | .media = ide_tape, |
| 4760 | 4757 | .supports_dsc_overlap = 1, |
| 4761 | 4758 | |
| ... | ... | @@ -4825,9 +4822,8 @@ |
| 4825 | 4822 | .ioctl = idetape_ioctl, |
| 4826 | 4823 | }; |
| 4827 | 4824 | |
| 4828 | -static int ide_tape_probe(struct device *dev) | |
| 4825 | +static int ide_tape_probe(ide_drive_t *drive) | |
| 4829 | 4826 | { |
| 4830 | - ide_drive_t *drive = to_ide_device(dev); | |
| 4831 | 4827 | idetape_tape_t *tape; |
| 4832 | 4828 | struct gendisk *g; |
| 4833 | 4829 | int minor; |
| 4834 | 4830 | |
| ... | ... | @@ -4883,9 +4879,9 @@ |
| 4883 | 4879 | idetape_setup(drive, tape, minor); |
| 4884 | 4880 | |
| 4885 | 4881 | class_device_create(idetape_sysfs_class, NULL, |
| 4886 | - MKDEV(IDETAPE_MAJOR, minor), dev, "%s", tape->name); | |
| 4882 | + MKDEV(IDETAPE_MAJOR, minor), &drive->gendev, "%s", tape->name); | |
| 4887 | 4883 | class_device_create(idetape_sysfs_class, NULL, |
| 4888 | - MKDEV(IDETAPE_MAJOR, minor + 128), dev, "n%s", tape->name); | |
| 4884 | + MKDEV(IDETAPE_MAJOR, minor + 128), &drive->gendev, "n%s", tape->name); | |
| 4889 | 4885 | |
| 4890 | 4886 | devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor), |
| 4891 | 4887 | S_IFCHR | S_IRUGO | S_IWUGO, |
drivers/ide/ide.c
| ... | ... | @@ -1949,10 +1949,41 @@ |
| 1949 | 1949 | return 0; |
| 1950 | 1950 | } |
| 1951 | 1951 | |
| 1952 | +static int generic_ide_probe(struct device *dev) | |
| 1953 | +{ | |
| 1954 | + ide_drive_t *drive = to_ide_device(dev); | |
| 1955 | + ide_driver_t *drv = to_ide_driver(dev->driver); | |
| 1956 | + | |
| 1957 | + return drv->probe ? drv->probe(drive) : -ENODEV; | |
| 1958 | +} | |
| 1959 | + | |
| 1960 | +static int generic_ide_remove(struct device *dev) | |
| 1961 | +{ | |
| 1962 | + ide_drive_t *drive = to_ide_device(dev); | |
| 1963 | + ide_driver_t *drv = to_ide_driver(dev->driver); | |
| 1964 | + | |
| 1965 | + if (drv->remove) | |
| 1966 | + drv->remove(drive); | |
| 1967 | + | |
| 1968 | + return 0; | |
| 1969 | +} | |
| 1970 | + | |
| 1971 | +static void generic_ide_shutdown(struct device *dev) | |
| 1972 | +{ | |
| 1973 | + ide_drive_t *drive = to_ide_device(dev); | |
| 1974 | + ide_driver_t *drv = to_ide_driver(dev->driver); | |
| 1975 | + | |
| 1976 | + if (dev->driver && drv->shutdown) | |
| 1977 | + drv->shutdown(drive); | |
| 1978 | +} | |
| 1979 | + | |
| 1952 | 1980 | struct bus_type ide_bus_type = { |
| 1953 | 1981 | .name = "ide", |
| 1954 | 1982 | .match = ide_bus_match, |
| 1955 | 1983 | .uevent = ide_uevent, |
| 1984 | + .probe = generic_ide_probe, | |
| 1985 | + .remove = generic_ide_remove, | |
| 1986 | + .shutdown = generic_ide_shutdown, | |
| 1956 | 1987 | .dev_attrs = ide_dev_attrs, |
| 1957 | 1988 | .suspend = generic_ide_suspend, |
| 1958 | 1989 | .resume = generic_ide_resume, |
drivers/input/gameport/gameport.c
| ... | ... | @@ -50,9 +50,7 @@ |
| 50 | 50 | |
| 51 | 51 | static LIST_HEAD(gameport_list); |
| 52 | 52 | |
| 53 | -static struct bus_type gameport_bus = { | |
| 54 | - .name = "gameport", | |
| 55 | -}; | |
| 53 | +static struct bus_type gameport_bus; | |
| 56 | 54 | |
| 57 | 55 | static void gameport_add_port(struct gameport *gameport); |
| 58 | 56 | static void gameport_destroy_port(struct gameport *gameport); |
| 59 | 57 | |
| ... | ... | @@ -703,11 +701,15 @@ |
| 703 | 701 | return 0; |
| 704 | 702 | } |
| 705 | 703 | |
| 704 | +static struct bus_type gameport_bus = { | |
| 705 | + .name = "gameport", | |
| 706 | + .probe = gameport_driver_probe, | |
| 707 | + .remove = gameport_driver_remove, | |
| 708 | +}; | |
| 709 | + | |
| 706 | 710 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) |
| 707 | 711 | { |
| 708 | 712 | drv->driver.bus = &gameport_bus; |
| 709 | - drv->driver.probe = gameport_driver_probe; | |
| 710 | - drv->driver.remove = gameport_driver_remove; | |
| 711 | 713 | gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER); |
| 712 | 714 | } |
| 713 | 715 |
drivers/input/input.c
| ... | ... | @@ -528,42 +528,58 @@ |
| 528 | 528 | INPUT_DEV_STRING_ATTR_SHOW(phys); |
| 529 | 529 | INPUT_DEV_STRING_ATTR_SHOW(uniq); |
| 530 | 530 | |
| 531 | -static int print_modalias_bits(char *buf, char prefix, unsigned long *arr, | |
| 531 | +static int print_modalias_bits(char *buf, int size, char prefix, unsigned long *arr, | |
| 532 | 532 | unsigned int min, unsigned int max) |
| 533 | 533 | { |
| 534 | 534 | int len, i; |
| 535 | 535 | |
| 536 | - len = sprintf(buf, "%c", prefix); | |
| 536 | + len = snprintf(buf, size, "%c", prefix); | |
| 537 | 537 | for (i = min; i < max; i++) |
| 538 | 538 | if (arr[LONG(i)] & BIT(i)) |
| 539 | - len += sprintf(buf+len, "%X,", i); | |
| 539 | + len += snprintf(buf + len, size - len, "%X,", i); | |
| 540 | 540 | return len; |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | -static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) | |
| 543 | +static int print_modalias(char *buf, int size, struct input_dev *id) | |
| 544 | 544 | { |
| 545 | - struct input_dev *id = to_input_dev(dev); | |
| 546 | - ssize_t len = 0; | |
| 545 | + int len; | |
| 547 | 546 | |
| 548 | - len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-", | |
| 547 | + len = snprintf(buf, size, "input:b%04Xv%04Xp%04Xe%04X-", | |
| 549 | 548 | id->id.bustype, |
| 550 | 549 | id->id.vendor, |
| 551 | 550 | id->id.product, |
| 552 | 551 | id->id.version); |
| 553 | 552 | |
| 554 | - len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX); | |
| 555 | - len += print_modalias_bits(buf+len, 'k', id->keybit, | |
| 553 | + len += print_modalias_bits(buf + len, size - len, 'e', id->evbit, | |
| 554 | + 0, EV_MAX); | |
| 555 | + len += print_modalias_bits(buf + len, size - len, 'k', id->keybit, | |
| 556 | 556 | KEY_MIN_INTERESTING, KEY_MAX); |
| 557 | - len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX); | |
| 558 | - len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX); | |
| 559 | - len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX); | |
| 560 | - len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX); | |
| 561 | - len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX); | |
| 562 | - len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX); | |
| 563 | - len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX); | |
| 564 | - len += sprintf(buf+len, "\n"); | |
| 557 | + len += print_modalias_bits(buf + len, size - len, 'r', id->relbit, | |
| 558 | + 0, REL_MAX); | |
| 559 | + len += print_modalias_bits(buf + len, size - len, 'a', id->absbit, | |
| 560 | + 0, ABS_MAX); | |
| 561 | + len += print_modalias_bits(buf + len, size - len, 'm', id->mscbit, | |
| 562 | + 0, MSC_MAX); | |
| 563 | + len += print_modalias_bits(buf + len, size - len, 'l', id->ledbit, | |
| 564 | + 0, LED_MAX); | |
| 565 | + len += print_modalias_bits(buf + len, size - len, 's', id->sndbit, | |
| 566 | + 0, SND_MAX); | |
| 567 | + len += print_modalias_bits(buf + len, size - len, 'f', id->ffbit, | |
| 568 | + 0, FF_MAX); | |
| 569 | + len += print_modalias_bits(buf + len, size - len, 'w', id->swbit, | |
| 570 | + 0, SW_MAX); | |
| 565 | 571 | return len; |
| 566 | 572 | } |
| 573 | + | |
| 574 | +static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) | |
| 575 | +{ | |
| 576 | + struct input_dev *id = to_input_dev(dev); | |
| 577 | + ssize_t len; | |
| 578 | + | |
| 579 | + len = print_modalias(buf, PAGE_SIZE, id); | |
| 580 | + len += snprintf(buf + len, PAGE_SIZE-len, "\n"); | |
| 581 | + return len; | |
| 582 | +} | |
| 567 | 583 | static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); |
| 568 | 584 | |
| 569 | 585 | static struct attribute *input_dev_attrs[] = { |
| 570 | 586 | |
| ... | ... | @@ -728,8 +744,11 @@ |
| 728 | 744 | if (test_bit(EV_SW, dev->evbit)) |
| 729 | 745 | INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); |
| 730 | 746 | |
| 731 | - envp[i] = NULL; | |
| 747 | + envp[i++] = buffer + len; | |
| 748 | + len += snprintf(buffer + len, buffer_size - len, "MODALIAS="); | |
| 749 | + len += print_modalias(buffer + len, buffer_size - len, dev) + 1; | |
| 732 | 750 | |
| 751 | + envp[i] = NULL; | |
| 733 | 752 | return 0; |
| 734 | 753 | } |
| 735 | 754 |
drivers/input/serio/serio.c
| ... | ... | @@ -59,9 +59,7 @@ |
| 59 | 59 | |
| 60 | 60 | static LIST_HEAD(serio_list); |
| 61 | 61 | |
| 62 | -static struct bus_type serio_bus = { | |
| 63 | - .name = "serio", | |
| 64 | -}; | |
| 62 | +static struct bus_type serio_bus; | |
| 65 | 63 | |
| 66 | 64 | static void serio_add_port(struct serio *serio); |
| 67 | 65 | static void serio_destroy_port(struct serio *serio); |
| 68 | 66 | |
| ... | ... | @@ -750,11 +748,15 @@ |
| 750 | 748 | return 0; |
| 751 | 749 | } |
| 752 | 750 | |
| 751 | +static struct bus_type serio_bus = { | |
| 752 | + .name = "serio", | |
| 753 | + .probe = serio_driver_probe, | |
| 754 | + .remove = serio_driver_remove, | |
| 755 | +}; | |
| 756 | + | |
| 753 | 757 | void __serio_register_driver(struct serio_driver *drv, struct module *owner) |
| 754 | 758 | { |
| 755 | 759 | drv->driver.bus = &serio_bus; |
| 756 | - drv->driver.probe = serio_driver_probe; | |
| 757 | - drv->driver.remove = serio_driver_remove; | |
| 758 | 760 | |
| 759 | 761 | serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER); |
| 760 | 762 | } |
drivers/macintosh/macio_asic.c
| ... | ... | @@ -211,6 +211,9 @@ |
| 211 | 211 | .name = "macio", |
| 212 | 212 | .match = macio_bus_match, |
| 213 | 213 | .uevent = macio_uevent, |
| 214 | + .probe = macio_device_probe, | |
| 215 | + .remove = macio_device_remove, | |
| 216 | + .shutdown = macio_device_shutdown, | |
| 214 | 217 | .suspend = macio_device_suspend, |
| 215 | 218 | .resume = macio_device_resume, |
| 216 | 219 | .dev_attrs = macio_dev_attrs, |
| ... | ... | @@ -528,9 +531,6 @@ |
| 528 | 531 | /* initialize common driver fields */ |
| 529 | 532 | drv->driver.name = drv->name; |
| 530 | 533 | drv->driver.bus = &macio_bus_type; |
| 531 | - drv->driver.probe = macio_device_probe; | |
| 532 | - drv->driver.remove = macio_device_remove; | |
| 533 | - drv->driver.shutdown = macio_device_shutdown; | |
| 534 | 534 | |
| 535 | 535 | /* register with core */ |
| 536 | 536 | count = driver_register(&drv->driver); |
drivers/media/dvb/bt8xx/dvb-bt8xx.c
| ... | ... | @@ -779,9 +779,8 @@ |
| 779 | 779 | return 0; |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | -static int dvb_bt8xx_probe(struct device *dev) | |
| 782 | +static int dvb_bt8xx_probe(struct bttv_sub_device *sub) | |
| 783 | 783 | { |
| 784 | - struct bttv_sub_device *sub = to_bttv_sub_dev(dev); | |
| 785 | 784 | struct dvb_bt8xx_card *card; |
| 786 | 785 | struct pci_dev* bttv_pci_dev; |
| 787 | 786 | int ret; |
| 788 | 787 | |
| 789 | 788 | |
| ... | ... | @@ -890,13 +889,13 @@ |
| 890 | 889 | return ret; |
| 891 | 890 | } |
| 892 | 891 | |
| 893 | - dev_set_drvdata(dev, card); | |
| 892 | + dev_set_drvdata(&sub->dev, card); | |
| 894 | 893 | return 0; |
| 895 | 894 | } |
| 896 | 895 | |
| 897 | -static int dvb_bt8xx_remove(struct device *dev) | |
| 896 | +static int dvb_bt8xx_remove(struct bttv_sub_device *sub) | |
| 898 | 897 | { |
| 899 | - struct dvb_bt8xx_card *card = dev_get_drvdata(dev); | |
| 898 | + struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev); | |
| 900 | 899 | |
| 901 | 900 | dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr); |
| 902 | 901 | |
| 903 | 902 | |
| ... | ... | @@ -919,14 +918,14 @@ |
| 919 | 918 | static struct bttv_sub_driver driver = { |
| 920 | 919 | .drv = { |
| 921 | 920 | .name = "dvb-bt8xx", |
| 922 | - .probe = dvb_bt8xx_probe, | |
| 923 | - .remove = dvb_bt8xx_remove, | |
| 924 | - /* FIXME: | |
| 925 | - * .shutdown = dvb_bt8xx_shutdown, | |
| 926 | - * .suspend = dvb_bt8xx_suspend, | |
| 927 | - * .resume = dvb_bt8xx_resume, | |
| 928 | - */ | |
| 929 | 921 | }, |
| 922 | + .probe = dvb_bt8xx_probe, | |
| 923 | + .remove = dvb_bt8xx_remove, | |
| 924 | + /* FIXME: | |
| 925 | + * .shutdown = dvb_bt8xx_shutdown, | |
| 926 | + * .suspend = dvb_bt8xx_suspend, | |
| 927 | + * .resume = dvb_bt8xx_resume, | |
| 928 | + */ | |
| 930 | 929 | }; |
| 931 | 930 | |
| 932 | 931 | static int __init dvb_bt8xx_init(void) |
drivers/media/video/bttv-gpio.c
| ... | ... | @@ -47,9 +47,29 @@ |
| 47 | 47 | return 0; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | +static int bttv_sub_probe(struct device *dev) | |
| 51 | +{ | |
| 52 | + struct bttv_sub_device *sdev = to_bttv_sub_dev(dev); | |
| 53 | + struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); | |
| 54 | + | |
| 55 | + return sub->probe ? sub->probe(sdev) : -ENODEV; | |
| 56 | +} | |
| 57 | + | |
| 58 | +static int bttv_sub_remove(struct device *dev) | |
| 59 | +{ | |
| 60 | + struct bttv_sub_device *sdev = to_bttv_sub_dev(dev); | |
| 61 | + struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); | |
| 62 | + | |
| 63 | + if (sub->remove) | |
| 64 | + sub->remove(sdev); | |
| 65 | + return 0; | |
| 66 | +} | |
| 67 | + | |
| 50 | 68 | struct bus_type bttv_sub_bus_type = { |
| 51 | - .name = "bttv-sub", | |
| 52 | - .match = &bttv_sub_bus_match, | |
| 69 | + .name = "bttv-sub", | |
| 70 | + .match = &bttv_sub_bus_match, | |
| 71 | + .probe = bttv_sub_probe, | |
| 72 | + .remove = bttv_sub_remove, | |
| 53 | 73 | }; |
| 54 | 74 | EXPORT_SYMBOL(bttv_sub_bus_type); |
| 55 | 75 |
drivers/media/video/bttv.h
| ... | ... | @@ -365,6 +365,8 @@ |
| 365 | 365 | struct bttv_sub_driver { |
| 366 | 366 | struct device_driver drv; |
| 367 | 367 | char wanted[BUS_ID_SIZE]; |
| 368 | + int (*probe)(struct bttv_sub_device *sub); | |
| 369 | + void (*remove)(struct bttv_sub_device *sub); | |
| 368 | 370 | void (*gpio_irq)(struct bttv_sub_device *sub); |
| 369 | 371 | }; |
| 370 | 372 | #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv) |
drivers/mfd/mcp-core.c
| ... | ... | @@ -77,6 +77,8 @@ |
| 77 | 77 | static struct bus_type mcp_bus_type = { |
| 78 | 78 | .name = "mcp", |
| 79 | 79 | .match = mcp_bus_match, |
| 80 | + .probe = mcp_bus_probe, | |
| 81 | + .remove = mcp_bus_remove, | |
| 80 | 82 | .suspend = mcp_bus_suspend, |
| 81 | 83 | .resume = mcp_bus_resume, |
| 82 | 84 | }; |
| ... | ... | @@ -227,8 +229,6 @@ |
| 227 | 229 | int mcp_driver_register(struct mcp_driver *mcpdrv) |
| 228 | 230 | { |
| 229 | 231 | mcpdrv->drv.bus = &mcp_bus_type; |
| 230 | - mcpdrv->drv.probe = mcp_bus_probe; | |
| 231 | - mcpdrv->drv.remove = mcp_bus_remove; | |
| 232 | 232 | return driver_register(&mcpdrv->drv); |
| 233 | 233 | } |
| 234 | 234 | EXPORT_SYMBOL(mcp_driver_register); |
drivers/mmc/mmc_sysfs.c
| ... | ... | @@ -136,17 +136,7 @@ |
| 136 | 136 | return ret; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | -static struct bus_type mmc_bus_type = { | |
| 140 | - .name = "mmc", | |
| 141 | - .dev_attrs = mmc_dev_attrs, | |
| 142 | - .match = mmc_bus_match, | |
| 143 | - .uevent = mmc_bus_uevent, | |
| 144 | - .suspend = mmc_bus_suspend, | |
| 145 | - .resume = mmc_bus_resume, | |
| 146 | -}; | |
| 147 | - | |
| 148 | - | |
| 149 | -static int mmc_drv_probe(struct device *dev) | |
| 139 | +static int mmc_bus_probe(struct device *dev) | |
| 150 | 140 | { |
| 151 | 141 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
| 152 | 142 | struct mmc_card *card = dev_to_mmc_card(dev); |
| ... | ... | @@ -154,7 +144,7 @@ |
| 154 | 144 | return drv->probe(card); |
| 155 | 145 | } |
| 156 | 146 | |
| 157 | -static int mmc_drv_remove(struct device *dev) | |
| 147 | +static int mmc_bus_remove(struct device *dev) | |
| 158 | 148 | { |
| 159 | 149 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
| 160 | 150 | struct mmc_card *card = dev_to_mmc_card(dev); |
| ... | ... | @@ -164,6 +154,16 @@ |
| 164 | 154 | return 0; |
| 165 | 155 | } |
| 166 | 156 | |
| 157 | +static struct bus_type mmc_bus_type = { | |
| 158 | + .name = "mmc", | |
| 159 | + .dev_attrs = mmc_dev_attrs, | |
| 160 | + .match = mmc_bus_match, | |
| 161 | + .uevent = mmc_bus_uevent, | |
| 162 | + .probe = mmc_bus_probe, | |
| 163 | + .remove = mmc_bus_remove, | |
| 164 | + .suspend = mmc_bus_suspend, | |
| 165 | + .resume = mmc_bus_resume, | |
| 166 | +}; | |
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * mmc_register_driver - register a media driver |
| ... | ... | @@ -172,8 +172,6 @@ |
| 172 | 172 | int mmc_register_driver(struct mmc_driver *drv) |
| 173 | 173 | { |
| 174 | 174 | drv->drv.bus = &mmc_bus_type; |
| 175 | - drv->drv.probe = mmc_drv_probe; | |
| 176 | - drv->drv.remove = mmc_drv_remove; | |
| 177 | 175 | return driver_register(&drv->drv); |
| 178 | 176 | } |
| 179 | 177 |
drivers/pci/pci-driver.c
| ... | ... | @@ -380,8 +380,6 @@ |
| 380 | 380 | /* initialize common driver fields */ |
| 381 | 381 | drv->driver.name = drv->name; |
| 382 | 382 | drv->driver.bus = &pci_bus_type; |
| 383 | - drv->driver.probe = pci_device_probe; | |
| 384 | - drv->driver.remove = pci_device_remove; | |
| 385 | 383 | /* FIXME, once all of the existing PCI drivers have been fixed to set |
| 386 | 384 | * the pci shutdown function, this test can go away. */ |
| 387 | 385 | if (!drv->driver.shutdown) |
| ... | ... | @@ -513,6 +511,8 @@ |
| 513 | 511 | .name = "pci", |
| 514 | 512 | .match = pci_bus_match, |
| 515 | 513 | .uevent = pci_uevent, |
| 514 | + .probe = pci_device_probe, | |
| 515 | + .remove = pci_device_remove, | |
| 516 | 516 | .suspend = pci_device_suspend, |
| 517 | 517 | .resume = pci_device_resume, |
| 518 | 518 | .dev_attrs = pci_dev_attrs, |
drivers/pcmcia/ds.c
| ... | ... | @@ -311,8 +311,6 @@ |
| 311 | 311 | /* initialize common fields */ |
| 312 | 312 | driver->drv.bus = &pcmcia_bus_type; |
| 313 | 313 | driver->drv.owner = driver->owner; |
| 314 | - driver->drv.probe = pcmcia_device_probe; | |
| 315 | - driver->drv.remove = pcmcia_device_remove; | |
| 316 | 314 | |
| 317 | 315 | return driver_register(&driver->drv); |
| 318 | 316 | } |
| ... | ... | @@ -1200,6 +1198,8 @@ |
| 1200 | 1198 | .uevent = pcmcia_bus_uevent, |
| 1201 | 1199 | .match = pcmcia_bus_match, |
| 1202 | 1200 | .dev_attrs = pcmcia_dev_attrs, |
| 1201 | + .probe = pcmcia_device_probe, | |
| 1202 | + .remove = pcmcia_device_remove, | |
| 1203 | 1203 | .suspend = pcmcia_dev_suspend, |
| 1204 | 1204 | .resume = pcmcia_dev_resume, |
| 1205 | 1205 | }; |
drivers/pnp/driver.c
| ... | ... | @@ -195,6 +195,8 @@ |
| 195 | 195 | struct bus_type pnp_bus_type = { |
| 196 | 196 | .name = "pnp", |
| 197 | 197 | .match = pnp_bus_match, |
| 198 | + .probe = pnp_device_probe, | |
| 199 | + .remove = pnp_device_remove, | |
| 198 | 200 | .suspend = pnp_bus_suspend, |
| 199 | 201 | .resume = pnp_bus_resume, |
| 200 | 202 | }; |
| ... | ... | @@ -215,8 +217,6 @@ |
| 215 | 217 | |
| 216 | 218 | drv->driver.name = drv->name; |
| 217 | 219 | drv->driver.bus = &pnp_bus_type; |
| 218 | - drv->driver.probe = pnp_device_probe; | |
| 219 | - drv->driver.remove = pnp_device_remove; | |
| 220 | 220 | |
| 221 | 221 | count = driver_register(&drv->driver); |
| 222 | 222 |
drivers/rapidio/rio-driver.c
| ... | ... | @@ -147,8 +147,6 @@ |
| 147 | 147 | /* initialize common driver fields */ |
| 148 | 148 | rdrv->driver.name = rdrv->name; |
| 149 | 149 | rdrv->driver.bus = &rio_bus_type; |
| 150 | - rdrv->driver.probe = rio_device_probe; | |
| 151 | - rdrv->driver.remove = rio_device_remove; | |
| 152 | 150 | |
| 153 | 151 | /* register with core */ |
| 154 | 152 | return driver_register(&rdrv->driver); |
| ... | ... | @@ -204,7 +202,9 @@ |
| 204 | 202 | struct bus_type rio_bus_type = { |
| 205 | 203 | .name = "rapidio", |
| 206 | 204 | .match = rio_match_bus, |
| 207 | - .dev_attrs = rio_dev_attrs | |
| 205 | + .dev_attrs = rio_dev_attrs, | |
| 206 | + .probe = rio_device_probe, | |
| 207 | + .remove = rio_device_remove, | |
| 208 | 208 | }; |
| 209 | 209 | |
| 210 | 210 | /** |
drivers/s390/cio/ccwgroup.c
| ... | ... | @@ -52,11 +52,7 @@ |
| 52 | 52 | return 0; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | -static struct bus_type ccwgroup_bus_type = { | |
| 56 | - .name = "ccwgroup", | |
| 57 | - .match = ccwgroup_bus_match, | |
| 58 | - .uevent = ccwgroup_uevent, | |
| 59 | -}; | |
| 55 | +static struct bus_type ccwgroup_bus_type; | |
| 60 | 56 | |
| 61 | 57 | static inline void |
| 62 | 58 | __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) |
| ... | ... | @@ -389,6 +385,14 @@ |
| 389 | 385 | return 0; |
| 390 | 386 | } |
| 391 | 387 | |
| 388 | +static struct bus_type ccwgroup_bus_type = { | |
| 389 | + .name = "ccwgroup", | |
| 390 | + .match = ccwgroup_bus_match, | |
| 391 | + .uevent = ccwgroup_uevent, | |
| 392 | + .probe = ccwgroup_probe, | |
| 393 | + .remove = ccwgroup_remove, | |
| 394 | +}; | |
| 395 | + | |
| 392 | 396 | int |
| 393 | 397 | ccwgroup_driver_register (struct ccwgroup_driver *cdriver) |
| 394 | 398 | { |
| ... | ... | @@ -396,8 +400,6 @@ |
| 396 | 400 | cdriver->driver = (struct device_driver) { |
| 397 | 401 | .bus = &ccwgroup_bus_type, |
| 398 | 402 | .name = cdriver->name, |
| 399 | - .probe = ccwgroup_probe, | |
| 400 | - .remove = ccwgroup_remove, | |
| 401 | 403 | }; |
| 402 | 404 | |
| 403 | 405 | return driver_register(&cdriver->driver); |
drivers/s390/cio/css.c
| ... | ... | @@ -542,9 +542,41 @@ |
| 542 | 542 | return 0; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | +static int | |
| 546 | +css_probe (struct device *dev) | |
| 547 | +{ | |
| 548 | + struct subchannel *sch; | |
| 549 | + | |
| 550 | + sch = to_subchannel(dev); | |
| 551 | + sch->driver = container_of (dev->driver, struct css_driver, drv); | |
| 552 | + return (sch->driver->probe ? sch->driver->probe(sch) : 0); | |
| 553 | +} | |
| 554 | + | |
| 555 | +static int | |
| 556 | +css_remove (struct device *dev) | |
| 557 | +{ | |
| 558 | + struct subchannel *sch; | |
| 559 | + | |
| 560 | + sch = to_subchannel(dev); | |
| 561 | + return (sch->driver->remove ? sch->driver->remove(sch) : 0); | |
| 562 | +} | |
| 563 | + | |
| 564 | +static void | |
| 565 | +css_shutdown (struct device *dev) | |
| 566 | +{ | |
| 567 | + struct subchannel *sch; | |
| 568 | + | |
| 569 | + sch = to_subchannel(dev); | |
| 570 | + if (sch->driver->shutdown) | |
| 571 | + sch->driver->shutdown(sch); | |
| 572 | +} | |
| 573 | + | |
| 545 | 574 | struct bus_type css_bus_type = { |
| 546 | - .name = "css", | |
| 547 | - .match = &css_bus_match, | |
| 575 | + .name = "css", | |
| 576 | + .match = css_bus_match, | |
| 577 | + .probe = css_probe, | |
| 578 | + .remove = css_remove, | |
| 579 | + .shutdown = css_shutdown, | |
| 548 | 580 | }; |
| 549 | 581 | |
| 550 | 582 | subsys_initcall(init_channel_subsystem); |
drivers/s390/cio/css.h
| ... | ... | @@ -115,6 +115,7 @@ |
| 115 | 115 | * Currently, we only care about I/O subchannels (type 0), these |
| 116 | 116 | * have a ccw_device connected to them. |
| 117 | 117 | */ |
| 118 | +struct subchannel; | |
| 118 | 119 | struct css_driver { |
| 119 | 120 | unsigned int subchannel_type; |
| 120 | 121 | struct device_driver drv; |
| ... | ... | @@ -122,6 +123,9 @@ |
| 122 | 123 | int (*notify)(struct device *, int); |
| 123 | 124 | void (*verify)(struct device *); |
| 124 | 125 | void (*termination)(struct device *); |
| 126 | + int (*probe)(struct subchannel *); | |
| 127 | + int (*remove)(struct subchannel *); | |
| 128 | + void (*shutdown)(struct subchannel *); | |
| 125 | 129 | }; |
| 126 | 130 | |
| 127 | 131 | /* |
drivers/s390/cio/device.c
| ... | ... | @@ -107,33 +107,29 @@ |
| 107 | 107 | return 0; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -struct bus_type ccw_bus_type = { | |
| 111 | - .name = "ccw", | |
| 112 | - .match = &ccw_bus_match, | |
| 113 | - .uevent = &ccw_uevent, | |
| 114 | -}; | |
| 110 | +struct bus_type ccw_bus_type; | |
| 115 | 111 | |
| 116 | -static int io_subchannel_probe (struct device *); | |
| 117 | -static int io_subchannel_remove (struct device *); | |
| 112 | +static int io_subchannel_probe (struct subchannel *); | |
| 113 | +static int io_subchannel_remove (struct subchannel *); | |
| 118 | 114 | void io_subchannel_irq (struct device *); |
| 119 | 115 | static int io_subchannel_notify(struct device *, int); |
| 120 | 116 | static void io_subchannel_verify(struct device *); |
| 121 | 117 | static void io_subchannel_ioterm(struct device *); |
| 122 | -static void io_subchannel_shutdown(struct device *); | |
| 118 | +static void io_subchannel_shutdown(struct subchannel *); | |
| 123 | 119 | |
| 124 | 120 | struct css_driver io_subchannel_driver = { |
| 125 | 121 | .subchannel_type = SUBCHANNEL_TYPE_IO, |
| 126 | 122 | .drv = { |
| 127 | 123 | .name = "io_subchannel", |
| 128 | 124 | .bus = &css_bus_type, |
| 129 | - .probe = &io_subchannel_probe, | |
| 130 | - .remove = &io_subchannel_remove, | |
| 131 | - .shutdown = &io_subchannel_shutdown, | |
| 132 | 125 | }, |
| 133 | 126 | .irq = io_subchannel_irq, |
| 134 | 127 | .notify = io_subchannel_notify, |
| 135 | 128 | .verify = io_subchannel_verify, |
| 136 | 129 | .termination = io_subchannel_ioterm, |
| 130 | + .probe = io_subchannel_probe, | |
| 131 | + .remove = io_subchannel_remove, | |
| 132 | + .shutdown = io_subchannel_shutdown, | |
| 137 | 133 | }; |
| 138 | 134 | |
| 139 | 135 | struct workqueue_struct *ccw_device_work; |
| 140 | 136 | |
| 141 | 137 | |
| ... | ... | @@ -803,14 +799,12 @@ |
| 803 | 799 | } |
| 804 | 800 | |
| 805 | 801 | static int |
| 806 | -io_subchannel_probe (struct device *pdev) | |
| 802 | +io_subchannel_probe (struct subchannel *sch) | |
| 807 | 803 | { |
| 808 | - struct subchannel *sch; | |
| 809 | 804 | struct ccw_device *cdev; |
| 810 | 805 | int rc; |
| 811 | 806 | unsigned long flags; |
| 812 | 807 | |
| 813 | - sch = to_subchannel(pdev); | |
| 814 | 808 | if (sch->dev.driver_data) { |
| 815 | 809 | /* |
| 816 | 810 | * This subchannel already has an associated ccw_device. |
| ... | ... | @@ -846,7 +840,7 @@ |
| 846 | 840 | memset(cdev->private, 0, sizeof(struct ccw_device_private)); |
| 847 | 841 | atomic_set(&cdev->private->onoff, 0); |
| 848 | 842 | cdev->dev = (struct device) { |
| 849 | - .parent = pdev, | |
| 843 | + .parent = &sch->dev, | |
| 850 | 844 | .release = ccw_device_release, |
| 851 | 845 | }; |
| 852 | 846 | INIT_LIST_HEAD(&cdev->private->kick_work.entry); |
| ... | ... | @@ -859,7 +853,7 @@ |
| 859 | 853 | return -ENODEV; |
| 860 | 854 | } |
| 861 | 855 | |
| 862 | - rc = io_subchannel_recog(cdev, to_subchannel(pdev)); | |
| 856 | + rc = io_subchannel_recog(cdev, sch); | |
| 863 | 857 | if (rc) { |
| 864 | 858 | spin_lock_irqsave(&sch->lock, flags); |
| 865 | 859 | sch->dev.driver_data = NULL; |
| 866 | 860 | |
| 867 | 861 | |
| 868 | 862 | |
| ... | ... | @@ -883,17 +877,17 @@ |
| 883 | 877 | } |
| 884 | 878 | |
| 885 | 879 | static int |
| 886 | -io_subchannel_remove (struct device *dev) | |
| 880 | +io_subchannel_remove (struct subchannel *sch) | |
| 887 | 881 | { |
| 888 | 882 | struct ccw_device *cdev; |
| 889 | 883 | unsigned long flags; |
| 890 | 884 | |
| 891 | - if (!dev->driver_data) | |
| 885 | + if (!sch->dev.driver_data) | |
| 892 | 886 | return 0; |
| 893 | - cdev = dev->driver_data; | |
| 887 | + cdev = sch->dev.driver_data; | |
| 894 | 888 | /* Set ccw device to not operational and drop reference. */ |
| 895 | 889 | spin_lock_irqsave(cdev->ccwlock, flags); |
| 896 | - dev->driver_data = NULL; | |
| 890 | + sch->dev.driver_data = NULL; | |
| 897 | 891 | cdev->private->state = DEV_STATE_NOT_OPER; |
| 898 | 892 | spin_unlock_irqrestore(cdev->ccwlock, flags); |
| 899 | 893 | /* |
| 900 | 894 | |
| 901 | 895 | |
| ... | ... | @@ -948,14 +942,12 @@ |
| 948 | 942 | } |
| 949 | 943 | |
| 950 | 944 | static void |
| 951 | -io_subchannel_shutdown(struct device *dev) | |
| 945 | +io_subchannel_shutdown(struct subchannel *sch) | |
| 952 | 946 | { |
| 953 | - struct subchannel *sch; | |
| 954 | 947 | struct ccw_device *cdev; |
| 955 | 948 | int ret; |
| 956 | 949 | |
| 957 | - sch = to_subchannel(dev); | |
| 958 | - cdev = dev->driver_data; | |
| 950 | + cdev = sch->dev.driver_data; | |
| 959 | 951 | |
| 960 | 952 | if (cio_is_console(sch->schid)) |
| 961 | 953 | return; |
| ... | ... | @@ -1129,6 +1121,14 @@ |
| 1129 | 1121 | return 0; |
| 1130 | 1122 | } |
| 1131 | 1123 | |
| 1124 | +struct bus_type ccw_bus_type = { | |
| 1125 | + .name = "ccw", | |
| 1126 | + .match = ccw_bus_match, | |
| 1127 | + .uevent = ccw_uevent, | |
| 1128 | + .probe = ccw_device_probe, | |
| 1129 | + .remove = ccw_device_remove, | |
| 1130 | +}; | |
| 1131 | + | |
| 1132 | 1132 | int |
| 1133 | 1133 | ccw_driver_register (struct ccw_driver *cdriver) |
| 1134 | 1134 | { |
| ... | ... | @@ -1136,8 +1136,6 @@ |
| 1136 | 1136 | |
| 1137 | 1137 | drv->bus = &ccw_bus_type; |
| 1138 | 1138 | drv->name = cdriver->name; |
| 1139 | - drv->probe = ccw_device_probe; | |
| 1140 | - drv->remove = ccw_device_remove; | |
| 1141 | 1139 | |
| 1142 | 1140 | return driver_register(drv); |
| 1143 | 1141 | } |
drivers/scsi/scsi_debug.c
| ... | ... | @@ -221,8 +221,6 @@ |
| 221 | 221 | static struct device_driver sdebug_driverfs_driver = { |
| 222 | 222 | .name = sdebug_proc_name, |
| 223 | 223 | .bus = &pseudo_lld_bus, |
| 224 | - .probe = sdebug_driver_probe, | |
| 225 | - .remove = sdebug_driver_remove, | |
| 226 | 224 | }; |
| 227 | 225 | |
| 228 | 226 | static const int check_condition_result = |
| ... | ... | @@ -1796,6 +1794,8 @@ |
| 1796 | 1794 | static struct bus_type pseudo_lld_bus = { |
| 1797 | 1795 | .name = "pseudo", |
| 1798 | 1796 | .match = pseudo_lld_bus_match, |
| 1797 | + .probe = sdebug_driver_probe, | |
| 1798 | + .remove = sdebug_driver_remove, | |
| 1799 | 1799 | }; |
| 1800 | 1800 | |
| 1801 | 1801 | static void sdebug_release_adapter(struct device * dev) |
drivers/sh/superhyway/superhyway.c
| ... | ... | @@ -175,8 +175,6 @@ |
| 175 | 175 | { |
| 176 | 176 | drv->drv.name = drv->name; |
| 177 | 177 | drv->drv.bus = &superhyway_bus_type; |
| 178 | - drv->drv.probe = superhyway_device_probe; | |
| 179 | - drv->drv.remove = superhyway_device_remove; | |
| 180 | 178 | |
| 181 | 179 | return driver_register(&drv->drv); |
| 182 | 180 | } |
| ... | ... | @@ -213,6 +211,8 @@ |
| 213 | 211 | #ifdef CONFIG_SYSFS |
| 214 | 212 | .dev_attrs = superhyway_dev_attrs, |
| 215 | 213 | #endif |
| 214 | + .probe = superhyway_device_probe, | |
| 215 | + .remove = superhyway_device_remove, | |
| 216 | 216 | }; |
| 217 | 217 | |
| 218 | 218 | static int __init superhyway_bus_init(void) |
drivers/usb/gadget/ether.c
drivers/usb/gadget/inode.c
drivers/usb/gadget/serial.c
drivers/usb/gadget/zero.c
drivers/usb/serial/bus.c
| ... | ... | @@ -37,11 +37,6 @@ |
| 37 | 37 | return 0; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | -struct bus_type usb_serial_bus_type = { | |
| 41 | - .name = "usb-serial", | |
| 42 | - .match = usb_serial_device_match, | |
| 43 | -}; | |
| 44 | - | |
| 45 | 40 | static int usb_serial_device_probe (struct device *dev) |
| 46 | 41 | { |
| 47 | 42 | struct usb_serial_driver *driver; |
| 48 | 43 | |
| ... | ... | @@ -109,14 +104,18 @@ |
| 109 | 104 | return retval; |
| 110 | 105 | } |
| 111 | 106 | |
| 107 | +struct bus_type usb_serial_bus_type = { | |
| 108 | + .name = "usb-serial", | |
| 109 | + .match = usb_serial_device_match, | |
| 110 | + .probe = usb_serial_device_probe, | |
| 111 | + .remove = usb_serial_device_remove, | |
| 112 | +}; | |
| 113 | + | |
| 112 | 114 | int usb_serial_bus_register(struct usb_serial_driver *driver) |
| 113 | 115 | { |
| 114 | 116 | int retval; |
| 115 | 117 | |
| 116 | 118 | driver->driver.bus = &usb_serial_bus_type; |
| 117 | - driver->driver.probe = usb_serial_device_probe; | |
| 118 | - driver->driver.remove = usb_serial_device_remove; | |
| 119 | - | |
| 120 | 119 | retval = driver_register(&driver->driver); |
| 121 | 120 | |
| 122 | 121 | return retval; |
drivers/zorro/zorro-driver.c
| ... | ... | @@ -77,7 +77,6 @@ |
| 77 | 77 | /* initialize common driver fields */ |
| 78 | 78 | drv->driver.name = drv->name; |
| 79 | 79 | drv->driver.bus = &zorro_bus_type; |
| 80 | - drv->driver.probe = zorro_device_probe; | |
| 81 | 80 | |
| 82 | 81 | /* register with core */ |
| 83 | 82 | count = driver_register(&drv->driver); |
| ... | ... | @@ -132,7 +131,8 @@ |
| 132 | 131 | |
| 133 | 132 | struct bus_type zorro_bus_type = { |
| 134 | 133 | .name = "zorro", |
| 135 | - .match = zorro_bus_match | |
| 134 | + .match = zorro_bus_match, | |
| 135 | + .probe = zorro_device_probe, | |
| 136 | 136 | }; |
| 137 | 137 | |
| 138 | 138 |
include/linux/device.h
| ... | ... | @@ -49,6 +49,9 @@ |
| 49 | 49 | int (*match)(struct device * dev, struct device_driver * drv); |
| 50 | 50 | int (*uevent)(struct device *dev, char **envp, |
| 51 | 51 | int num_envp, char *buffer, int buffer_size); |
| 52 | + int (*probe)(struct device * dev); | |
| 53 | + int (*remove)(struct device * dev); | |
| 54 | + void (*shutdown)(struct device * dev); | |
| 52 | 55 | int (*suspend)(struct device * dev, pm_message_t state); |
| 53 | 56 | int (*resume)(struct device * dev); |
| 54 | 57 | }; |
include/linux/ide.h
| ... | ... | @@ -983,7 +983,12 @@ |
| 983 | 983 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); |
| 984 | 984 | ide_proc_entry_t *proc; |
| 985 | 985 | struct device_driver gen_driver; |
| 986 | + int (*probe)(ide_drive_t *); | |
| 987 | + void (*remove)(ide_drive_t *); | |
| 988 | + void (*shutdown)(ide_drive_t *); | |
| 986 | 989 | } ide_driver_t; |
| 990 | + | |
| 991 | +#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) | |
| 987 | 992 | |
| 988 | 993 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); |
| 989 | 994 |