aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-06-22 16:39:10 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 17:35:37 -0400
commit541c7d432f76771079e7c295d596ea47cc6a3030 (patch)
tree9e04330713366d21849cecf0f3fd2f2c1834574d /drivers/usb/host
parent89ba85d4015b7fa738b35bcc228075c117a9a578 (diff)
USB: convert usb_hcd bitfields into atomic flags
This patch (as1393) converts several of the single-bit fields in struct usb_hcd to atomic flags. This is for safety's sake; not all CPUs can update bitfield values atomically, and these flags are used in multiple contexts. The flag fields that are set only during registration or removal can remain as they are, since non-atomic accesses at those times will not cause any problems. (Strictly speaking, the authorized_default flag should become atomic as well. I didn't bother with it because it gets changed only via sysfs. It can be done later, if anyone wants.) Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ehci-hcd.c1
-rw-r--r--drivers/usb/host/ehci-hub.c2
-rw-r--r--drivers/usb/host/ehci-q.c3
-rw-r--r--drivers/usb/host/ehci-sched.c9
-rw-r--r--drivers/usb/host/hwa-hc.c4
-rw-r--r--drivers/usb/host/isp1760-hcd.c3
-rw-r--r--drivers/usb/host/ohci-dbg.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c6
-rw-r--r--drivers/usb/host/ohci-hub.c16
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c7
-rw-r--r--drivers/usb/host/uhci-hcd.c21
-rw-r--r--drivers/usb/host/uhci-hub.c4
-rw-r--r--drivers/usb/host/whci/hcd.c2
-rw-r--r--drivers/usb/host/xhci.c3
15 files changed, 42 insertions, 45 deletions
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index df5546bb8367..4498efb49b95 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -712,7 +712,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
712 712
713 spin_lock_irqsave (&ehci->lock, flags); 713 spin_lock_irqsave (&ehci->lock, flags);
714 714
715 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 715 if (!HCD_HW_ACCESSIBLE(hcd)) {
716 size = scnprintf (next, size, 716 size = scnprintf (next, size,
717 "bus %s, device %s\n" 717 "bus %s, device %s\n"
718 "%s\n" 718 "%s\n"
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 8697ad19f313..2a19336c9824 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -642,7 +642,6 @@ static int ehci_run (struct usb_hcd *hcd)
642 u32 hcc_params; 642 u32 hcc_params;
643 643
644 hcd->uses_new_polling = 1; 644 hcd->uses_new_polling = 1;
645 hcd->poll_rh = 0;
646 645
647 /* EHCI spec section 4.1 */ 646 /* EHCI spec section 4.1 */
648 if ((retval = ehci_reset(ehci)) != 0) { 647 if ((retval = ehci_reset(ehci)) != 0) {
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 84e792d71c22..0931f5a7dec4 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -316,7 +316,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
316 if (time_before (jiffies, ehci->next_statechange)) 316 if (time_before (jiffies, ehci->next_statechange))
317 msleep(5); 317 msleep(5);
318 spin_lock_irq (&ehci->lock); 318 spin_lock_irq (&ehci->lock);
319 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 319 if (!HCD_HW_ACCESSIBLE(hcd)) {
320 spin_unlock_irq(&ehci->lock); 320 spin_unlock_irq(&ehci->lock);
321 return -ESHUTDOWN; 321 return -ESHUTDOWN;
322 } 322 }
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 11a79c4f4a9d..233c288e3f93 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -1126,8 +1126,7 @@ submit_async (
1126#endif 1126#endif
1127 1127
1128 spin_lock_irqsave (&ehci->lock, flags); 1128 spin_lock_irqsave (&ehci->lock, flags);
1129 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 1129 if (unlikely(!HCD_HW_ACCESSIBLE(ehci_to_hcd(ehci)))) {
1130 &ehci_to_hcd(ehci)->flags))) {
1131 rc = -ESHUTDOWN; 1130 rc = -ESHUTDOWN;
1132 goto done; 1131 goto done;
1133 } 1132 }
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 805ec633a652..d640346f9b56 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -880,8 +880,7 @@ static int intr_submit (
880 880
881 spin_lock_irqsave (&ehci->lock, flags); 881 spin_lock_irqsave (&ehci->lock, flags);
882 882
883 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 883 if (unlikely(!HCD_HW_ACCESSIBLE(ehci_to_hcd(ehci)))) {
884 &ehci_to_hcd(ehci)->flags))) {
885 status = -ESHUTDOWN; 884 status = -ESHUTDOWN;
886 goto done_not_linked; 885 goto done_not_linked;
887 } 886 }
@@ -1815,8 +1814,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb,
1815 1814
1816 /* schedule ... need to lock */ 1815 /* schedule ... need to lock */
1817 spin_lock_irqsave (&ehci->lock, flags); 1816 spin_lock_irqsave (&ehci->lock, flags);
1818 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 1817 if (unlikely(!HCD_HW_ACCESSIBLE(ehci_to_hcd(ehci)))) {
1819 &ehci_to_hcd(ehci)->flags))) {
1820 status = -ESHUTDOWN; 1818 status = -ESHUTDOWN;
1821 goto done_not_linked; 1819 goto done_not_linked;
1822 } 1820 }
@@ -2201,8 +2199,7 @@ static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb,
2201 2199
2202 /* schedule ... need to lock */ 2200 /* schedule ... need to lock */
2203 spin_lock_irqsave (&ehci->lock, flags); 2201 spin_lock_irqsave (&ehci->lock, flags);
2204 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 2202 if (unlikely(!HCD_HW_ACCESSIBLE(ehci_to_hcd(ehci)))) {
2205 &ehci_to_hcd(ehci)->flags))) {
2206 status = -ESHUTDOWN; 2203 status = -ESHUTDOWN;
2207 goto done_not_linked; 2204 goto done_not_linked;
2208 } 2205 }
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index 35742f8c7cda..9bfac657572e 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -159,7 +159,7 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
159 goto error_set_cluster_id; 159 goto error_set_cluster_id;
160 160
161 usb_hcd->uses_new_polling = 1; 161 usb_hcd->uses_new_polling = 1;
162 usb_hcd->poll_rh = 1; 162 set_bit(HCD_FLAG_POLL_RH, &usb_hcd->flags);
163 usb_hcd->state = HC_STATE_RUNNING; 163 usb_hcd->state = HC_STATE_RUNNING;
164 result = 0; 164 result = 0;
165out: 165out:
@@ -776,7 +776,7 @@ static int hwahc_probe(struct usb_interface *usb_iface,
776 goto error_alloc; 776 goto error_alloc;
777 } 777 }
778 usb_hcd->wireless = 1; 778 usb_hcd->wireless = 1;
779 usb_hcd->flags |= HCD_FLAG_SAW_IRQ; 779 set_bit(HCD_FLAG_SAW_IRQ, &usb_hcd->flags);
780 wusbhc = usb_hcd_to_wusbhc(usb_hcd); 780 wusbhc = usb_hcd_to_wusbhc(usb_hcd);
781 hwahc = container_of(wusbhc, struct hwahc, wusbhc); 781 hwahc = container_of(wusbhc, struct hwahc, wusbhc);
782 hwahc_init(hwahc); 782 hwahc_init(hwahc);
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index dbcafa29c775..d1a3dfc9a408 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -482,7 +482,6 @@ static int isp1760_run(struct usb_hcd *hcd)
482 u32 chipid; 482 u32 chipid;
483 483
484 hcd->uses_new_polling = 1; 484 hcd->uses_new_polling = 1;
485 hcd->poll_rh = 0;
486 485
487 hcd->state = HC_STATE_RUNNING; 486 hcd->state = HC_STATE_RUNNING;
488 isp1760_enable_interrupts(hcd); 487 isp1760_enable_interrupts(hcd);
@@ -1450,7 +1449,7 @@ static int isp1760_prepare_enqueue(struct isp1760_hcd *priv, struct urb *urb,
1450 epnum = urb->ep->desc.bEndpointAddress; 1449 epnum = urb->ep->desc.bEndpointAddress;
1451 1450
1452 spin_lock_irqsave(&priv->lock, flags); 1451 spin_lock_irqsave(&priv->lock, flags);
1453 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &priv_to_hcd(priv)->flags)) { 1452 if (!HCD_HW_ACCESSIBLE(priv_to_hcd(priv))) {
1454 rc = -ESHUTDOWN; 1453 rc = -ESHUTDOWN;
1455 goto done; 1454 goto done;
1456 } 1455 }
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 8ad2441b0284..36abd2baa3ea 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -645,7 +645,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
645 hcd->product_desc, 645 hcd->product_desc,
646 hcd_name); 646 hcd_name);
647 647
648 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 648 if (!HCD_HW_ACCESSIBLE(hcd)) {
649 size -= scnprintf (next, size, 649 size -= scnprintf (next, size,
650 "SUSPENDED (no register access)\n"); 650 "SUSPENDED (no register access)\n");
651 goto done; 651 goto done;
@@ -687,7 +687,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
687 next += temp; 687 next += temp;
688 688
689 temp = scnprintf (next, size, "hub poll timer %s\n", 689 temp = scnprintf (next, size, "hub poll timer %s\n",
690 ohci_to_hcd(ohci)->poll_rh ? "ON" : "off"); 690 HCD_POLL_RH(ohci_to_hcd(ohci)) ? "ON" : "off");
691 size -= temp; 691 size -= temp;
692 next += temp; 692 next += temp;
693 693
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 02864a237a2c..c3b4ccc7337b 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -212,7 +212,7 @@ static int ohci_urb_enqueue (
212 spin_lock_irqsave (&ohci->lock, flags); 212 spin_lock_irqsave (&ohci->lock, flags);
213 213
214 /* don't submit to a dead HC */ 214 /* don't submit to a dead HC */
215 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 215 if (!HCD_HW_ACCESSIBLE(hcd)) {
216 retval = -ENODEV; 216 retval = -ENODEV;
217 goto fail; 217 goto fail;
218 } 218 }
@@ -685,7 +685,7 @@ retry:
685 } 685 }
686 686
687 /* use rhsc irqs after khubd is fully initialized */ 687 /* use rhsc irqs after khubd is fully initialized */
688 hcd->poll_rh = 1; 688 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
689 hcd->uses_new_polling = 1; 689 hcd->uses_new_polling = 1;
690 690
691 /* start controller operations */ 691 /* start controller operations */
@@ -822,7 +822,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
822 else if (ints & OHCI_INTR_RD) { 822 else if (ints & OHCI_INTR_RD) {
823 ohci_vdbg(ohci, "resume detect\n"); 823 ohci_vdbg(ohci, "resume detect\n");
824 ohci_writel(ohci, OHCI_INTR_RD, &regs->intrstatus); 824 ohci_writel(ohci, OHCI_INTR_RD, &regs->intrstatus);
825 hcd->poll_rh = 1; 825 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
826 if (ohci->autostop) { 826 if (ohci->autostop) {
827 spin_lock (&ohci->lock); 827 spin_lock (&ohci->lock);
828 ohci_rh_resume (ohci); 828 ohci_rh_resume (ohci);
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 65cac8cc8921..4dd39022c388 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -284,7 +284,7 @@ static int ohci_bus_suspend (struct usb_hcd *hcd)
284 284
285 spin_lock_irq (&ohci->lock); 285 spin_lock_irq (&ohci->lock);
286 286
287 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) 287 if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
288 rc = -ESHUTDOWN; 288 rc = -ESHUTDOWN;
289 else 289 else
290 rc = ohci_rh_suspend (ohci, 0); 290 rc = ohci_rh_suspend (ohci, 0);
@@ -302,7 +302,7 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
302 302
303 spin_lock_irq (&ohci->lock); 303 spin_lock_irq (&ohci->lock);
304 304
305 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) 305 if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
306 rc = -ESHUTDOWN; 306 rc = -ESHUTDOWN;
307 else 307 else
308 rc = ohci_rh_resume (ohci); 308 rc = ohci_rh_resume (ohci);
@@ -489,7 +489,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
489 unsigned long flags; 489 unsigned long flags;
490 490
491 spin_lock_irqsave (&ohci->lock, flags); 491 spin_lock_irqsave (&ohci->lock, flags);
492 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) 492 if (!HCD_HW_ACCESSIBLE(hcd))
493 goto done; 493 goto done;
494 494
495 /* undocumented erratum seen on at least rev D */ 495 /* undocumented erratum seen on at least rev D */
@@ -533,8 +533,12 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
533 } 533 }
534 } 534 }
535 535
536 hcd->poll_rh = ohci_root_hub_state_changes(ohci, changed, 536 if (ohci_root_hub_state_changes(ohci, changed,
537 any_connected, rhsc_status); 537 any_connected, rhsc_status))
538 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
539 else
540 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
541
538 542
539done: 543done:
540 spin_unlock_irqrestore (&ohci->lock, flags); 544 spin_unlock_irqrestore (&ohci->lock, flags);
@@ -701,7 +705,7 @@ static int ohci_hub_control (
701 u32 temp; 705 u32 temp;
702 int retval = 0; 706 int retval = 0;
703 707
704 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) 708 if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
705 return -ESHUTDOWN; 709 return -ESHUTDOWN;
706 710
707 switch (typeReq) { 711 switch (typeReq) {
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index f608dfd09a8a..d9c85a292737 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -1641,8 +1641,7 @@ static int submit_async(struct oxu_hcd *oxu, struct urb *urb,
1641#endif 1641#endif
1642 1642
1643 spin_lock_irqsave(&oxu->lock, flags); 1643 spin_lock_irqsave(&oxu->lock, flags);
1644 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 1644 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) {
1645 &oxu_to_hcd(oxu)->flags))) {
1646 rc = -ESHUTDOWN; 1645 rc = -ESHUTDOWN;
1647 goto done; 1646 goto done;
1648 } 1647 }
@@ -2209,8 +2208,7 @@ static int intr_submit(struct oxu_hcd *oxu, struct urb *urb,
2209 2208
2210 spin_lock_irqsave(&oxu->lock, flags); 2209 spin_lock_irqsave(&oxu->lock, flags);
2211 2210
2212 if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, 2211 if (unlikely(!HCD_HW_ACCESSIBLE(oxu_to_hcd(oxu)))) {
2213 &oxu_to_hcd(oxu)->flags))) {
2214 status = -ESHUTDOWN; 2212 status = -ESHUTDOWN;
2215 goto done; 2213 goto done;
2216 } 2214 }
@@ -2715,7 +2713,6 @@ static int oxu_run(struct usb_hcd *hcd)
2715 u32 temp, hcc_params; 2713 u32 temp, hcc_params;
2716 2714
2717 hcd->uses_new_polling = 1; 2715 hcd->uses_new_polling = 1;
2718 hcd->poll_rh = 0;
2719 2716
2720 /* EHCI spec section 4.1 */ 2717 /* EHCI spec section 4.1 */
2721 retval = ehci_reset(oxu); 2718 retval = ehci_reset(oxu);
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index d1dce2166eff..2743ec770f0c 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -140,7 +140,7 @@ static void finish_reset(struct uhci_hcd *uhci)
140 uhci->rh_state = UHCI_RH_RESET; 140 uhci->rh_state = UHCI_RH_RESET;
141 uhci->is_stopped = UHCI_IS_STOPPED; 141 uhci->is_stopped = UHCI_IS_STOPPED;
142 uhci_to_hcd(uhci)->state = HC_STATE_HALT; 142 uhci_to_hcd(uhci)->state = HC_STATE_HALT;
143 uhci_to_hcd(uhci)->poll_rh = 0; 143 clear_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);
144 144
145 uhci->dead = 0; /* Full reset resurrects the controller */ 145 uhci->dead = 0; /* Full reset resurrects the controller */
146} 146}
@@ -344,7 +344,10 @@ __acquires(uhci->lock)
344 /* If interrupts don't work and remote wakeup is enabled then 344 /* If interrupts don't work and remote wakeup is enabled then
345 * the suspended root hub needs to be polled. 345 * the suspended root hub needs to be polled.
346 */ 346 */
347 uhci_to_hcd(uhci)->poll_rh = (!int_enable && wakeup_enable); 347 if (!int_enable && wakeup_enable)
348 set_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);
349 else
350 clear_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);
348 351
349 uhci_scan_schedule(uhci); 352 uhci_scan_schedule(uhci);
350 uhci_fsbr_off(uhci); 353 uhci_fsbr_off(uhci);
@@ -363,7 +366,7 @@ static void start_rh(struct uhci_hcd *uhci)
363 uhci->io_addr + USBINTR); 366 uhci->io_addr + USBINTR);
364 mb(); 367 mb();
365 uhci->rh_state = UHCI_RH_RUNNING; 368 uhci->rh_state = UHCI_RH_RUNNING;
366 uhci_to_hcd(uhci)->poll_rh = 1; 369 set_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);
367} 370}
368 371
369static void wakeup_rh(struct uhci_hcd *uhci) 372static void wakeup_rh(struct uhci_hcd *uhci)
@@ -733,7 +736,7 @@ static void uhci_stop(struct usb_hcd *hcd)
733 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 736 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
734 737
735 spin_lock_irq(&uhci->lock); 738 spin_lock_irq(&uhci->lock);
736 if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) && !uhci->dead) 739 if (HCD_HW_ACCESSIBLE(hcd) && !uhci->dead)
737 uhci_hc_died(uhci); 740 uhci_hc_died(uhci);
738 uhci_scan_schedule(uhci); 741 uhci_scan_schedule(uhci);
739 spin_unlock_irq(&uhci->lock); 742 spin_unlock_irq(&uhci->lock);
@@ -750,7 +753,7 @@ static int uhci_rh_suspend(struct usb_hcd *hcd)
750 int rc = 0; 753 int rc = 0;
751 754
752 spin_lock_irq(&uhci->lock); 755 spin_lock_irq(&uhci->lock);
753 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) 756 if (!HCD_HW_ACCESSIBLE(hcd))
754 rc = -ESHUTDOWN; 757 rc = -ESHUTDOWN;
755 else if (uhci->dead) 758 else if (uhci->dead)
756 ; /* Dead controllers tell no tales */ 759 ; /* Dead controllers tell no tales */
@@ -777,7 +780,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
777 int rc = 0; 780 int rc = 0;
778 781
779 spin_lock_irq(&uhci->lock); 782 spin_lock_irq(&uhci->lock);
780 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) 783 if (!HCD_HW_ACCESSIBLE(hcd))
781 rc = -ESHUTDOWN; 784 rc = -ESHUTDOWN;
782 else if (!uhci->dead) 785 else if (!uhci->dead)
783 wakeup_rh(uhci); 786 wakeup_rh(uhci);
@@ -793,7 +796,7 @@ static int uhci_pci_suspend(struct usb_hcd *hcd)
793 dev_dbg(uhci_dev(uhci), "%s\n", __func__); 796 dev_dbg(uhci_dev(uhci), "%s\n", __func__);
794 797
795 spin_lock_irq(&uhci->lock); 798 spin_lock_irq(&uhci->lock);
796 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead) 799 if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
797 goto done_okay; /* Already suspended or dead */ 800 goto done_okay; /* Already suspended or dead */
798 801
799 if (uhci->rh_state > UHCI_RH_SUSPENDED) { 802 if (uhci->rh_state > UHCI_RH_SUSPENDED) {
@@ -807,7 +810,7 @@ static int uhci_pci_suspend(struct usb_hcd *hcd)
807 */ 810 */
808 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); 811 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
809 mb(); 812 mb();
810 hcd->poll_rh = 0; 813 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
811 814
812 /* FIXME: Enable non-PME# remote wakeup? */ 815 /* FIXME: Enable non-PME# remote wakeup? */
813 816
@@ -860,7 +863,7 @@ static int uhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
860 * the suspended root hub needs to be polled. 863 * the suspended root hub needs to be polled.
861 */ 864 */
862 if (!uhci->RD_enable && hcd->self.root_hub->do_remote_wakeup) { 865 if (!uhci->RD_enable && hcd->self.root_hub->do_remote_wakeup) {
863 hcd->poll_rh = 1; 866 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
864 usb_hcd_poll_rh_status(hcd); 867 usb_hcd_poll_rh_status(hcd);
865 } 868 }
866 return 0; 869 return 0;
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index 8270055848ca..f0c58116c0ad 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -190,7 +190,7 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
190 spin_lock_irqsave(&uhci->lock, flags); 190 spin_lock_irqsave(&uhci->lock, flags);
191 191
192 uhci_scan_schedule(uhci); 192 uhci_scan_schedule(uhci);
193 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead) 193 if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
194 goto done; 194 goto done;
195 uhci_check_ports(uhci); 195 uhci_check_ports(uhci);
196 196
@@ -246,7 +246,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
246 u16 wPortChange, wPortStatus; 246 u16 wPortChange, wPortStatus;
247 unsigned long flags; 247 unsigned long flags;
248 248
249 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead) 249 if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
250 return -ETIMEDOUT; 250 return -ETIMEDOUT;
251 251
252 spin_lock_irqsave(&uhci->lock, flags); 252 spin_lock_irqsave(&uhci->lock, flags);
diff --git a/drivers/usb/host/whci/hcd.c b/drivers/usb/host/whci/hcd.c
index e0d3401285c8..72b6892fda67 100644
--- a/drivers/usb/host/whci/hcd.c
+++ b/drivers/usb/host/whci/hcd.c
@@ -68,7 +68,7 @@ static int whc_start(struct usb_hcd *usb_hcd)
68 whc_write_wusbcmd(whc, WUSBCMD_RUN, WUSBCMD_RUN); 68 whc_write_wusbcmd(whc, WUSBCMD_RUN, WUSBCMD_RUN);
69 69
70 usb_hcd->uses_new_polling = 1; 70 usb_hcd->uses_new_polling = 1;
71 usb_hcd->poll_rh = 1; 71 set_bit(HCD_FLAG_POLL_RH, &usb_hcd->flags);
72 usb_hcd->state = HC_STATE_RUNNING; 72 usb_hcd->state = HC_STATE_RUNNING;
73 73
74out: 74out:
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 343f1047f5d0..5e73386b3899 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -427,7 +427,6 @@ int xhci_run(struct usb_hcd *hcd)
427 void (*doorbell)(struct xhci_hcd *) = NULL; 427 void (*doorbell)(struct xhci_hcd *) = NULL;
428 428
429 hcd->uses_new_polling = 1; 429 hcd->uses_new_polling = 1;
430 hcd->poll_rh = 0;
431 430
432 xhci_dbg(xhci, "xhci_run\n"); 431 xhci_dbg(xhci, "xhci_run\n");
433#if 0 /* FIXME: MSI not setup yet */ 432#if 0 /* FIXME: MSI not setup yet */
@@ -733,7 +732,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
733 ret = -EINVAL; 732 ret = -EINVAL;
734 goto exit; 733 goto exit;
735 } 734 }
736 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 735 if (!HCD_HW_ACCESSIBLE(hcd)) {
737 if (!in_interrupt()) 736 if (!in_interrupt())
738 xhci_dbg(xhci, "urb submitted during PCI suspend\n"); 737 xhci_dbg(xhci, "urb submitted during PCI suspend\n");
739 ret = -ESHUTDOWN; 738 ret = -ESHUTDOWN;