aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-sched.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-08-18 16:31:30 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-22 18:57:01 -0400
commite8799906045302776b35b66b16495c575db3b69c (patch)
treee6b5a76bd13ef0a9df24f7a7c8c1e924c0efcedb /drivers/usb/host/ehci-sched.c
parentdfd8c81fd1c09c740140a2334669994d5c6edcaa (diff)
USB: EHCI: remove usages of hcd->state
This patch (as1483) improves the ehci-hcd driver family by getting rid of the reliance on the hcd->state variable. It has no clear owner and it isn't protected by the usual HCD locks. In its place, the patch adds a new, private ehci->rh_state field to record the state of the root hub. Along the way, the patch removes a couple of lines containing redundant assignments to the state variable. Also, the QUIESCING state simply gets changed to the RUNNING state, because the driver doesn't make any distinction between them. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-sched.c')
-rw-r--r--drivers/usb/host/ehci-sched.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 2abf8543f083..488151bb45cb 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -479,7 +479,6 @@ static int enable_periodic (struct ehci_hcd *ehci)
479 cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; 479 cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE;
480 ehci_writel(ehci, cmd, &ehci->regs->command); 480 ehci_writel(ehci, cmd, &ehci->regs->command);
481 /* posted write ... PSS happens later */ 481 /* posted write ... PSS happens later */
482 ehci_to_hcd(ehci)->state = HC_STATE_RUNNING;
483 482
484 /* make sure ehci_work scans these */ 483 /* make sure ehci_work scans these */
485 ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) 484 ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index)
@@ -677,7 +676,7 @@ static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
677 676
678 /* reschedule QH iff another request is queued */ 677 /* reschedule QH iff another request is queued */
679 if (!list_empty(&qh->qtd_list) && 678 if (!list_empty(&qh->qtd_list) &&
680 HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) { 679 ehci->rh_state == EHCI_RH_RUNNING) {
681 rc = qh_schedule(ehci, qh); 680 rc = qh_schedule(ehci, qh);
682 681
683 /* An error here likely indicates handshake failure 682 /* An error here likely indicates handshake failure
@@ -2275,7 +2274,7 @@ scan_periodic (struct ehci_hcd *ehci)
2275 * Touches as few pages as possible: cache-friendly. 2274 * Touches as few pages as possible: cache-friendly.
2276 */ 2275 */
2277 now_uframe = ehci->next_uframe; 2276 now_uframe = ehci->next_uframe;
2278 if (HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) { 2277 if (ehci->rh_state == EHCI_RH_RUNNING) {
2279 clock = ehci_readl(ehci, &ehci->regs->frame_index); 2278 clock = ehci_readl(ehci, &ehci->regs->frame_index);
2280 clock_frame = (clock >> 3) & (ehci->periodic_size - 1); 2279 clock_frame = (clock >> 3) & (ehci->periodic_size - 1);
2281 } else { 2280 } else {
@@ -2310,7 +2309,7 @@ restart:
2310 union ehci_shadow temp; 2309 union ehci_shadow temp;
2311 int live; 2310 int live;
2312 2311
2313 live = HC_IS_RUNNING (ehci_to_hcd(ehci)->state); 2312 live = (ehci->rh_state == EHCI_RH_RUNNING);
2314 switch (hc32_to_cpu(ehci, type)) { 2313 switch (hc32_to_cpu(ehci, type)) {
2315 case Q_TYPE_QH: 2314 case Q_TYPE_QH:
2316 /* handle any completions */ 2315 /* handle any completions */
@@ -2435,7 +2434,7 @@ restart:
2435 * We can't advance our scan without collecting the ISO 2434 * We can't advance our scan without collecting the ISO
2436 * transfers that are still pending in this frame. 2435 * transfers that are still pending in this frame.
2437 */ 2436 */
2438 if (incomplete && HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) { 2437 if (incomplete && ehci->rh_state == EHCI_RH_RUNNING) {
2439 ehci->next_uframe = now_uframe; 2438 ehci->next_uframe = now_uframe;
2440 break; 2439 break;
2441 } 2440 }
@@ -2451,7 +2450,7 @@ restart:
2451 if (now_uframe == clock) { 2450 if (now_uframe == clock) {
2452 unsigned now; 2451 unsigned now;
2453 2452
2454 if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state) 2453 if (ehci->rh_state != EHCI_RH_RUNNING
2455 || ehci->periodic_sched == 0) 2454 || ehci->periodic_sched == 0)
2456 break; 2455 break;
2457 ehci->next_uframe = now_uframe; 2456 ehci->next_uframe = now_uframe;