aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/uhci-hcd.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-11-24 17:59:46 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-11-30 00:39:23 -0500
commit8de98402652c01839ae321be6cb3054cf5735d83 (patch)
tree6d4856ddb60be0dcd361441f0794596709553dd1 /drivers/usb/host/uhci-hcd.c
parentd3420ba4930d61f4ec4abc046765de274182b4ed (diff)
[PATCH] USB: Fix USB suspend/resume crasher (#2)
This patch closes the IRQ race and makes various other OHCI & EHCI code path safer vs. suspend/resume. I've been able to (finally !) successfully suspend and resume various Mac models, with or without USB mouse plugged, or plugging while asleep, or unplugging while asleep etc... all without a crash. Alan, please verify the UHCI bit I did, I only verified that it builds. It's very simple so I wouldn't expect any issue there. If you aren't confident, then just drop the hunks that change uhci-hcd.c I also made the patch a little bit more "safer" by making sure the store to the interrupt register that disables interrupts is not posted before I set the flag and drop the spinlock. Without this patch, you cannot reliably sleep/wakeup any recent Mac, and I suspect PCs have some more sneaky issues too (they don't frankly crash with machine checks because x86 tend to silently swallow PCI errors but that won't last afaik, at least PCI Express will blow up in those situations, but the USB code may still misbehave). Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/uhci-hcd.c')
-rw-r--r--drivers/usb/host/uhci-hcd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index d33ce3982a5f..ed550132db0b 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -717,6 +717,7 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
717 * at the source, so we must turn off PIRQ. 717 * at the source, so we must turn off PIRQ.
718 */ 718 */
719 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); 719 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
720 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
720 uhci->hc_inaccessible = 1; 721 uhci->hc_inaccessible = 1;
721 hcd->poll_rh = 0; 722 hcd->poll_rh = 0;
722 723
@@ -733,6 +734,11 @@ static int uhci_resume(struct usb_hcd *hcd)
733 734
734 dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); 735 dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__);
735 736
737 /* We aren't in D3 state anymore, we do that even if dead as I
738 * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0
739 */
740 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
741
736 if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ 742 if (uhci->rh_state == UHCI_RH_RESET) /* Dead */
737 return 0; 743 return 0;
738 spin_lock_irq(&uhci->lock); 744 spin_lock_irq(&uhci->lock);