diff options
author | Aleksey Gorelov <dared1st@yahoo.com> | 2006-08-08 20:24:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 14:58:54 -0400 |
commit | 64a21d025d3a979a8715f2ec7acabca7b5406c8a (patch) | |
tree | e3cbcef560d848e177cddde6d093aa2411cddd53 /drivers | |
parent | a94da8971e836f32315f8832b0bf3e88bee9efae (diff) |
USB: Properly unregister reboot notifier in case of failure in ehci hcd
If some problem occurs during ehci startup, for instance, request_irq fails,
echi hcd driver tries it best to cleanup, but fails to unregister reboot
notifier, which in turn leads to crash on reboot/poweroff.
The following patch resolves this problem by not using reboot notifiers
anymore, but instead making ehci/ohci driver get its own shutdown method. For
PCI, it is done through pci glue, for everything else through platform driver
glue.
One downside: sa1111 does not use platform driver stuff, and does not have its
own shutdown hook, so no 'shutdown' is called for it now. I'm not sure if it
is really necessary on that platform, though.
Signed-off-by: Aleks Gorelov <dared1st@yahoo.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 16 | ||||
-rw-r--r-- | drivers/usb/core/hcd.c | 11 | ||||
-rw-r--r-- | drivers/usb/core/hcd.h | 8 | ||||
-rw-r--r-- | drivers/usb/host/ehci-au1xxx.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-fsl.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 16 | ||||
-rw-r--r-- | drivers/usb/host/ehci-pci.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci.h | 1 | ||||
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-au1xxx.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-ep93xx.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hcd.c | 12 | ||||
-rw-r--r-- | drivers/usb/host/ohci-lh7a404.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-mem.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/ohci-omap.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pci.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/ohci-ppc-soc.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-s3c2410.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci.h | 2 |
20 files changed, 69 insertions, 23 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index fa36391fedd3..edf4300a3f7a 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -413,4 +413,20 @@ EXPORT_SYMBOL (usb_hcd_pci_resume); | |||
413 | 413 | ||
414 | #endif /* CONFIG_PM */ | 414 | #endif /* CONFIG_PM */ |
415 | 415 | ||
416 | /** | ||
417 | * usb_hcd_pci_shutdown - shutdown host controller | ||
418 | * @dev: USB Host Controller being shutdown | ||
419 | */ | ||
420 | void usb_hcd_pci_shutdown (struct pci_dev *dev) | ||
421 | { | ||
422 | struct usb_hcd *hcd; | ||
423 | |||
424 | hcd = pci_get_drvdata(dev); | ||
425 | if (!hcd) | ||
426 | return; | ||
427 | |||
428 | if (hcd->driver->shutdown) | ||
429 | hcd->driver->shutdown(hcd); | ||
430 | } | ||
431 | EXPORT_SYMBOL (usb_hcd_pci_shutdown); | ||
416 | 432 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index fb4d058bbde0..dc9628c58933 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/byteorder.h> | 38 | #include <asm/byteorder.h> |
39 | #include <linux/platform_device.h> | ||
39 | 40 | ||
40 | #include <linux/usb.h> | 41 | #include <linux/usb.h> |
41 | 42 | ||
@@ -1915,6 +1916,16 @@ void usb_remove_hcd(struct usb_hcd *hcd) | |||
1915 | } | 1916 | } |
1916 | EXPORT_SYMBOL (usb_remove_hcd); | 1917 | EXPORT_SYMBOL (usb_remove_hcd); |
1917 | 1918 | ||
1919 | void | ||
1920 | usb_hcd_platform_shutdown(struct platform_device* dev) | ||
1921 | { | ||
1922 | struct usb_hcd *hcd = platform_get_drvdata(dev); | ||
1923 | |||
1924 | if (hcd->driver->shutdown) | ||
1925 | hcd->driver->shutdown(hcd); | ||
1926 | } | ||
1927 | EXPORT_SYMBOL (usb_hcd_platform_shutdown); | ||
1928 | |||
1918 | /*-------------------------------------------------------------------------*/ | 1929 | /*-------------------------------------------------------------------------*/ |
1919 | 1930 | ||
1920 | #if defined(CONFIG_USB_MON) | 1931 | #if defined(CONFIG_USB_MON) |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 7022aafb2ae8..58c7767bc904 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -192,6 +192,9 @@ struct hc_driver { | |||
192 | /* cleanly make HCD stop writing memory and doing I/O */ | 192 | /* cleanly make HCD stop writing memory and doing I/O */ |
193 | void (*stop) (struct usb_hcd *hcd); | 193 | void (*stop) (struct usb_hcd *hcd); |
194 | 194 | ||
195 | /* shutdown HCD */ | ||
196 | void (*shutdown) (struct usb_hcd *hcd); | ||
197 | |||
195 | /* return current frame number */ | 198 | /* return current frame number */ |
196 | int (*get_frame_number) (struct usb_hcd *hcd); | 199 | int (*get_frame_number) (struct usb_hcd *hcd); |
197 | 200 | ||
@@ -227,6 +230,9 @@ extern int usb_add_hcd(struct usb_hcd *hcd, | |||
227 | unsigned int irqnum, unsigned long irqflags); | 230 | unsigned int irqnum, unsigned long irqflags); |
228 | extern void usb_remove_hcd(struct usb_hcd *hcd); | 231 | extern void usb_remove_hcd(struct usb_hcd *hcd); |
229 | 232 | ||
233 | struct platform_device; | ||
234 | extern void usb_hcd_platform_shutdown(struct platform_device* dev); | ||
235 | |||
230 | #ifdef CONFIG_PCI | 236 | #ifdef CONFIG_PCI |
231 | struct pci_dev; | 237 | struct pci_dev; |
232 | struct pci_device_id; | 238 | struct pci_device_id; |
@@ -239,6 +245,8 @@ extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state); | |||
239 | extern int usb_hcd_pci_resume (struct pci_dev *dev); | 245 | extern int usb_hcd_pci_resume (struct pci_dev *dev); |
240 | #endif /* CONFIG_PM */ | 246 | #endif /* CONFIG_PM */ |
241 | 247 | ||
248 | extern void usb_hcd_pci_shutdown (struct pci_dev *dev); | ||
249 | |||
242 | #endif /* CONFIG_PCI */ | 250 | #endif /* CONFIG_PCI */ |
243 | 251 | ||
244 | /* pci-ish (pdev null is ok) buffer alloc/mapping support */ | 252 | /* pci-ish (pdev null is ok) buffer alloc/mapping support */ |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 26ed757d22a6..5d1b12aad776 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -200,6 +200,7 @@ static const struct hc_driver ehci_au1xxx_hc_driver = { | |||
200 | .reset = ehci_init, | 200 | .reset = ehci_init, |
201 | .start = ehci_run, | 201 | .start = ehci_run, |
202 | .stop = ehci_stop, | 202 | .stop = ehci_stop, |
203 | .shutdown = ehci_shutdown, | ||
203 | 204 | ||
204 | /* | 205 | /* |
205 | * managing i/o requests and associated device resources | 206 | * managing i/o requests and associated device resources |
@@ -268,6 +269,7 @@ MODULE_ALIAS("au1xxx-ehci"); | |||
268 | static struct platform_driver ehci_hcd_au1xxx_driver = { | 269 | static struct platform_driver ehci_hcd_au1xxx_driver = { |
269 | .probe = ehci_hcd_au1xxx_drv_probe, | 270 | .probe = ehci_hcd_au1xxx_drv_probe, |
270 | .remove = ehci_hcd_au1xxx_drv_remove, | 271 | .remove = ehci_hcd_au1xxx_drv_remove, |
272 | .shutdown = usb_hcd_platform_shutdown, | ||
271 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ | 273 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ |
272 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ | 274 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ |
273 | .driver = { | 275 | .driver = { |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index d030516edfb9..1a915e982c1c 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -285,6 +285,7 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
285 | .resume = ehci_bus_resume, | 285 | .resume = ehci_bus_resume, |
286 | #endif | 286 | #endif |
287 | .stop = ehci_stop, | 287 | .stop = ehci_stop, |
288 | .shutdown = ehci_shutdown, | ||
288 | 289 | ||
289 | /* | 290 | /* |
290 | * managing i/o requests and associated device resources | 291 | * managing i/o requests and associated device resources |
@@ -329,6 +330,7 @@ MODULE_ALIAS("fsl-ehci"); | |||
329 | static struct platform_driver ehci_fsl_driver = { | 330 | static struct platform_driver ehci_fsl_driver = { |
330 | .probe = ehci_fsl_drv_probe, | 331 | .probe = ehci_fsl_drv_probe, |
331 | .remove = ehci_fsl_drv_remove, | 332 | .remove = ehci_fsl_drv_remove, |
333 | .shutdown = usb_hcd_platform_shutdown, | ||
332 | .driver = { | 334 | .driver = { |
333 | .name = "fsl-ehci", | 335 | .name = "fsl-ehci", |
334 | }, | 336 | }, |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index d63177a8eaea..1c54b303e5fc 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -292,21 +292,20 @@ static void ehci_watchdog (unsigned long param) | |||
292 | spin_unlock_irqrestore (&ehci->lock, flags); | 292 | spin_unlock_irqrestore (&ehci->lock, flags); |
293 | } | 293 | } |
294 | 294 | ||
295 | /* Reboot notifiers kick in for silicon on any bus (not just pci, etc). | 295 | /* ehci_shutdown kick in for silicon on any bus (not just pci, etc). |
296 | * This forcibly disables dma and IRQs, helping kexec and other cases | 296 | * This forcibly disables dma and IRQs, helping kexec and other cases |
297 | * where the next system software may expect clean state. | 297 | * where the next system software may expect clean state. |
298 | */ | 298 | */ |
299 | static int | 299 | static void |
300 | ehci_reboot (struct notifier_block *self, unsigned long code, void *null) | 300 | ehci_shutdown (struct usb_hcd *hcd) |
301 | { | 301 | { |
302 | struct ehci_hcd *ehci; | 302 | struct ehci_hcd *ehci; |
303 | 303 | ||
304 | ehci = container_of (self, struct ehci_hcd, reboot_notifier); | 304 | ehci = hcd_to_ehci (hcd); |
305 | (void) ehci_halt (ehci); | 305 | (void) ehci_halt (ehci); |
306 | 306 | ||
307 | /* make BIOS/etc use companion controller during reboot */ | 307 | /* make BIOS/etc use companion controller during reboot */ |
308 | writel (0, &ehci->regs->configured_flag); | 308 | writel (0, &ehci->regs->configured_flag); |
309 | return 0; | ||
310 | } | 309 | } |
311 | 310 | ||
312 | static void ehci_port_power (struct ehci_hcd *ehci, int is_on) | 311 | static void ehci_port_power (struct ehci_hcd *ehci, int is_on) |
@@ -381,7 +380,6 @@ static void ehci_stop (struct usb_hcd *hcd) | |||
381 | 380 | ||
382 | /* let companion controllers work when we aren't */ | 381 | /* let companion controllers work when we aren't */ |
383 | writel (0, &ehci->regs->configured_flag); | 382 | writel (0, &ehci->regs->configured_flag); |
384 | unregister_reboot_notifier (&ehci->reboot_notifier); | ||
385 | 383 | ||
386 | remove_debug_files (ehci); | 384 | remove_debug_files (ehci); |
387 | 385 | ||
@@ -483,9 +481,6 @@ static int ehci_init(struct usb_hcd *hcd) | |||
483 | } | 481 | } |
484 | ehci->command = temp; | 482 | ehci->command = temp; |
485 | 483 | ||
486 | ehci->reboot_notifier.notifier_call = ehci_reboot; | ||
487 | register_reboot_notifier(&ehci->reboot_notifier); | ||
488 | |||
489 | return 0; | 484 | return 0; |
490 | } | 485 | } |
491 | 486 | ||
@@ -499,7 +494,6 @@ static int ehci_run (struct usb_hcd *hcd) | |||
499 | 494 | ||
500 | /* EHCI spec section 4.1 */ | 495 | /* EHCI spec section 4.1 */ |
501 | if ((retval = ehci_reset(ehci)) != 0) { | 496 | if ((retval = ehci_reset(ehci)) != 0) { |
502 | unregister_reboot_notifier(&ehci->reboot_notifier); | ||
503 | ehci_mem_cleanup(ehci); | 497 | ehci_mem_cleanup(ehci); |
504 | return retval; | 498 | return retval; |
505 | } | 499 | } |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 6967ab71e282..e6a3bcddd55b 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -338,6 +338,7 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
338 | .resume = ehci_pci_resume, | 338 | .resume = ehci_pci_resume, |
339 | #endif | 339 | #endif |
340 | .stop = ehci_stop, | 340 | .stop = ehci_stop, |
341 | .shutdown = ehci_shutdown, | ||
341 | 342 | ||
342 | /* | 343 | /* |
343 | * managing i/o requests and associated device resources | 344 | * managing i/o requests and associated device resources |
@@ -384,4 +385,5 @@ static struct pci_driver ehci_pci_driver = { | |||
384 | .suspend = usb_hcd_pci_suspend, | 385 | .suspend = usb_hcd_pci_suspend, |
385 | .resume = usb_hcd_pci_resume, | 386 | .resume = usb_hcd_pci_resume, |
386 | #endif | 387 | #endif |
388 | .shutdown = usb_hcd_pci_shutdown, | ||
387 | }; | 389 | }; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 679c1cdcc915..1385ce2b3f0a 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -82,7 +82,6 @@ struct ehci_hcd { /* one per controller */ | |||
82 | struct dma_pool *sitd_pool; /* sitd per split iso urb */ | 82 | struct dma_pool *sitd_pool; /* sitd per split iso urb */ |
83 | 83 | ||
84 | struct timer_list watchdog; | 84 | struct timer_list watchdog; |
85 | struct notifier_block reboot_notifier; | ||
86 | unsigned long actions; | 85 | unsigned long actions; |
87 | unsigned stamp; | 86 | unsigned stamp; |
88 | unsigned long next_statechange; | 87 | unsigned long next_statechange; |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 33b75087bc0c..5a5bdf374d76 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -221,6 +221,7 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
221 | */ | 221 | */ |
222 | .start = ohci_at91_start, | 222 | .start = ohci_at91_start, |
223 | .stop = ohci_stop, | 223 | .stop = ohci_stop, |
224 | .shutdown = ohci_shutdown, | ||
224 | 225 | ||
225 | /* | 226 | /* |
226 | * managing i/o requests and associated device resources | 227 | * managing i/o requests and associated device resources |
@@ -310,6 +311,7 @@ MODULE_ALIAS("at91_ohci"); | |||
310 | static struct platform_driver ohci_hcd_at91_driver = { | 311 | static struct platform_driver ohci_hcd_at91_driver = { |
311 | .probe = ohci_hcd_at91_drv_probe, | 312 | .probe = ohci_hcd_at91_drv_probe, |
312 | .remove = ohci_hcd_at91_drv_remove, | 313 | .remove = ohci_hcd_at91_drv_remove, |
314 | .shutdown = usb_hcd_platform_shutdown, | ||
313 | .suspend = ohci_hcd_at91_drv_suspend, | 315 | .suspend = ohci_hcd_at91_drv_suspend, |
314 | .resume = ohci_hcd_at91_drv_resume, | 316 | .resume = ohci_hcd_at91_drv_resume, |
315 | .driver = { | 317 | .driver = { |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 44ed3a4c01ef..24e23c5783d8 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -269,6 +269,7 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
269 | */ | 269 | */ |
270 | .start = ohci_au1xxx_start, | 270 | .start = ohci_au1xxx_start, |
271 | .stop = ohci_stop, | 271 | .stop = ohci_stop, |
272 | .shutdown = ohci_shutdown, | ||
272 | 273 | ||
273 | /* | 274 | /* |
274 | * managing i/o requests and associated device resources | 275 | * managing i/o requests and associated device resources |
@@ -335,6 +336,7 @@ static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev) | |||
335 | static struct platform_driver ohci_hcd_au1xxx_driver = { | 336 | static struct platform_driver ohci_hcd_au1xxx_driver = { |
336 | .probe = ohci_hcd_au1xxx_drv_probe, | 337 | .probe = ohci_hcd_au1xxx_drv_probe, |
337 | .remove = ohci_hcd_au1xxx_drv_remove, | 338 | .remove = ohci_hcd_au1xxx_drv_remove, |
339 | .shutdown = usb_hcd_platform_shutdown, | ||
338 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ | 340 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ |
339 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ | 341 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ |
340 | .driver = { | 342 | .driver = { |
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 1a1d320b7995..1bf5e7a4e735 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -128,6 +128,7 @@ static struct hc_driver ohci_ep93xx_hc_driver = { | |||
128 | .flags = HCD_USB11 | HCD_MEMORY, | 128 | .flags = HCD_USB11 | HCD_MEMORY, |
129 | .start = ohci_ep93xx_start, | 129 | .start = ohci_ep93xx_start, |
130 | .stop = ohci_stop, | 130 | .stop = ohci_stop, |
131 | .shutdown = ohci_shutdown, | ||
131 | .urb_enqueue = ohci_urb_enqueue, | 132 | .urb_enqueue = ohci_urb_enqueue, |
132 | .urb_dequeue = ohci_urb_dequeue, | 133 | .urb_dequeue = ohci_urb_dequeue, |
133 | .endpoint_disable = ohci_endpoint_disable, | 134 | .endpoint_disable = ohci_endpoint_disable, |
@@ -203,6 +204,7 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) | |||
203 | static struct platform_driver ohci_hcd_ep93xx_driver = { | 204 | static struct platform_driver ohci_hcd_ep93xx_driver = { |
204 | .probe = ohci_hcd_ep93xx_drv_probe, | 205 | .probe = ohci_hcd_ep93xx_drv_probe, |
205 | .remove = ohci_hcd_ep93xx_drv_remove, | 206 | .remove = ohci_hcd_ep93xx_drv_remove, |
207 | .shutdown = usb_hcd_platform_shutdown, | ||
206 | #ifdef CONFIG_PM | 208 | #ifdef CONFIG_PM |
207 | .suspend = ohci_hcd_ep93xx_drv_suspend, | 209 | .suspend = ohci_hcd_ep93xx_drv_suspend, |
208 | .resume = ohci_hcd_ep93xx_drv_resume, | 210 | .resume = ohci_hcd_ep93xx_drv_resume, |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 7c3d8c60a60f..2c614af8f733 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -136,7 +136,6 @@ static const char hcd_name [] = "ohci_hcd"; | |||
136 | static void ohci_dump (struct ohci_hcd *ohci, int verbose); | 136 | static void ohci_dump (struct ohci_hcd *ohci, int verbose); |
137 | static int ohci_init (struct ohci_hcd *ohci); | 137 | static int ohci_init (struct ohci_hcd *ohci); |
138 | static void ohci_stop (struct usb_hcd *hcd); | 138 | static void ohci_stop (struct usb_hcd *hcd); |
139 | static int ohci_reboot (struct notifier_block *, unsigned long , void *); | ||
140 | 139 | ||
141 | #include "ohci-hub.c" | 140 | #include "ohci-hub.c" |
142 | #include "ohci-dbg.c" | 141 | #include "ohci-dbg.c" |
@@ -419,21 +418,20 @@ static void ohci_usb_reset (struct ohci_hcd *ohci) | |||
419 | ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); | 418 | ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); |
420 | } | 419 | } |
421 | 420 | ||
422 | /* reboot notifier forcibly disables IRQs and DMA, helping kexec and | 421 | /* ohci_shutdown forcibly disables IRQs and DMA, helping kexec and |
423 | * other cases where the next software may expect clean state from the | 422 | * other cases where the next software may expect clean state from the |
424 | * "firmware". this is bus-neutral, unlike shutdown() methods. | 423 | * "firmware". this is bus-neutral, unlike shutdown() methods. |
425 | */ | 424 | */ |
426 | static int | 425 | static void |
427 | ohci_reboot (struct notifier_block *block, unsigned long code, void *null) | 426 | ohci_shutdown (struct usb_hcd *hcd) |
428 | { | 427 | { |
429 | struct ohci_hcd *ohci; | 428 | struct ohci_hcd *ohci; |
430 | 429 | ||
431 | ohci = container_of (block, struct ohci_hcd, reboot_notifier); | 430 | ohci = hcd_to_ohci (hcd); |
432 | ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); | 431 | ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); |
433 | ohci_usb_reset (ohci); | 432 | ohci_usb_reset (ohci); |
434 | /* flush the writes */ | 433 | /* flush the writes */ |
435 | (void) ohci_readl (ohci, &ohci->regs->control); | 434 | (void) ohci_readl (ohci, &ohci->regs->control); |
436 | return 0; | ||
437 | } | 435 | } |
438 | 436 | ||
439 | /*-------------------------------------------------------------------------* | 437 | /*-------------------------------------------------------------------------* |
@@ -504,7 +502,6 @@ static int ohci_init (struct ohci_hcd *ohci) | |||
504 | if ((ret = ohci_mem_init (ohci)) < 0) | 502 | if ((ret = ohci_mem_init (ohci)) < 0) |
505 | ohci_stop (hcd); | 503 | ohci_stop (hcd); |
506 | else { | 504 | else { |
507 | register_reboot_notifier (&ohci->reboot_notifier); | ||
508 | create_debug_files (ohci); | 505 | create_debug_files (ohci); |
509 | } | 506 | } |
510 | 507 | ||
@@ -800,7 +797,6 @@ static void ohci_stop (struct usb_hcd *hcd) | |||
800 | ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); | 797 | ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); |
801 | 798 | ||
802 | remove_debug_files (ohci); | 799 | remove_debug_files (ohci); |
803 | unregister_reboot_notifier (&ohci->reboot_notifier); | ||
804 | ohci_mem_cleanup (ohci); | 800 | ohci_mem_cleanup (ohci); |
805 | if (ohci->hcca) { | 801 | if (ohci->hcca) { |
806 | dma_free_coherent (hcd->self.controller, | 802 | dma_free_coherent (hcd->self.controller, |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index f2c9161d6d6a..e121d97ed91c 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
@@ -174,6 +174,7 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { | |||
174 | */ | 174 | */ |
175 | .start = ohci_lh7a404_start, | 175 | .start = ohci_lh7a404_start, |
176 | .stop = ohci_stop, | 176 | .stop = ohci_stop, |
177 | .shutdown = ohci_shutdown, | ||
177 | 178 | ||
178 | /* | 179 | /* |
179 | * managing i/o requests and associated device resources | 180 | * managing i/o requests and associated device resources |
@@ -241,6 +242,7 @@ static int ohci_hcd_lh7a404_drv_resume(struct platform_device *dev) | |||
241 | static struct platform_driver ohci_hcd_lh7a404_driver = { | 242 | static struct platform_driver ohci_hcd_lh7a404_driver = { |
242 | .probe = ohci_hcd_lh7a404_drv_probe, | 243 | .probe = ohci_hcd_lh7a404_drv_probe, |
243 | .remove = ohci_hcd_lh7a404_drv_remove, | 244 | .remove = ohci_hcd_lh7a404_drv_remove, |
245 | .shutdown = usb_hcd_platform_shutdown, | ||
244 | /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ | 246 | /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ |
245 | /*.resume = ohci_hcd_lh7a404_drv_resume, */ | 247 | /*.resume = ohci_hcd_lh7a404_drv_resume, */ |
246 | .driver = { | 248 | .driver = { |
diff --git a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c index bfbe328a4788..d976614eebd3 100644 --- a/drivers/usb/host/ohci-mem.c +++ b/drivers/usb/host/ohci-mem.c | |||
@@ -28,7 +28,6 @@ static void ohci_hcd_init (struct ohci_hcd *ohci) | |||
28 | ohci->next_statechange = jiffies; | 28 | ohci->next_statechange = jiffies; |
29 | spin_lock_init (&ohci->lock); | 29 | spin_lock_init (&ohci->lock); |
30 | INIT_LIST_HEAD (&ohci->pending); | 30 | INIT_LIST_HEAD (&ohci->pending); |
31 | ohci->reboot_notifier.notifier_call = ohci_reboot; | ||
32 | } | 31 | } |
33 | 32 | ||
34 | /*-------------------------------------------------------------------------*/ | 33 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 160cd4c58a03..9c02177de50a 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -447,6 +447,7 @@ static const struct hc_driver ohci_omap_hc_driver = { | |||
447 | .reset = ohci_omap_init, | 447 | .reset = ohci_omap_init, |
448 | .start = ohci_omap_start, | 448 | .start = ohci_omap_start, |
449 | .stop = ohci_omap_stop, | 449 | .stop = ohci_omap_stop, |
450 | .shutdown = ohci_shutdown, | ||
450 | 451 | ||
451 | /* | 452 | /* |
452 | * managing i/o requests and associated device resources | 453 | * managing i/o requests and associated device resources |
@@ -532,6 +533,7 @@ static int ohci_omap_resume(struct platform_device *dev) | |||
532 | static struct platform_driver ohci_hcd_omap_driver = { | 533 | static struct platform_driver ohci_hcd_omap_driver = { |
533 | .probe = ohci_hcd_omap_drv_probe, | 534 | .probe = ohci_hcd_omap_drv_probe, |
534 | .remove = ohci_hcd_omap_drv_remove, | 535 | .remove = ohci_hcd_omap_drv_remove, |
536 | .shutdown = usb_hcd_platform_shutdown, | ||
535 | #ifdef CONFIG_PM | 537 | #ifdef CONFIG_PM |
536 | .suspend = ohci_omap_suspend, | 538 | .suspend = ohci_omap_suspend, |
537 | .resume = ohci_omap_resume, | 539 | .resume = ohci_omap_resume, |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index ef874443aa9f..3732db7d68eb 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -177,6 +177,7 @@ static const struct hc_driver ohci_pci_hc_driver = { | |||
177 | .reset = ohci_pci_reset, | 177 | .reset = ohci_pci_reset, |
178 | .start = ohci_pci_start, | 178 | .start = ohci_pci_start, |
179 | .stop = ohci_stop, | 179 | .stop = ohci_stop, |
180 | .shutdown = ohci_shutdown, | ||
180 | 181 | ||
181 | #ifdef CONFIG_PM | 182 | #ifdef CONFIG_PM |
182 | /* these suspend/resume entries are for upstream PCI glue ONLY */ | 183 | /* these suspend/resume entries are for upstream PCI glue ONLY */ |
@@ -232,6 +233,8 @@ static struct pci_driver ohci_pci_driver = { | |||
232 | .suspend = usb_hcd_pci_suspend, | 233 | .suspend = usb_hcd_pci_suspend, |
233 | .resume = usb_hcd_pci_resume, | 234 | .resume = usb_hcd_pci_resume, |
234 | #endif | 235 | #endif |
236 | |||
237 | .shutdown = usb_hcd_pci_shutdown, | ||
235 | }; | 238 | }; |
236 | 239 | ||
237 | 240 | ||
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 270aaaad8c6d..d9d1ae236bd5 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
@@ -148,6 +148,7 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { | |||
148 | */ | 148 | */ |
149 | .start = ohci_ppc_soc_start, | 149 | .start = ohci_ppc_soc_start, |
150 | .stop = ohci_stop, | 150 | .stop = ohci_stop, |
151 | .shutdown = ohci_shutdown, | ||
151 | 152 | ||
152 | /* | 153 | /* |
153 | * managing i/o requests and associated device resources | 154 | * managing i/o requests and associated device resources |
@@ -196,6 +197,7 @@ static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) | |||
196 | static struct platform_driver ohci_hcd_ppc_soc_driver = { | 197 | static struct platform_driver ohci_hcd_ppc_soc_driver = { |
197 | .probe = ohci_hcd_ppc_soc_drv_probe, | 198 | .probe = ohci_hcd_ppc_soc_drv_probe, |
198 | .remove = ohci_hcd_ppc_soc_drv_remove, | 199 | .remove = ohci_hcd_ppc_soc_drv_remove, |
200 | .shutdown = usb_hcd_platform_shutdown, | ||
199 | #ifdef CONFIG_PM | 201 | #ifdef CONFIG_PM |
200 | /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ | 202 | /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ |
201 | /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ | 203 | /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 2752d36c2a78..e176b04d7aeb 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -270,6 +270,7 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { | |||
270 | */ | 270 | */ |
271 | .start = ohci_pxa27x_start, | 271 | .start = ohci_pxa27x_start, |
272 | .stop = ohci_stop, | 272 | .stop = ohci_stop, |
273 | .shutdown = ohci_shutdown, | ||
273 | 274 | ||
274 | /* | 275 | /* |
275 | * managing i/o requests and associated device resources | 276 | * managing i/o requests and associated device resources |
@@ -358,6 +359,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) | |||
358 | static struct platform_driver ohci_hcd_pxa27x_driver = { | 359 | static struct platform_driver ohci_hcd_pxa27x_driver = { |
359 | .probe = ohci_hcd_pxa27x_drv_probe, | 360 | .probe = ohci_hcd_pxa27x_drv_probe, |
360 | .remove = ohci_hcd_pxa27x_drv_remove, | 361 | .remove = ohci_hcd_pxa27x_drv_remove, |
362 | .shutdown = usb_hcd_platform_shutdown, | ||
361 | #ifdef CONFIG_PM | 363 | #ifdef CONFIG_PM |
362 | .suspend = ohci_hcd_pxa27x_drv_suspend, | 364 | .suspend = ohci_hcd_pxa27x_drv_suspend, |
363 | .resume = ohci_hcd_pxa27x_drv_resume, | 365 | .resume = ohci_hcd_pxa27x_drv_resume, |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index cd37eddf7d42..59e436424d41 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -447,6 +447,7 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { | |||
447 | */ | 447 | */ |
448 | .start = ohci_s3c2410_start, | 448 | .start = ohci_s3c2410_start, |
449 | .stop = ohci_stop, | 449 | .stop = ohci_stop, |
450 | .shutdown = ohci_shutdown, | ||
450 | 451 | ||
451 | /* | 452 | /* |
452 | * managing i/o requests and associated device resources | 453 | * managing i/o requests and associated device resources |
@@ -491,6 +492,7 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev) | |||
491 | static struct platform_driver ohci_hcd_s3c2410_driver = { | 492 | static struct platform_driver ohci_hcd_s3c2410_driver = { |
492 | .probe = ohci_hcd_s3c2410_drv_probe, | 493 | .probe = ohci_hcd_s3c2410_drv_probe, |
493 | .remove = ohci_hcd_s3c2410_drv_remove, | 494 | .remove = ohci_hcd_s3c2410_drv_remove, |
495 | .shutdown = usb_hcd_platform_shutdown, | ||
494 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ | 496 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ |
495 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ | 497 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ |
496 | .driver = { | 498 | .driver = { |
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index caacf14371f5..650d1bf21c1d 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -389,8 +389,6 @@ struct ohci_hcd { | |||
389 | unsigned long next_statechange; /* suspend/resume */ | 389 | unsigned long next_statechange; /* suspend/resume */ |
390 | u32 fminterval; /* saved register */ | 390 | u32 fminterval; /* saved register */ |
391 | 391 | ||
392 | struct notifier_block reboot_notifier; | ||
393 | |||
394 | unsigned long flags; /* for HC bugs */ | 392 | unsigned long flags; /* for HC bugs */ |
395 | #define OHCI_QUIRK_AMD756 0x01 /* erratum #4 */ | 393 | #define OHCI_QUIRK_AMD756 0x01 /* erratum #4 */ |
396 | #define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */ | 394 | #define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */ |