diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 13:42:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 13:42:40 -0500 |
commit | 3e2b32b69308e974cd1167beaf266d3c716e4734 (patch) | |
tree | 0f1b24dcb7b066a6322d33235b95655d885695ac | |
parent | 3824ba7df91745da6ebac703c87c3b801c34fdd0 (diff) | |
parent | 9c08a938ce5a3e1c9d5f764dc6ae844cb1af76ff (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
48 files changed, 358 insertions, 256 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index 1b7eaab02b9e..159ad7ed7a40 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c | |||
@@ -1103,14 +1103,14 @@ static int locomo_bus_remove(struct device *dev) | |||
1103 | struct bus_type locomo_bus_type = { | 1103 | struct bus_type locomo_bus_type = { |
1104 | .name = "locomo-bus", | 1104 | .name = "locomo-bus", |
1105 | .match = locomo_match, | 1105 | .match = locomo_match, |
1106 | .probe = locomo_bus_probe, | ||
1107 | .remove = locomo_bus_remove, | ||
1106 | .suspend = locomo_bus_suspend, | 1108 | .suspend = locomo_bus_suspend, |
1107 | .resume = locomo_bus_resume, | 1109 | .resume = locomo_bus_resume, |
1108 | }; | 1110 | }; |
1109 | 1111 | ||
1110 | int locomo_driver_register(struct locomo_driver *driver) | 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 | driver->drv.bus = &locomo_bus_type; | 1114 | driver->drv.bus = &locomo_bus_type; |
1115 | return driver_register(&driver->drv); | 1115 | return driver_register(&driver->drv); |
1116 | } | 1116 | } |
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index d0d6e6d2d649..1475089f9b42 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
@@ -1247,14 +1247,14 @@ static int sa1111_bus_remove(struct device *dev) | |||
1247 | struct bus_type sa1111_bus_type = { | 1247 | struct bus_type sa1111_bus_type = { |
1248 | .name = "sa1111-rab", | 1248 | .name = "sa1111-rab", |
1249 | .match = sa1111_match, | 1249 | .match = sa1111_match, |
1250 | .probe = sa1111_bus_probe, | ||
1251 | .remove = sa1111_bus_remove, | ||
1250 | .suspend = sa1111_bus_suspend, | 1252 | .suspend = sa1111_bus_suspend, |
1251 | .resume = sa1111_bus_resume, | 1253 | .resume = sa1111_bus_resume, |
1252 | }; | 1254 | }; |
1253 | 1255 | ||
1254 | int sa1111_driver_register(struct sa1111_driver *driver) | 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 | driver->drv.bus = &sa1111_bus_type; | 1258 | driver->drv.bus = &sa1111_bus_type; |
1259 | return driver_register(&driver->drv); | 1259 | return driver_register(&driver->drv); |
1260 | } | 1260 | } |
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index 96fd91926c9b..74ea29c3205e 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c | |||
@@ -1147,9 +1147,11 @@ static void ecard_drv_shutdown(struct device *dev) | |||
1147 | struct ecard_driver *drv = ECARD_DRV(dev->driver); | 1147 | struct ecard_driver *drv = ECARD_DRV(dev->driver); |
1148 | struct ecard_request req; | 1148 | struct ecard_request req; |
1149 | 1149 | ||
1150 | if (drv->shutdown) | 1150 | if (dev->driver) { |
1151 | drv->shutdown(ec); | 1151 | if (drv->shutdown) |
1152 | ecard_release(ec); | 1152 | drv->shutdown(ec); |
1153 | ecard_release(ec); | ||
1154 | } | ||
1153 | 1155 | ||
1154 | /* | 1156 | /* |
1155 | * If this card has a loader, call the reset handler. | 1157 | * If this card has a loader, call the reset handler. |
@@ -1164,9 +1166,6 @@ static void ecard_drv_shutdown(struct device *dev) | |||
1164 | int ecard_register_driver(struct ecard_driver *drv) | 1166 | int ecard_register_driver(struct ecard_driver *drv) |
1165 | { | 1167 | { |
1166 | drv->drv.bus = &ecard_bus_type; | 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 | return driver_register(&drv->drv); | 1170 | return driver_register(&drv->drv); |
1172 | } | 1171 | } |
@@ -1195,6 +1194,9 @@ struct bus_type ecard_bus_type = { | |||
1195 | .name = "ecard", | 1194 | .name = "ecard", |
1196 | .dev_attrs = ecard_dev_attrs, | 1195 | .dev_attrs = ecard_dev_attrs, |
1197 | .match = ecard_match, | 1196 | .match = ecard_match, |
1197 | .probe = ecard_drv_probe, | ||
1198 | .remove = ecard_drv_remove, | ||
1199 | .shutdown = ecard_drv_shutdown, | ||
1198 | }; | 1200 | }; |
1199 | 1201 | ||
1200 | static int ecard_bus_init(void) | 1202 | static int ecard_bus_init(void) |
diff --git a/arch/arm/mach-integrator/lm.c b/arch/arm/mach-integrator/lm.c index 5b41e3a724e1..622cdc4212dd 100644 --- a/arch/arm/mach-integrator/lm.c +++ b/arch/arm/mach-integrator/lm.c | |||
@@ -22,20 +22,6 @@ static int lm_match(struct device *dev, struct device_driver *drv) | |||
22 | return 1; | 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 | static int lm_bus_probe(struct device *dev) | 25 | static int lm_bus_probe(struct device *dev) |
40 | { | 26 | { |
41 | struct lm_device *lmdev = to_lm_device(dev); | 27 | struct lm_device *lmdev = to_lm_device(dev); |
@@ -49,16 +35,30 @@ static int lm_bus_remove(struct device *dev) | |||
49 | struct lm_device *lmdev = to_lm_device(dev); | 35 | struct lm_device *lmdev = to_lm_device(dev); |
50 | struct lm_driver *lmdrv = to_lm_driver(dev->driver); | 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 | return 0; | 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 | int lm_driver_register(struct lm_driver *drv) | 59 | int lm_driver_register(struct lm_driver *drv) |
57 | { | 60 | { |
58 | drv->drv.bus = &lm_bustype; | 61 | drv->drv.bus = &lm_bustype; |
59 | drv->drv.probe = lm_bus_probe; | ||
60 | drv->drv.remove = lm_bus_remove; | ||
61 | |||
62 | return driver_register(&drv->drv); | 62 | return driver_register(&drv->drv); |
63 | } | 63 | } |
64 | 64 | ||
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c index 493fb3f38dc3..6a7939b16a1c 100644 --- a/arch/ia64/sn/kernel/tiocx.c +++ b/arch/ia64/sn/kernel/tiocx.c | |||
@@ -77,12 +77,6 @@ static void tiocx_bus_release(struct device *dev) | |||
77 | kfree(to_cx_dev(dev)); | 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 | * cx_device_match - Find cx_device in the id table. | 81 | * cx_device_match - Find cx_device in the id table. |
88 | * @ids: id table from driver | 82 | * @ids: id table from driver |
@@ -149,6 +143,14 @@ static int cx_driver_remove(struct device *dev) | |||
149 | return 0; | 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 | * cx_driver_register - Register the driver. | 155 | * cx_driver_register - Register the driver. |
154 | * @cx_driver: driver table (cx_drv struct) from driver | 156 | * @cx_driver: driver table (cx_drv struct) from driver |
@@ -162,8 +164,6 @@ int cx_driver_register(struct cx_drv *cx_driver) | |||
162 | { | 164 | { |
163 | cx_driver->driver.name = cx_driver->name; | 165 | cx_driver->driver.name = cx_driver->name; |
164 | cx_driver->driver.bus = &tiocx_bus_type; | 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 | return driver_register(&cx_driver->driver); | 168 | return driver_register(&cx_driver->driver); |
169 | } | 169 | } |
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index 1eaa0d37f677..2d804e2d16d1 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c | |||
@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc_driver *driver) | |||
173 | WARN_ON(driver->drv.probe != NULL); | 173 | WARN_ON(driver->drv.probe != NULL); |
174 | WARN_ON(driver->drv.remove != NULL); | 174 | WARN_ON(driver->drv.remove != NULL); |
175 | 175 | ||
176 | driver->drv.probe = parisc_driver_probe; | ||
177 | driver->drv.remove = parisc_driver_remove; | ||
178 | driver->drv.name = driver->name; | 176 | driver->drv.name = driver->name; |
179 | 177 | ||
180 | return driver_register(&driver->drv); | 178 | return driver_register(&driver->drv); |
@@ -575,6 +573,8 @@ struct bus_type parisc_bus_type = { | |||
575 | .name = "parisc", | 573 | .name = "parisc", |
576 | .match = parisc_generic_match, | 574 | .match = parisc_generic_match, |
577 | .dev_attrs = parisc_device_attrs, | 575 | .dev_attrs = parisc_device_attrs, |
576 | .probe = parisc_driver_probe, | ||
577 | .remove = parisc_driver_remove, | ||
578 | }; | 578 | }; |
579 | 579 | ||
580 | /** | 580 | /** |
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c index 7065e40e2f42..22d83d4d1af5 100644 --- a/arch/powerpc/kernel/of_device.c +++ b/arch/powerpc/kernel/of_device.c | |||
@@ -132,6 +132,8 @@ static int of_device_resume(struct device * dev) | |||
132 | struct bus_type of_platform_bus_type = { | 132 | struct bus_type of_platform_bus_type = { |
133 | .name = "of_platform", | 133 | .name = "of_platform", |
134 | .match = of_platform_bus_match, | 134 | .match = of_platform_bus_match, |
135 | .probe = of_device_probe, | ||
136 | .remove = of_device_remove, | ||
135 | .suspend = of_device_suspend, | 137 | .suspend = of_device_suspend, |
136 | .resume = of_device_resume, | 138 | .resume = of_device_resume, |
137 | }; | 139 | }; |
@@ -150,8 +152,6 @@ int of_register_driver(struct of_platform_driver *drv) | |||
150 | /* initialize common driver fields */ | 152 | /* initialize common driver fields */ |
151 | drv->driver.name = drv->name; | 153 | drv->driver.name = drv->name; |
152 | drv->driver.bus = &of_platform_bus_type; | 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 | /* register with core */ | 156 | /* register with core */ |
157 | count = driver_register(&drv->driver); | 157 | count = driver_register(&drv->driver); |
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 13c41495fe06..13c655ba2841 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -76,7 +76,7 @@ static void vio_bus_shutdown(struct device *dev) | |||
76 | struct vio_dev *viodev = to_vio_dev(dev); | 76 | struct vio_dev *viodev = to_vio_dev(dev); |
77 | struct vio_driver *viodrv = to_vio_driver(dev->driver); | 77 | struct vio_driver *viodrv = to_vio_driver(dev->driver); |
78 | 78 | ||
79 | if (viodrv->shutdown) | 79 | if (dev->driver && viodrv->shutdown) |
80 | viodrv->shutdown(viodev); | 80 | viodrv->shutdown(viodev); |
81 | } | 81 | } |
82 | 82 | ||
@@ -91,9 +91,6 @@ int vio_register_driver(struct vio_driver *viodrv) | |||
91 | 91 | ||
92 | /* fill in 'struct driver' fields */ | 92 | /* fill in 'struct driver' fields */ |
93 | viodrv->driver.bus = &vio_bus_type; | 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 | return driver_register(&viodrv->driver); | 95 | return driver_register(&viodrv->driver); |
99 | } | 96 | } |
@@ -295,4 +292,7 @@ struct bus_type vio_bus_type = { | |||
295 | .name = "vio", | 292 | .name = "vio", |
296 | .uevent = vio_hotplug, | 293 | .uevent = vio_hotplug, |
297 | .match = vio_bus_match, | 294 | .match = vio_bus_match, |
295 | .probe = vio_bus_probe, | ||
296 | .remove = vio_bus_remove, | ||
297 | .shutdown = vio_bus_shutdown, | ||
298 | }; | 298 | }; |
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c index 9ccce438bd7a..ab34b1d6072f 100644 --- a/arch/ppc/syslib/ocp.c +++ b/arch/ppc/syslib/ocp.c | |||
@@ -189,6 +189,8 @@ ocp_device_resume(struct device *dev) | |||
189 | struct bus_type ocp_bus_type = { | 189 | struct bus_type ocp_bus_type = { |
190 | .name = "ocp", | 190 | .name = "ocp", |
191 | .match = ocp_device_match, | 191 | .match = ocp_device_match, |
192 | .probe = ocp_driver_probe, | ||
193 | .remove = ocp_driver_remove, | ||
192 | .suspend = ocp_device_suspend, | 194 | .suspend = ocp_device_suspend, |
193 | .resume = ocp_device_resume, | 195 | .resume = ocp_device_resume, |
194 | }; | 196 | }; |
@@ -210,8 +212,6 @@ ocp_register_driver(struct ocp_driver *drv) | |||
210 | /* initialize common driver fields */ | 212 | /* initialize common driver fields */ |
211 | drv->driver.name = drv->name; | 213 | drv->driver.name = drv->name; |
212 | drv->driver.bus = &ocp_bus_type; | 214 | drv->driver.bus = &ocp_bus_type; |
213 | drv->driver.probe = ocp_device_probe; | ||
214 | drv->driver.remove = ocp_device_remove; | ||
215 | 215 | ||
216 | /* register with core */ | 216 | /* register with core */ |
217 | return driver_register(&drv->driver); | 217 | return driver_register(&drv->driver); |
diff --git a/arch/sh/kernel/cpu/bus.c b/arch/sh/kernel/cpu/bus.c index d4fee2a79373..3278d234bb1b 100644 --- a/arch/sh/kernel/cpu/bus.c +++ b/arch/sh/kernel/cpu/bus.c | |||
@@ -53,21 +53,6 @@ static int sh_bus_resume(struct device *dev) | |||
53 | return 0; | 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 | static int sh_device_probe(struct device *dev) | 56 | static int sh_device_probe(struct device *dev) |
72 | { | 57 | { |
73 | struct sh_dev *shdev = to_sh_dev(dev); | 58 | struct sh_dev *shdev = to_sh_dev(dev); |
@@ -90,6 +75,23 @@ static int sh_device_remove(struct device *dev) | |||
90 | return 0; | 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 | int sh_device_register(struct sh_dev *dev) | 95 | int sh_device_register(struct sh_dev *dev) |
94 | { | 96 | { |
95 | if (!dev) | 97 | if (!dev) |
@@ -133,8 +135,6 @@ int sh_driver_register(struct sh_driver *drv) | |||
133 | return -EINVAL; | 135 | return -EINVAL; |
134 | } | 136 | } |
135 | 137 | ||
136 | drv->drv.probe = sh_device_probe; | ||
137 | drv->drv.remove = sh_device_remove; | ||
138 | drv->drv.bus = &sh_bus_types[drv->bus_id]; | 138 | drv->drv.bus = &sh_bus_types[drv->bus_id]; |
139 | 139 | ||
140 | return driver_register(&drv->drv); | 140 | return driver_register(&drv->drv); |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 2b905016664d..730a9ce0a14a 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -78,7 +78,13 @@ int driver_probe_device(struct device_driver * drv, struct device * dev) | |||
78 | pr_debug("%s: Matched Device %s with Driver %s\n", | 78 | pr_debug("%s: Matched Device %s with Driver %s\n", |
79 | drv->bus->name, dev->bus_id, drv->name); | 79 | drv->bus->name, dev->bus_id, drv->name); |
80 | dev->driver = drv; | 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 | ret = drv->probe(dev); | 88 | ret = drv->probe(dev); |
83 | if (ret) { | 89 | if (ret) { |
84 | dev->driver = NULL; | 90 | dev->driver = NULL; |
@@ -203,7 +209,9 @@ static void __device_release_driver(struct device * dev) | |||
203 | sysfs_remove_link(&dev->kobj, "driver"); | 209 | sysfs_remove_link(&dev->kobj, "driver"); |
204 | klist_remove(&dev->knode_driver); | 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 | drv->remove(dev); | 215 | drv->remove(dev); |
208 | dev->driver = NULL; | 216 | dev->driver = NULL; |
209 | put_driver(drv); | 217 | put_driver(drv); |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 161f3a390d90..b400314e1c62 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -171,6 +171,11 @@ static void klist_devices_put(struct klist_node *n) | |||
171 | */ | 171 | */ |
172 | int driver_register(struct device_driver * drv) | 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 | klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put); | 179 | klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put); |
175 | init_completion(&drv->unloaded); | 180 | init_completion(&drv->unloaded); |
176 | return bus_add_driver(drv); | 181 | return bus_add_driver(drv); |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 0f81731bdfa8..461554a02517 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -327,7 +327,7 @@ EXPORT_SYMBOL_GPL(platform_device_register); | |||
327 | * @pdev: platform device we're unregistering | 327 | * @pdev: platform device we're unregistering |
328 | * | 328 | * |
329 | * Unregistration is done in 2 steps. Fisrt we release all resources | 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 | * calling platform_device_put(). | 331 | * calling platform_device_put(). |
332 | */ | 332 | */ |
333 | void platform_device_unregister(struct platform_device * pdev) | 333 | void platform_device_unregister(struct platform_device * pdev) |
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c index f50a08be424b..c2475f3134ea 100644 --- a/drivers/base/power/shutdown.c +++ b/drivers/base/power/shutdown.c | |||
@@ -35,12 +35,15 @@ extern int sysdev_shutdown(void); | |||
35 | */ | 35 | */ |
36 | void device_shutdown(void) | 36 | void device_shutdown(void) |
37 | { | 37 | { |
38 | struct device * dev; | 38 | struct device * dev, *devn; |
39 | 39 | ||
40 | down_write(&devices_subsys.rwsem); | 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 | kobj.entry) { | 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 | dev_dbg(dev, "shutdown\n"); | 47 | dev_dbg(dev, "shutdown\n"); |
45 | dev->driver->shutdown(dev); | 48 | dev->driver->shutdown(dev); |
46 | } | 49 | } |
diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c index ffe6f44ac76f..ca8e69d2f64d 100644 --- a/drivers/dio/dio-driver.c +++ b/drivers/dio/dio-driver.c | |||
@@ -83,7 +83,6 @@ int dio_register_driver(struct dio_driver *drv) | |||
83 | /* initialize common driver fields */ | 83 | /* initialize common driver fields */ |
84 | drv->driver.name = drv->name; | 84 | drv->driver.name = drv->name; |
85 | drv->driver.bus = &dio_bus_type; | 85 | drv->driver.bus = &dio_bus_type; |
86 | drv->driver.probe = dio_device_probe; | ||
87 | 86 | ||
88 | /* register with core */ | 87 | /* register with core */ |
89 | count = driver_register(&drv->driver); | 88 | count = driver_register(&drv->driver); |
@@ -145,7 +144,8 @@ static int dio_bus_match(struct device *dev, struct device_driver *drv) | |||
145 | 144 | ||
146 | struct bus_type dio_bus_type = { | 145 | struct bus_type dio_bus_type = { |
147 | .name = "dio", | 146 | .name = "dio", |
148 | .match = dio_bus_match | 147 | .match = dio_bus_match, |
148 | .probe = dio_device_probe, | ||
149 | }; | 149 | }; |
150 | 150 | ||
151 | 151 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 52b77477df57..0ce58b506046 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -63,13 +63,6 @@ static int i2c_bus_resume(struct device * dev) | |||
63 | return rc; | 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 | static int i2c_device_probe(struct device *dev) | 66 | static int i2c_device_probe(struct device *dev) |
74 | { | 67 | { |
75 | return -ENODEV; | 68 | return -ENODEV; |
@@ -80,6 +73,15 @@ static int i2c_device_remove(struct device *dev) | |||
80 | return 0; | 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 | void i2c_adapter_dev_release(struct device *dev) | 85 | void i2c_adapter_dev_release(struct device *dev) |
84 | { | 86 | { |
85 | struct i2c_adapter *adap = dev_to_i2c_adapter(dev); | 87 | struct i2c_adapter *adap = dev_to_i2c_adapter(dev); |
@@ -90,8 +92,6 @@ struct device_driver i2c_adapter_driver = { | |||
90 | .owner = THIS_MODULE, | 92 | .owner = THIS_MODULE, |
91 | .name = "i2c_adapter", | 93 | .name = "i2c_adapter", |
92 | .bus = &i2c_bus_type, | 94 | .bus = &i2c_bus_type, |
93 | .probe = i2c_device_probe, | ||
94 | .remove = i2c_device_remove, | ||
95 | }; | 95 | }; |
96 | 96 | ||
97 | static void i2c_adapter_class_dev_release(struct class_device *dev) | 97 | static void i2c_adapter_class_dev_release(struct class_device *dev) |
@@ -294,8 +294,6 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) | |||
294 | /* add the driver to the list of i2c drivers in the driver core */ | 294 | /* add the driver to the list of i2c drivers in the driver core */ |
295 | driver->driver.owner = owner; | 295 | driver->driver.owner = owner; |
296 | driver->driver.bus = &i2c_bus_type; | 296 | driver->driver.bus = &i2c_bus_type; |
297 | driver->driver.probe = i2c_device_probe; | ||
298 | driver->driver.remove = i2c_device_remove; | ||
299 | 297 | ||
300 | res = driver_register(&driver->driver); | 298 | res = driver_register(&driver->driver); |
301 | if (res) | 299 | if (res) |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 9b2ebd219ad0..ef09a7ef2396 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -3256,9 +3256,8 @@ sector_t ide_cdrom_capacity (ide_drive_t *drive) | |||
3256 | } | 3256 | } |
3257 | #endif | 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 | struct cdrom_info *info = drive->driver_data; | 3261 | struct cdrom_info *info = drive->driver_data; |
3263 | 3262 | ||
3264 | ide_unregister_subdriver(drive, info->driver); | 3263 | ide_unregister_subdriver(drive, info->driver); |
@@ -3266,8 +3265,6 @@ static int ide_cd_remove(struct device *dev) | |||
3266 | del_gendisk(info->disk); | 3265 | del_gendisk(info->disk); |
3267 | 3266 | ||
3268 | ide_cd_put(info); | 3267 | ide_cd_put(info); |
3269 | |||
3270 | return 0; | ||
3271 | } | 3268 | } |
3272 | 3269 | ||
3273 | static void ide_cd_release(struct kref *kref) | 3270 | static void ide_cd_release(struct kref *kref) |
@@ -3291,7 +3288,7 @@ static void ide_cd_release(struct kref *kref) | |||
3291 | kfree(info); | 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 | #ifdef CONFIG_PROC_FS | 3293 | #ifdef CONFIG_PROC_FS |
3297 | static int proc_idecd_read_capacity | 3294 | static int proc_idecd_read_capacity |
@@ -3317,9 +3314,9 @@ static ide_driver_t ide_cdrom_driver = { | |||
3317 | .owner = THIS_MODULE, | 3314 | .owner = THIS_MODULE, |
3318 | .name = "ide-cdrom", | 3315 | .name = "ide-cdrom", |
3319 | .bus = &ide_bus_type, | 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 | .version = IDECD_VERSION, | 3320 | .version = IDECD_VERSION, |
3324 | .media = ide_cdrom, | 3321 | .media = ide_cdrom, |
3325 | .supports_dsc_overlap = 1, | 3322 | .supports_dsc_overlap = 1, |
@@ -3413,9 +3410,8 @@ static char *ignore = NULL; | |||
3413 | module_param(ignore, charp, 0400); | 3410 | module_param(ignore, charp, 0400); |
3414 | MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); | 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 | struct cdrom_info *info; | 3415 | struct cdrom_info *info; |
3420 | struct gendisk *g; | 3416 | struct gendisk *g; |
3421 | struct request_sense sense; | 3417 | struct request_sense sense; |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index cab362ea0336..245b508208df 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -997,9 +997,8 @@ static void ide_cacheflush_p(ide_drive_t *drive) | |||
997 | printk(KERN_INFO "%s: wcache flush failed!\n", drive->name); | 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 | struct ide_disk_obj *idkp = drive->driver_data; | 1002 | struct ide_disk_obj *idkp = drive->driver_data; |
1004 | struct gendisk *g = idkp->disk; | 1003 | struct gendisk *g = idkp->disk; |
1005 | 1004 | ||
@@ -1010,8 +1009,6 @@ static int ide_disk_remove(struct device *dev) | |||
1010 | ide_cacheflush_p(drive); | 1009 | ide_cacheflush_p(drive); |
1011 | 1010 | ||
1012 | ide_disk_put(idkp); | 1011 | ide_disk_put(idkp); |
1013 | |||
1014 | return 0; | ||
1015 | } | 1012 | } |
1016 | 1013 | ||
1017 | static void ide_disk_release(struct kref *kref) | 1014 | static void ide_disk_release(struct kref *kref) |
@@ -1027,12 +1024,10 @@ static void ide_disk_release(struct kref *kref) | |||
1027 | kfree(idkp); | 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 | #ifdef CONFIG_ALPHA | 1031 | #ifdef CONFIG_ALPHA |
1037 | /* On Alpha, halt(8) doesn't actually turn the machine off, | 1032 | /* On Alpha, halt(8) doesn't actually turn the machine off, |
1038 | it puts you into the sort of firmware monitor. Typically, | 1033 | it puts you into the sort of firmware monitor. Typically, |
@@ -1054,7 +1049,7 @@ static void ide_device_shutdown(struct device *dev) | |||
1054 | } | 1049 | } |
1055 | 1050 | ||
1056 | printk("Shutdown: %s\n", drive->name); | 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 | static ide_driver_t idedisk_driver = { | 1055 | static ide_driver_t idedisk_driver = { |
@@ -1062,10 +1057,10 @@ static ide_driver_t idedisk_driver = { | |||
1062 | .owner = THIS_MODULE, | 1057 | .owner = THIS_MODULE, |
1063 | .name = "ide-disk", | 1058 | .name = "ide-disk", |
1064 | .bus = &ide_bus_type, | 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 | .version = IDEDISK_VERSION, | 1064 | .version = IDEDISK_VERSION, |
1070 | .media = ide_disk, | 1065 | .media = ide_disk, |
1071 | .supports_dsc_overlap = 0, | 1066 | .supports_dsc_overlap = 0, |
@@ -1182,9 +1177,8 @@ static struct block_device_operations idedisk_ops = { | |||
1182 | 1177 | ||
1183 | MODULE_DESCRIPTION("ATA DISK Driver"); | 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 | struct ide_disk_obj *idkp; | 1182 | struct ide_disk_obj *idkp; |
1189 | struct gendisk *g; | 1183 | struct gendisk *g; |
1190 | 1184 | ||
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 5945f551aaaa..1f8db9ac05d1 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -1871,9 +1871,8 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy) | |||
1871 | idefloppy_add_settings(drive); | 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 | idefloppy_floppy_t *floppy = drive->driver_data; | 1876 | idefloppy_floppy_t *floppy = drive->driver_data; |
1878 | struct gendisk *g = floppy->disk; | 1877 | struct gendisk *g = floppy->disk; |
1879 | 1878 | ||
@@ -1882,8 +1881,6 @@ static int ide_floppy_remove(struct device *dev) | |||
1882 | del_gendisk(g); | 1881 | del_gendisk(g); |
1883 | 1882 | ||
1884 | ide_floppy_put(floppy); | 1883 | ide_floppy_put(floppy); |
1885 | |||
1886 | return 0; | ||
1887 | } | 1884 | } |
1888 | 1885 | ||
1889 | static void ide_floppy_release(struct kref *kref) | 1886 | static void ide_floppy_release(struct kref *kref) |
@@ -1922,16 +1919,16 @@ static ide_proc_entry_t idefloppy_proc[] = { | |||
1922 | 1919 | ||
1923 | #endif /* CONFIG_PROC_FS */ | 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 | static ide_driver_t idefloppy_driver = { | 1924 | static ide_driver_t idefloppy_driver = { |
1928 | .gen_driver = { | 1925 | .gen_driver = { |
1929 | .owner = THIS_MODULE, | 1926 | .owner = THIS_MODULE, |
1930 | .name = "ide-floppy", | 1927 | .name = "ide-floppy", |
1931 | .bus = &ide_bus_type, | 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 | .version = IDEFLOPPY_VERSION, | 1932 | .version = IDEFLOPPY_VERSION, |
1936 | .media = ide_floppy, | 1933 | .media = ide_floppy, |
1937 | .supports_dsc_overlap = 0, | 1934 | .supports_dsc_overlap = 0, |
@@ -2136,9 +2133,8 @@ static struct block_device_operations idefloppy_ops = { | |||
2136 | .revalidate_disk= idefloppy_revalidate_disk | 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 | idefloppy_floppy_t *floppy; | 2138 | idefloppy_floppy_t *floppy; |
2143 | struct gendisk *g; | 2139 | struct gendisk *g; |
2144 | 2140 | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index fab9b2b02504..0101d0def7c5 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -4682,9 +4682,8 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
4682 | idetape_add_settings(drive); | 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 | idetape_tape_t *tape = drive->driver_data; | 4687 | idetape_tape_t *tape = drive->driver_data; |
4689 | 4688 | ||
4690 | ide_unregister_subdriver(drive, tape->driver); | 4689 | ide_unregister_subdriver(drive, tape->driver); |
@@ -4692,8 +4691,6 @@ static int ide_tape_remove(struct device *dev) | |||
4692 | ide_unregister_region(tape->disk); | 4691 | ide_unregister_region(tape->disk); |
4693 | 4692 | ||
4694 | ide_tape_put(tape); | 4693 | ide_tape_put(tape); |
4695 | |||
4696 | return 0; | ||
4697 | } | 4694 | } |
4698 | 4695 | ||
4699 | static void ide_tape_release(struct kref *kref) | 4696 | static void ide_tape_release(struct kref *kref) |
@@ -4745,16 +4742,16 @@ static ide_proc_entry_t idetape_proc[] = { | |||
4745 | 4742 | ||
4746 | #endif | 4743 | #endif |
4747 | 4744 | ||
4748 | static int ide_tape_probe(struct device *); | 4745 | static int ide_tape_probe(ide_drive_t *); |
4749 | 4746 | ||
4750 | static ide_driver_t idetape_driver = { | 4747 | static ide_driver_t idetape_driver = { |
4751 | .gen_driver = { | 4748 | .gen_driver = { |
4752 | .owner = THIS_MODULE, | 4749 | .owner = THIS_MODULE, |
4753 | .name = "ide-tape", | 4750 | .name = "ide-tape", |
4754 | .bus = &ide_bus_type, | 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 | .version = IDETAPE_VERSION, | 4755 | .version = IDETAPE_VERSION, |
4759 | .media = ide_tape, | 4756 | .media = ide_tape, |
4760 | .supports_dsc_overlap = 1, | 4757 | .supports_dsc_overlap = 1, |
@@ -4825,9 +4822,8 @@ static struct block_device_operations idetape_block_ops = { | |||
4825 | .ioctl = idetape_ioctl, | 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 | idetape_tape_t *tape; | 4827 | idetape_tape_t *tape; |
4832 | struct gendisk *g; | 4828 | struct gendisk *g; |
4833 | int minor; | 4829 | int minor; |
@@ -4883,9 +4879,9 @@ static int ide_tape_probe(struct device *dev) | |||
4883 | idetape_setup(drive, tape, minor); | 4879 | idetape_setup(drive, tape, minor); |
4884 | 4880 | ||
4885 | class_device_create(idetape_sysfs_class, NULL, | 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 | class_device_create(idetape_sysfs_class, NULL, | 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 | devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor), | 4886 | devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor), |
4891 | S_IFCHR | S_IRUGO | S_IWUGO, | 4887 | S_IFCHR | S_IRUGO | S_IWUGO, |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index ec5a4cb173b0..afeb02bbb722 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -1949,10 +1949,41 @@ static int ide_uevent(struct device *dev, char **envp, int num_envp, | |||
1949 | return 0; | 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 | struct bus_type ide_bus_type = { | 1980 | struct bus_type ide_bus_type = { |
1953 | .name = "ide", | 1981 | .name = "ide", |
1954 | .match = ide_bus_match, | 1982 | .match = ide_bus_match, |
1955 | .uevent = ide_uevent, | 1983 | .uevent = ide_uevent, |
1984 | .probe = generic_ide_probe, | ||
1985 | .remove = generic_ide_remove, | ||
1986 | .shutdown = generic_ide_shutdown, | ||
1956 | .dev_attrs = ide_dev_attrs, | 1987 | .dev_attrs = ide_dev_attrs, |
1957 | .suspend = generic_ide_suspend, | 1988 | .suspend = generic_ide_suspend, |
1958 | .resume = generic_ide_resume, | 1989 | .resume = generic_ide_resume, |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index caac6d63d46f..b765a155c008 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -50,9 +50,7 @@ static DECLARE_MUTEX(gameport_sem); | |||
50 | 50 | ||
51 | static LIST_HEAD(gameport_list); | 51 | static LIST_HEAD(gameport_list); |
52 | 52 | ||
53 | static struct bus_type gameport_bus = { | 53 | static struct bus_type gameport_bus; |
54 | .name = "gameport", | ||
55 | }; | ||
56 | 54 | ||
57 | static void gameport_add_port(struct gameport *gameport); | 55 | static void gameport_add_port(struct gameport *gameport); |
58 | static void gameport_destroy_port(struct gameport *gameport); | 56 | static void gameport_destroy_port(struct gameport *gameport); |
@@ -703,11 +701,15 @@ static int gameport_driver_remove(struct device *dev) | |||
703 | return 0; | 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 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) | 710 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) |
707 | { | 711 | { |
708 | drv->driver.bus = &gameport_bus; | 712 | drv->driver.bus = &gameport_bus; |
709 | drv->driver.probe = gameport_driver_probe; | ||
710 | drv->driver.remove = gameport_driver_remove; | ||
711 | gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER); | 713 | gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER); |
712 | } | 714 | } |
713 | 715 | ||
diff --git a/drivers/input/input.c b/drivers/input/input.c index fe33ff334e27..4fe3da3c667a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -528,40 +528,56 @@ INPUT_DEV_STRING_ATTR_SHOW(name); | |||
528 | INPUT_DEV_STRING_ATTR_SHOW(phys); | 528 | INPUT_DEV_STRING_ATTR_SHOW(phys); |
529 | INPUT_DEV_STRING_ATTR_SHOW(uniq); | 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 | unsigned int min, unsigned int max) | 532 | unsigned int min, unsigned int max) |
533 | { | 533 | { |
534 | int len, i; | 534 | int len, i; |
535 | 535 | ||
536 | len = sprintf(buf, "%c", prefix); | 536 | len = snprintf(buf, size, "%c", prefix); |
537 | for (i = min; i < max; i++) | 537 | for (i = min; i < max; i++) |
538 | if (arr[LONG(i)] & BIT(i)) | 538 | if (arr[LONG(i)] & BIT(i)) |
539 | len += sprintf(buf+len, "%X,", i); | 539 | len += snprintf(buf + len, size - len, "%X,", i); |
540 | return len; | 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); | 545 | int len; |
546 | ssize_t len = 0; | ||
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 | id->id.bustype, | 548 | id->id.bustype, |
550 | id->id.vendor, | 549 | id->id.vendor, |
551 | id->id.product, | 550 | id->id.product, |
552 | id->id.version); | 551 | id->id.version); |
553 | 552 | ||
554 | len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX); | 553 | len += print_modalias_bits(buf + len, size - len, 'e', id->evbit, |
555 | len += print_modalias_bits(buf+len, 'k', id->keybit, | 554 | 0, EV_MAX); |
555 | len += print_modalias_bits(buf + len, size - len, 'k', id->keybit, | ||
556 | KEY_MIN_INTERESTING, KEY_MAX); | 556 | KEY_MIN_INTERESTING, KEY_MAX); |
557 | len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX); | 557 | len += print_modalias_bits(buf + len, size - len, 'r', id->relbit, |
558 | len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX); | 558 | 0, REL_MAX); |
559 | len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX); | 559 | len += print_modalias_bits(buf + len, size - len, 'a', id->absbit, |
560 | len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX); | 560 | 0, ABS_MAX); |
561 | len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX); | 561 | len += print_modalias_bits(buf + len, size - len, 'm', id->mscbit, |
562 | len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX); | 562 | 0, MSC_MAX); |
563 | len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX); | 563 | len += print_modalias_bits(buf + len, size - len, 'l', id->ledbit, |
564 | len += sprintf(buf+len, "\n"); | 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); | ||
571 | return len; | ||
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"); | ||
565 | return len; | 581 | return len; |
566 | } | 582 | } |
567 | static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); | 583 | static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); |
@@ -728,8 +744,11 @@ static int input_dev_uevent(struct class_device *cdev, char **envp, | |||
728 | if (test_bit(EV_SW, dev->evbit)) | 744 | if (test_bit(EV_SW, dev->evbit)) |
729 | INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); | 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 | return 0; | 752 | return 0; |
734 | } | 753 | } |
735 | 754 | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 8e530cc970e1..2f76813c3a64 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -59,9 +59,7 @@ static DECLARE_MUTEX(serio_sem); | |||
59 | 59 | ||
60 | static LIST_HEAD(serio_list); | 60 | static LIST_HEAD(serio_list); |
61 | 61 | ||
62 | static struct bus_type serio_bus = { | 62 | static struct bus_type serio_bus; |
63 | .name = "serio", | ||
64 | }; | ||
65 | 63 | ||
66 | static void serio_add_port(struct serio *serio); | 64 | static void serio_add_port(struct serio *serio); |
67 | static void serio_destroy_port(struct serio *serio); | 65 | static void serio_destroy_port(struct serio *serio); |
@@ -750,11 +748,15 @@ static int serio_driver_remove(struct device *dev) | |||
750 | return 0; | 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 | void __serio_register_driver(struct serio_driver *drv, struct module *owner) | 757 | void __serio_register_driver(struct serio_driver *drv, struct module *owner) |
754 | { | 758 | { |
755 | drv->driver.bus = &serio_bus; | 759 | drv->driver.bus = &serio_bus; |
756 | drv->driver.probe = serio_driver_probe; | ||
757 | drv->driver.remove = serio_driver_remove; | ||
758 | 760 | ||
759 | serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER); | 761 | serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER); |
760 | } | 762 | } |
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 2a545ceb523b..ed6d3174d660 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -211,6 +211,9 @@ struct bus_type macio_bus_type = { | |||
211 | .name = "macio", | 211 | .name = "macio", |
212 | .match = macio_bus_match, | 212 | .match = macio_bus_match, |
213 | .uevent = macio_uevent, | 213 | .uevent = macio_uevent, |
214 | .probe = macio_device_probe, | ||
215 | .remove = macio_device_remove, | ||
216 | .shutdown = macio_device_shutdown, | ||
214 | .suspend = macio_device_suspend, | 217 | .suspend = macio_device_suspend, |
215 | .resume = macio_device_resume, | 218 | .resume = macio_device_resume, |
216 | .dev_attrs = macio_dev_attrs, | 219 | .dev_attrs = macio_dev_attrs, |
@@ -528,9 +531,6 @@ int macio_register_driver(struct macio_driver *drv) | |||
528 | /* initialize common driver fields */ | 531 | /* initialize common driver fields */ |
529 | drv->driver.name = drv->name; | 532 | drv->driver.name = drv->name; |
530 | drv->driver.bus = &macio_bus_type; | 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 | /* register with core */ | 535 | /* register with core */ |
536 | count = driver_register(&drv->driver); | 536 | count = driver_register(&drv->driver); |
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index f65f64b00ff3..44fcbe77c8f9 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c | |||
@@ -779,9 +779,8 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | |||
779 | return 0; | 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 | struct dvb_bt8xx_card *card; | 784 | struct dvb_bt8xx_card *card; |
786 | struct pci_dev* bttv_pci_dev; | 785 | struct pci_dev* bttv_pci_dev; |
787 | int ret; | 786 | int ret; |
@@ -890,13 +889,13 @@ static int dvb_bt8xx_probe(struct device *dev) | |||
890 | return ret; | 889 | return ret; |
891 | } | 890 | } |
892 | 891 | ||
893 | dev_set_drvdata(dev, card); | 892 | dev_set_drvdata(&sub->dev, card); |
894 | return 0; | 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 | dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr); | 900 | dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr); |
902 | 901 | ||
@@ -919,14 +918,14 @@ static int dvb_bt8xx_remove(struct device *dev) | |||
919 | static struct bttv_sub_driver driver = { | 918 | static struct bttv_sub_driver driver = { |
920 | .drv = { | 919 | .drv = { |
921 | .name = "dvb-bt8xx", | 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 | static int __init dvb_bt8xx_init(void) | 931 | static int __init dvb_bt8xx_init(void) |
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c index d64accc17b0e..c4d5e2b70c28 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bttv-gpio.c | |||
@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv) | |||
47 | return 0; | 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 | struct bus_type bttv_sub_bus_type = { | 68 | struct bus_type bttv_sub_bus_type = { |
51 | .name = "bttv-sub", | 69 | .name = "bttv-sub", |
52 | .match = &bttv_sub_bus_match, | 70 | .match = &bttv_sub_bus_match, |
71 | .probe = bttv_sub_probe, | ||
72 | .remove = bttv_sub_remove, | ||
53 | }; | 73 | }; |
54 | EXPORT_SYMBOL(bttv_sub_bus_type); | 74 | EXPORT_SYMBOL(bttv_sub_bus_type); |
55 | 75 | ||
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index e370d74f2a1b..9908c8e0c951 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h | |||
@@ -365,6 +365,8 @@ struct bttv_sub_device { | |||
365 | struct bttv_sub_driver { | 365 | struct bttv_sub_driver { |
366 | struct device_driver drv; | 366 | struct device_driver drv; |
367 | char wanted[BUS_ID_SIZE]; | 367 | char wanted[BUS_ID_SIZE]; |
368 | int (*probe)(struct bttv_sub_device *sub); | ||
369 | void (*remove)(struct bttv_sub_device *sub); | ||
368 | void (*gpio_irq)(struct bttv_sub_device *sub); | 370 | void (*gpio_irq)(struct bttv_sub_device *sub); |
369 | }; | 371 | }; |
370 | #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv) | 372 | #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv) |
diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c index 55ba23075c90..75f401d52fda 100644 --- a/drivers/mfd/mcp-core.c +++ b/drivers/mfd/mcp-core.c | |||
@@ -77,6 +77,8 @@ static int mcp_bus_resume(struct device *dev) | |||
77 | static struct bus_type mcp_bus_type = { | 77 | static struct bus_type mcp_bus_type = { |
78 | .name = "mcp", | 78 | .name = "mcp", |
79 | .match = mcp_bus_match, | 79 | .match = mcp_bus_match, |
80 | .probe = mcp_bus_probe, | ||
81 | .remove = mcp_bus_remove, | ||
80 | .suspend = mcp_bus_suspend, | 82 | .suspend = mcp_bus_suspend, |
81 | .resume = mcp_bus_resume, | 83 | .resume = mcp_bus_resume, |
82 | }; | 84 | }; |
@@ -227,8 +229,6 @@ EXPORT_SYMBOL(mcp_host_unregister); | |||
227 | int mcp_driver_register(struct mcp_driver *mcpdrv) | 229 | int mcp_driver_register(struct mcp_driver *mcpdrv) |
228 | { | 230 | { |
229 | mcpdrv->drv.bus = &mcp_bus_type; | 231 | mcpdrv->drv.bus = &mcp_bus_type; |
230 | mcpdrv->drv.probe = mcp_bus_probe; | ||
231 | mcpdrv->drv.remove = mcp_bus_remove; | ||
232 | return driver_register(&mcpdrv->drv); | 232 | return driver_register(&mcpdrv->drv); |
233 | } | 233 | } |
234 | EXPORT_SYMBOL(mcp_driver_register); | 234 | EXPORT_SYMBOL(mcp_driver_register); |
diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c index ec701667abfc..a2a35fd946ee 100644 --- a/drivers/mmc/mmc_sysfs.c +++ b/drivers/mmc/mmc_sysfs.c | |||
@@ -136,17 +136,7 @@ static int mmc_bus_resume(struct device *dev) | |||
136 | return ret; | 136 | return ret; |
137 | } | 137 | } |
138 | 138 | ||
139 | static struct bus_type mmc_bus_type = { | 139 | static int mmc_bus_probe(struct device *dev) |
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) | ||
150 | { | 140 | { |
151 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 141 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
152 | struct mmc_card *card = dev_to_mmc_card(dev); | 142 | struct mmc_card *card = dev_to_mmc_card(dev); |
@@ -154,7 +144,7 @@ static int mmc_drv_probe(struct device *dev) | |||
154 | return drv->probe(card); | 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 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 149 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
160 | struct mmc_card *card = dev_to_mmc_card(dev); | 150 | struct mmc_card *card = dev_to_mmc_card(dev); |
@@ -164,6 +154,16 @@ static int mmc_drv_remove(struct device *dev) | |||
164 | return 0; | 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 | * mmc_register_driver - register a media driver | 169 | * mmc_register_driver - register a media driver |
@@ -172,8 +172,6 @@ static int mmc_drv_remove(struct device *dev) | |||
172 | int mmc_register_driver(struct mmc_driver *drv) | 172 | int mmc_register_driver(struct mmc_driver *drv) |
173 | { | 173 | { |
174 | drv->drv.bus = &mmc_bus_type; | 174 | drv->drv.bus = &mmc_bus_type; |
175 | drv->drv.probe = mmc_drv_probe; | ||
176 | drv->drv.remove = mmc_drv_remove; | ||
177 | return driver_register(&drv->drv); | 175 | return driver_register(&drv->drv); |
178 | } | 176 | } |
179 | 177 | ||
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 7146b69b812c..0aa14c92b570 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -380,8 +380,6 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner) | |||
380 | /* initialize common driver fields */ | 380 | /* initialize common driver fields */ |
381 | drv->driver.name = drv->name; | 381 | drv->driver.name = drv->name; |
382 | drv->driver.bus = &pci_bus_type; | 382 | drv->driver.bus = &pci_bus_type; |
383 | drv->driver.probe = pci_device_probe; | ||
384 | drv->driver.remove = pci_device_remove; | ||
385 | /* FIXME, once all of the existing PCI drivers have been fixed to set | 383 | /* FIXME, once all of the existing PCI drivers have been fixed to set |
386 | * the pci shutdown function, this test can go away. */ | 384 | * the pci shutdown function, this test can go away. */ |
387 | if (!drv->driver.shutdown) | 385 | if (!drv->driver.shutdown) |
@@ -513,6 +511,8 @@ struct bus_type pci_bus_type = { | |||
513 | .name = "pci", | 511 | .name = "pci", |
514 | .match = pci_bus_match, | 512 | .match = pci_bus_match, |
515 | .uevent = pci_uevent, | 513 | .uevent = pci_uevent, |
514 | .probe = pci_device_probe, | ||
515 | .remove = pci_device_remove, | ||
516 | .suspend = pci_device_suspend, | 516 | .suspend = pci_device_suspend, |
517 | .resume = pci_device_resume, | 517 | .resume = pci_device_resume, |
518 | .dev_attrs = pci_dev_attrs, | 518 | .dev_attrs = pci_dev_attrs, |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 621ec459d27a..0a424a4e8187 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -311,8 +311,6 @@ int pcmcia_register_driver(struct pcmcia_driver *driver) | |||
311 | /* initialize common fields */ | 311 | /* initialize common fields */ |
312 | driver->drv.bus = &pcmcia_bus_type; | 312 | driver->drv.bus = &pcmcia_bus_type; |
313 | driver->drv.owner = driver->owner; | 313 | driver->drv.owner = driver->owner; |
314 | driver->drv.probe = pcmcia_device_probe; | ||
315 | driver->drv.remove = pcmcia_device_remove; | ||
316 | 314 | ||
317 | return driver_register(&driver->drv); | 315 | return driver_register(&driver->drv); |
318 | } | 316 | } |
@@ -1200,6 +1198,8 @@ struct bus_type pcmcia_bus_type = { | |||
1200 | .uevent = pcmcia_bus_uevent, | 1198 | .uevent = pcmcia_bus_uevent, |
1201 | .match = pcmcia_bus_match, | 1199 | .match = pcmcia_bus_match, |
1202 | .dev_attrs = pcmcia_dev_attrs, | 1200 | .dev_attrs = pcmcia_dev_attrs, |
1201 | .probe = pcmcia_device_probe, | ||
1202 | .remove = pcmcia_device_remove, | ||
1203 | .suspend = pcmcia_dev_suspend, | 1203 | .suspend = pcmcia_dev_suspend, |
1204 | .resume = pcmcia_dev_resume, | 1204 | .resume = pcmcia_dev_resume, |
1205 | }; | 1205 | }; |
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 15fb758a9e52..7cafacdd12b0 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -195,6 +195,8 @@ static int pnp_bus_resume(struct device *dev) | |||
195 | struct bus_type pnp_bus_type = { | 195 | struct bus_type pnp_bus_type = { |
196 | .name = "pnp", | 196 | .name = "pnp", |
197 | .match = pnp_bus_match, | 197 | .match = pnp_bus_match, |
198 | .probe = pnp_device_probe, | ||
199 | .remove = pnp_device_remove, | ||
198 | .suspend = pnp_bus_suspend, | 200 | .suspend = pnp_bus_suspend, |
199 | .resume = pnp_bus_resume, | 201 | .resume = pnp_bus_resume, |
200 | }; | 202 | }; |
@@ -215,8 +217,6 @@ int pnp_register_driver(struct pnp_driver *drv) | |||
215 | 217 | ||
216 | drv->driver.name = drv->name; | 218 | drv->driver.name = drv->name; |
217 | drv->driver.bus = &pnp_bus_type; | 219 | drv->driver.bus = &pnp_bus_type; |
218 | drv->driver.probe = pnp_device_probe; | ||
219 | drv->driver.remove = pnp_device_remove; | ||
220 | 220 | ||
221 | count = driver_register(&drv->driver); | 221 | count = driver_register(&drv->driver); |
222 | 222 | ||
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c index dc749609699a..5480119ff9d3 100644 --- a/drivers/rapidio/rio-driver.c +++ b/drivers/rapidio/rio-driver.c | |||
@@ -147,8 +147,6 @@ int rio_register_driver(struct rio_driver *rdrv) | |||
147 | /* initialize common driver fields */ | 147 | /* initialize common driver fields */ |
148 | rdrv->driver.name = rdrv->name; | 148 | rdrv->driver.name = rdrv->name; |
149 | rdrv->driver.bus = &rio_bus_type; | 149 | rdrv->driver.bus = &rio_bus_type; |
150 | rdrv->driver.probe = rio_device_probe; | ||
151 | rdrv->driver.remove = rio_device_remove; | ||
152 | 150 | ||
153 | /* register with core */ | 151 | /* register with core */ |
154 | return driver_register(&rdrv->driver); | 152 | return driver_register(&rdrv->driver); |
@@ -204,7 +202,9 @@ static struct device rio_bus = { | |||
204 | struct bus_type rio_bus_type = { | 202 | struct bus_type rio_bus_type = { |
205 | .name = "rapidio", | 203 | .name = "rapidio", |
206 | .match = rio_match_bus, | 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 | /** |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index e849289d4f3c..503a568e47c3 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -52,11 +52,7 @@ ccwgroup_uevent (struct device *dev, char **envp, int num_envp, char *buffer, | |||
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | static struct bus_type ccwgroup_bus_type = { | 55 | static struct bus_type ccwgroup_bus_type; |
56 | .name = "ccwgroup", | ||
57 | .match = ccwgroup_bus_match, | ||
58 | .uevent = ccwgroup_uevent, | ||
59 | }; | ||
60 | 56 | ||
61 | static inline void | 57 | static inline void |
62 | __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) | 58 | __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) |
@@ -389,6 +385,14 @@ ccwgroup_remove (struct device *dev) | |||
389 | return 0; | 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 | int | 396 | int |
393 | ccwgroup_driver_register (struct ccwgroup_driver *cdriver) | 397 | ccwgroup_driver_register (struct ccwgroup_driver *cdriver) |
394 | { | 398 | { |
@@ -396,8 +400,6 @@ ccwgroup_driver_register (struct ccwgroup_driver *cdriver) | |||
396 | cdriver->driver = (struct device_driver) { | 400 | cdriver->driver = (struct device_driver) { |
397 | .bus = &ccwgroup_bus_type, | 401 | .bus = &ccwgroup_bus_type, |
398 | .name = cdriver->name, | 402 | .name = cdriver->name, |
399 | .probe = ccwgroup_probe, | ||
400 | .remove = ccwgroup_remove, | ||
401 | }; | 403 | }; |
402 | 404 | ||
403 | return driver_register(&cdriver->driver); | 405 | return driver_register(&cdriver->driver); |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index e565193650c7..2d319fb812ca 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -542,9 +542,41 @@ css_bus_match (struct device *dev, struct device_driver *drv) | |||
542 | return 0; | 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 | struct bus_type css_bus_type = { | 574 | struct bus_type css_bus_type = { |
546 | .name = "css", | 575 | .name = "css", |
547 | .match = &css_bus_match, | 576 | .match = css_bus_match, |
577 | .probe = css_probe, | ||
578 | .remove = css_remove, | ||
579 | .shutdown = css_shutdown, | ||
548 | }; | 580 | }; |
549 | 581 | ||
550 | subsys_initcall(init_channel_subsystem); | 582 | subsys_initcall(init_channel_subsystem); |
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index 251ebd7a7d3a..aa5ab5d4547c 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h | |||
@@ -115,6 +115,7 @@ struct ccw_device_private { | |||
115 | * Currently, we only care about I/O subchannels (type 0), these | 115 | * Currently, we only care about I/O subchannels (type 0), these |
116 | * have a ccw_device connected to them. | 116 | * have a ccw_device connected to them. |
117 | */ | 117 | */ |
118 | struct subchannel; | ||
118 | struct css_driver { | 119 | struct css_driver { |
119 | unsigned int subchannel_type; | 120 | unsigned int subchannel_type; |
120 | struct device_driver drv; | 121 | struct device_driver drv; |
@@ -122,6 +123,9 @@ struct css_driver { | |||
122 | int (*notify)(struct device *, int); | 123 | int (*notify)(struct device *, int); |
123 | void (*verify)(struct device *); | 124 | void (*verify)(struct device *); |
124 | void (*termination)(struct device *); | 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 | /* |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index fa3e4c0a2536..eb73605a0527 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -107,33 +107,29 @@ ccw_uevent (struct device *dev, char **envp, int num_envp, | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | struct bus_type ccw_bus_type = { | 110 | struct bus_type ccw_bus_type; |
111 | .name = "ccw", | ||
112 | .match = &ccw_bus_match, | ||
113 | .uevent = &ccw_uevent, | ||
114 | }; | ||
115 | 111 | ||
116 | static int io_subchannel_probe (struct device *); | 112 | static int io_subchannel_probe (struct subchannel *); |
117 | static int io_subchannel_remove (struct device *); | 113 | static int io_subchannel_remove (struct subchannel *); |
118 | void io_subchannel_irq (struct device *); | 114 | void io_subchannel_irq (struct device *); |
119 | static int io_subchannel_notify(struct device *, int); | 115 | static int io_subchannel_notify(struct device *, int); |
120 | static void io_subchannel_verify(struct device *); | 116 | static void io_subchannel_verify(struct device *); |
121 | static void io_subchannel_ioterm(struct device *); | 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 | struct css_driver io_subchannel_driver = { | 120 | struct css_driver io_subchannel_driver = { |
125 | .subchannel_type = SUBCHANNEL_TYPE_IO, | 121 | .subchannel_type = SUBCHANNEL_TYPE_IO, |
126 | .drv = { | 122 | .drv = { |
127 | .name = "io_subchannel", | 123 | .name = "io_subchannel", |
128 | .bus = &css_bus_type, | 124 | .bus = &css_bus_type, |
129 | .probe = &io_subchannel_probe, | ||
130 | .remove = &io_subchannel_remove, | ||
131 | .shutdown = &io_subchannel_shutdown, | ||
132 | }, | 125 | }, |
133 | .irq = io_subchannel_irq, | 126 | .irq = io_subchannel_irq, |
134 | .notify = io_subchannel_notify, | 127 | .notify = io_subchannel_notify, |
135 | .verify = io_subchannel_verify, | 128 | .verify = io_subchannel_verify, |
136 | .termination = io_subchannel_ioterm, | 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 | struct workqueue_struct *ccw_device_work; | 135 | struct workqueue_struct *ccw_device_work; |
@@ -803,14 +799,12 @@ io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) | |||
803 | } | 799 | } |
804 | 800 | ||
805 | static int | 801 | static int |
806 | io_subchannel_probe (struct device *pdev) | 802 | io_subchannel_probe (struct subchannel *sch) |
807 | { | 803 | { |
808 | struct subchannel *sch; | ||
809 | struct ccw_device *cdev; | 804 | struct ccw_device *cdev; |
810 | int rc; | 805 | int rc; |
811 | unsigned long flags; | 806 | unsigned long flags; |
812 | 807 | ||
813 | sch = to_subchannel(pdev); | ||
814 | if (sch->dev.driver_data) { | 808 | if (sch->dev.driver_data) { |
815 | /* | 809 | /* |
816 | * This subchannel already has an associated ccw_device. | 810 | * This subchannel already has an associated ccw_device. |
@@ -846,7 +840,7 @@ io_subchannel_probe (struct device *pdev) | |||
846 | memset(cdev->private, 0, sizeof(struct ccw_device_private)); | 840 | memset(cdev->private, 0, sizeof(struct ccw_device_private)); |
847 | atomic_set(&cdev->private->onoff, 0); | 841 | atomic_set(&cdev->private->onoff, 0); |
848 | cdev->dev = (struct device) { | 842 | cdev->dev = (struct device) { |
849 | .parent = pdev, | 843 | .parent = &sch->dev, |
850 | .release = ccw_device_release, | 844 | .release = ccw_device_release, |
851 | }; | 845 | }; |
852 | INIT_LIST_HEAD(&cdev->private->kick_work.entry); | 846 | INIT_LIST_HEAD(&cdev->private->kick_work.entry); |
@@ -859,7 +853,7 @@ io_subchannel_probe (struct device *pdev) | |||
859 | return -ENODEV; | 853 | return -ENODEV; |
860 | } | 854 | } |
861 | 855 | ||
862 | rc = io_subchannel_recog(cdev, to_subchannel(pdev)); | 856 | rc = io_subchannel_recog(cdev, sch); |
863 | if (rc) { | 857 | if (rc) { |
864 | spin_lock_irqsave(&sch->lock, flags); | 858 | spin_lock_irqsave(&sch->lock, flags); |
865 | sch->dev.driver_data = NULL; | 859 | sch->dev.driver_data = NULL; |
@@ -883,17 +877,17 @@ ccw_device_unregister(void *data) | |||
883 | } | 877 | } |
884 | 878 | ||
885 | static int | 879 | static int |
886 | io_subchannel_remove (struct device *dev) | 880 | io_subchannel_remove (struct subchannel *sch) |
887 | { | 881 | { |
888 | struct ccw_device *cdev; | 882 | struct ccw_device *cdev; |
889 | unsigned long flags; | 883 | unsigned long flags; |
890 | 884 | ||
891 | if (!dev->driver_data) | 885 | if (!sch->dev.driver_data) |
892 | return 0; | 886 | return 0; |
893 | cdev = dev->driver_data; | 887 | cdev = sch->dev.driver_data; |
894 | /* Set ccw device to not operational and drop reference. */ | 888 | /* Set ccw device to not operational and drop reference. */ |
895 | spin_lock_irqsave(cdev->ccwlock, flags); | 889 | spin_lock_irqsave(cdev->ccwlock, flags); |
896 | dev->driver_data = NULL; | 890 | sch->dev.driver_data = NULL; |
897 | cdev->private->state = DEV_STATE_NOT_OPER; | 891 | cdev->private->state = DEV_STATE_NOT_OPER; |
898 | spin_unlock_irqrestore(cdev->ccwlock, flags); | 892 | spin_unlock_irqrestore(cdev->ccwlock, flags); |
899 | /* | 893 | /* |
@@ -948,14 +942,12 @@ io_subchannel_ioterm(struct device *dev) | |||
948 | } | 942 | } |
949 | 943 | ||
950 | static void | 944 | static void |
951 | io_subchannel_shutdown(struct device *dev) | 945 | io_subchannel_shutdown(struct subchannel *sch) |
952 | { | 946 | { |
953 | struct subchannel *sch; | ||
954 | struct ccw_device *cdev; | 947 | struct ccw_device *cdev; |
955 | int ret; | 948 | int ret; |
956 | 949 | ||
957 | sch = to_subchannel(dev); | 950 | cdev = sch->dev.driver_data; |
958 | cdev = dev->driver_data; | ||
959 | 951 | ||
960 | if (cio_is_console(sch->schid)) | 952 | if (cio_is_console(sch->schid)) |
961 | return; | 953 | return; |
@@ -1129,6 +1121,14 @@ ccw_device_remove (struct device *dev) | |||
1129 | return 0; | 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 | int | 1132 | int |
1133 | ccw_driver_register (struct ccw_driver *cdriver) | 1133 | ccw_driver_register (struct ccw_driver *cdriver) |
1134 | { | 1134 | { |
@@ -1136,8 +1136,6 @@ ccw_driver_register (struct ccw_driver *cdriver) | |||
1136 | 1136 | ||
1137 | drv->bus = &ccw_bus_type; | 1137 | drv->bus = &ccw_bus_type; |
1138 | drv->name = cdriver->name; | 1138 | drv->name = cdriver->name; |
1139 | drv->probe = ccw_device_probe; | ||
1140 | drv->remove = ccw_device_remove; | ||
1141 | 1139 | ||
1142 | return driver_register(drv); | 1140 | return driver_register(drv); |
1143 | } | 1141 | } |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 3ded9daaf4a0..0e529f8171c4 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -221,8 +221,6 @@ static struct bus_type pseudo_lld_bus; | |||
221 | static struct device_driver sdebug_driverfs_driver = { | 221 | static struct device_driver sdebug_driverfs_driver = { |
222 | .name = sdebug_proc_name, | 222 | .name = sdebug_proc_name, |
223 | .bus = &pseudo_lld_bus, | 223 | .bus = &pseudo_lld_bus, |
224 | .probe = sdebug_driver_probe, | ||
225 | .remove = sdebug_driver_remove, | ||
226 | }; | 224 | }; |
227 | 225 | ||
228 | static const int check_condition_result = | 226 | static const int check_condition_result = |
@@ -1796,6 +1794,8 @@ static int pseudo_lld_bus_match(struct device *dev, | |||
1796 | static struct bus_type pseudo_lld_bus = { | 1794 | static struct bus_type pseudo_lld_bus = { |
1797 | .name = "pseudo", | 1795 | .name = "pseudo", |
1798 | .match = pseudo_lld_bus_match, | 1796 | .match = pseudo_lld_bus_match, |
1797 | .probe = sdebug_driver_probe, | ||
1798 | .remove = sdebug_driver_remove, | ||
1799 | }; | 1799 | }; |
1800 | 1800 | ||
1801 | static void sdebug_release_adapter(struct device * dev) | 1801 | static void sdebug_release_adapter(struct device * dev) |
diff --git a/drivers/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c index 7bdab2a7f59c..94b229031198 100644 --- a/drivers/sh/superhyway/superhyway.c +++ b/drivers/sh/superhyway/superhyway.c | |||
@@ -175,8 +175,6 @@ int superhyway_register_driver(struct superhyway_driver *drv) | |||
175 | { | 175 | { |
176 | drv->drv.name = drv->name; | 176 | drv->drv.name = drv->name; |
177 | drv->drv.bus = &superhyway_bus_type; | 177 | drv->drv.bus = &superhyway_bus_type; |
178 | drv->drv.probe = superhyway_device_probe; | ||
179 | drv->drv.remove = superhyway_device_remove; | ||
180 | 178 | ||
181 | return driver_register(&drv->drv); | 179 | return driver_register(&drv->drv); |
182 | } | 180 | } |
@@ -213,6 +211,8 @@ struct bus_type superhyway_bus_type = { | |||
213 | #ifdef CONFIG_SYSFS | 211 | #ifdef CONFIG_SYSFS |
214 | .dev_attrs = superhyway_dev_attrs, | 212 | .dev_attrs = superhyway_dev_attrs, |
215 | #endif | 213 | #endif |
214 | .probe = superhyway_device_probe, | ||
215 | .remove = superhyway_device_remove, | ||
216 | }; | 216 | }; |
217 | 217 | ||
218 | static int __init superhyway_bus_init(void) | 218 | static int __init superhyway_bus_init(void) |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 8f402f85e1ca..afc84cfb61f9 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -2534,9 +2534,6 @@ static struct usb_gadget_driver eth_driver = { | |||
2534 | .driver = { | 2534 | .driver = { |
2535 | .name = (char *) shortname, | 2535 | .name = (char *) shortname, |
2536 | .owner = THIS_MODULE, | 2536 | .owner = THIS_MODULE, |
2537 | // .shutdown = ... | ||
2538 | // .suspend = ... | ||
2539 | // .resume = ... | ||
2540 | }, | 2537 | }, |
2541 | }; | 2538 | }; |
2542 | 2539 | ||
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index c6c279de832e..9a4edc5657aa 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1738,9 +1738,6 @@ static struct usb_gadget_driver gadgetfs_driver = { | |||
1738 | 1738 | ||
1739 | .driver = { | 1739 | .driver = { |
1740 | .name = (char *) shortname, | 1740 | .name = (char *) shortname, |
1741 | // .shutdown = ... | ||
1742 | // .suspend = ... | ||
1743 | // .resume = ... | ||
1744 | }, | 1741 | }, |
1745 | }; | 1742 | }; |
1746 | 1743 | ||
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 2e6926b33455..ba9acd531024 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -374,9 +374,6 @@ static struct usb_gadget_driver gs_gadget_driver = { | |||
374 | .disconnect = gs_disconnect, | 374 | .disconnect = gs_disconnect, |
375 | .driver = { | 375 | .driver = { |
376 | .name = GS_SHORT_NAME, | 376 | .name = GS_SHORT_NAME, |
377 | /* .shutdown = ... */ | ||
378 | /* .suspend = ... */ | ||
379 | /* .resume = ... */ | ||
380 | }, | 377 | }, |
381 | }; | 378 | }; |
382 | 379 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 6c58636e914b..2fc110d3ad5a 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -1303,9 +1303,6 @@ static struct usb_gadget_driver zero_driver = { | |||
1303 | .driver = { | 1303 | .driver = { |
1304 | .name = (char *) shortname, | 1304 | .name = (char *) shortname, |
1305 | .owner = THIS_MODULE, | 1305 | .owner = THIS_MODULE, |
1306 | // .shutdown = ... | ||
1307 | // .suspend = ... | ||
1308 | // .resume = ... | ||
1309 | }, | 1306 | }, |
1310 | }; | 1307 | }; |
1311 | 1308 | ||
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 664139afcfa9..e9f9f4bafa17 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -37,11 +37,6 @@ static int usb_serial_device_match (struct device *dev, struct device_driver *dr | |||
37 | return 0; | 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 | static int usb_serial_device_probe (struct device *dev) | 40 | static int usb_serial_device_probe (struct device *dev) |
46 | { | 41 | { |
47 | struct usb_serial_driver *driver; | 42 | struct usb_serial_driver *driver; |
@@ -109,14 +104,18 @@ exit: | |||
109 | return retval; | 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 | int usb_serial_bus_register(struct usb_serial_driver *driver) | 114 | int usb_serial_bus_register(struct usb_serial_driver *driver) |
113 | { | 115 | { |
114 | int retval; | 116 | int retval; |
115 | 117 | ||
116 | driver->driver.bus = &usb_serial_bus_type; | 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 | retval = driver_register(&driver->driver); | 119 | retval = driver_register(&driver->driver); |
121 | 120 | ||
122 | return retval; | 121 | return retval; |
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index ccba227676f2..fcbee748c592 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c | |||
@@ -77,7 +77,6 @@ int zorro_register_driver(struct zorro_driver *drv) | |||
77 | /* initialize common driver fields */ | 77 | /* initialize common driver fields */ |
78 | drv->driver.name = drv->name; | 78 | drv->driver.name = drv->name; |
79 | drv->driver.bus = &zorro_bus_type; | 79 | drv->driver.bus = &zorro_bus_type; |
80 | drv->driver.probe = zorro_device_probe; | ||
81 | 80 | ||
82 | /* register with core */ | 81 | /* register with core */ |
83 | count = driver_register(&drv->driver); | 82 | count = driver_register(&drv->driver); |
@@ -132,7 +131,8 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv) | |||
132 | 131 | ||
133 | struct bus_type zorro_bus_type = { | 132 | struct bus_type zorro_bus_type = { |
134 | .name = "zorro", | 133 | .name = "zorro", |
135 | .match = zorro_bus_match | 134 | .match = zorro_bus_match, |
135 | .probe = zorro_device_probe, | ||
136 | }; | 136 | }; |
137 | 137 | ||
138 | 138 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index 0cdee78e5ce1..58df18d9cd3e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -49,6 +49,9 @@ struct bus_type { | |||
49 | int (*match)(struct device * dev, struct device_driver * drv); | 49 | int (*match)(struct device * dev, struct device_driver * drv); |
50 | int (*uevent)(struct device *dev, char **envp, | 50 | int (*uevent)(struct device *dev, char **envp, |
51 | int num_envp, char *buffer, int buffer_size); | 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 | int (*suspend)(struct device * dev, pm_message_t state); | 55 | int (*suspend)(struct device * dev, pm_message_t state); |
53 | int (*resume)(struct device * dev); | 56 | int (*resume)(struct device * dev); |
54 | }; | 57 | }; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index f2e1b5b22898..110b3cfac021 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -983,8 +983,13 @@ typedef struct ide_driver_s { | |||
983 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); | 983 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); |
984 | ide_proc_entry_t *proc; | 984 | ide_proc_entry_t *proc; |
985 | struct device_driver gen_driver; | 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 | } ide_driver_t; | 989 | } ide_driver_t; |
987 | 990 | ||
991 | #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) | ||
992 | |||
988 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); | 993 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); |
989 | 994 | ||
990 | /* | 995 | /* |