aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/uhci-hcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/uhci-hcd.c')
-rw-r--r--drivers/usb/host/uhci-hcd.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index ec987897b8ed..d3e0d8aa3980 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -262,20 +262,12 @@ __acquires(uhci->lock)
262{ 262{
263 int auto_stop; 263 int auto_stop;
264 int int_enable, egsm_enable; 264 int int_enable, egsm_enable;
265 struct usb_device *rhdev = uhci_to_hcd(uhci)->self.root_hub;
265 266
266 auto_stop = (new_state == UHCI_RH_AUTO_STOPPED); 267 auto_stop = (new_state == UHCI_RH_AUTO_STOPPED);
267 dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev, 268 dev_dbg(&rhdev->dev, "%s%s\n", __func__,
268 "%s%s\n", __FUNCTION__,
269 (auto_stop ? " (auto-stop)" : "")); 269 (auto_stop ? " (auto-stop)" : ""));
270 270
271 /* If we get a suspend request when we're already auto-stopped
272 * then there's nothing to do.
273 */
274 if (uhci->rh_state == UHCI_RH_AUTO_STOPPED) {
275 uhci->rh_state = new_state;
276 return;
277 }
278
279 /* Enable resume-detect interrupts if they work. 271 /* Enable resume-detect interrupts if they work.
280 * Then enter Global Suspend mode if _it_ works, still configured. 272 * Then enter Global Suspend mode if _it_ works, still configured.
281 */ 273 */
@@ -285,8 +277,10 @@ __acquires(uhci->lock)
285 if (remote_wakeup_is_broken(uhci)) 277 if (remote_wakeup_is_broken(uhci))
286 egsm_enable = 0; 278 egsm_enable = 0;
287 if (resume_detect_interrupts_are_broken(uhci) || !egsm_enable || 279 if (resume_detect_interrupts_are_broken(uhci) || !egsm_enable ||
288 !device_may_wakeup( 280#ifdef CONFIG_PM
289 &uhci_to_hcd(uhci)->self.root_hub->dev)) 281 (!auto_stop && !rhdev->do_remote_wakeup) ||
282#endif
283 (auto_stop && !device_may_wakeup(&rhdev->dev)))
290 uhci->working_RD = int_enable = 0; 284 uhci->working_RD = int_enable = 0;
291 285
292 outw(int_enable, uhci->io_addr + USBINTR); 286 outw(int_enable, uhci->io_addr + USBINTR);
@@ -308,8 +302,7 @@ __acquires(uhci->lock)
308 return; 302 return;
309 } 303 }
310 if (!(inw(uhci->io_addr + USBSTS) & USBSTS_HCH)) 304 if (!(inw(uhci->io_addr + USBSTS) & USBSTS_HCH))
311 dev_warn(&uhci_to_hcd(uhci)->self.root_hub->dev, 305 dev_warn(uhci_dev(uhci), "Controller not stopped yet!\n");
312 "Controller not stopped yet!\n");
313 306
314 uhci_get_current_frame_number(uhci); 307 uhci_get_current_frame_number(uhci);
315 308
@@ -342,7 +335,7 @@ __releases(uhci->lock)
342__acquires(uhci->lock) 335__acquires(uhci->lock)
343{ 336{
344 dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev, 337 dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev,
345 "%s%s\n", __FUNCTION__, 338 "%s%s\n", __func__,
346 uhci->rh_state == UHCI_RH_AUTO_STOPPED ? 339 uhci->rh_state == UHCI_RH_AUTO_STOPPED ?
347 " (auto-start)" : ""); 340 " (auto-start)" : "");
348 341
@@ -737,12 +730,12 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
737 return rc; 730 return rc;
738} 731}
739 732
740static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) 733static int uhci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
741{ 734{
742 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 735 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
743 int rc = 0; 736 int rc = 0;
744 737
745 dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); 738 dev_dbg(uhci_dev(uhci), "%s\n", __func__);
746 739
747 spin_lock_irq(&uhci->lock); 740 spin_lock_irq(&uhci->lock);
748 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead) 741 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead)
@@ -774,11 +767,11 @@ done:
774 return rc; 767 return rc;
775} 768}
776 769
777static int uhci_resume(struct usb_hcd *hcd) 770static int uhci_pci_resume(struct usb_hcd *hcd)
778{ 771{
779 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 772 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
780 773
781 dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__); 774 dev_dbg(uhci_dev(uhci), "%s\n", __func__);
782 775
783 /* Since we aren't in D3 any more, it's safe to set this flag 776 /* Since we aren't in D3 any more, it's safe to set this flag
784 * even if the controller was dead. 777 * even if the controller was dead.
@@ -872,8 +865,8 @@ static const struct hc_driver uhci_driver = {
872 .reset = uhci_init, 865 .reset = uhci_init,
873 .start = uhci_start, 866 .start = uhci_start,
874#ifdef CONFIG_PM 867#ifdef CONFIG_PM
875 .suspend = uhci_suspend, 868 .pci_suspend = uhci_pci_suspend,
876 .resume = uhci_resume, 869 .pci_resume = uhci_pci_resume,
877 .bus_suspend = uhci_rh_suspend, 870 .bus_suspend = uhci_rh_suspend,
878 .bus_resume = uhci_rh_resume, 871 .bus_resume = uhci_rh_resume,
879#endif 872#endif