Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364373
b: refs/heads/master
c: 79bcf7b
h: refs/heads/master
i:
  364371: 3d4f4c5
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Mar 25, 2013
1 parent 2ce2f1a commit 4d0687a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c1fdb68e3d73741630ca16695cf9176c233be7ed
refs/heads/master: 79bcf7b02ba3d45bafe81a2753cedb8ef49548e3
22 changes: 8 additions & 14 deletions trunk/drivers/usb/host/ehci-q.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh);

/*
* Process and free completed qtds for a qh, returning URBs to drivers.
* Chases up to qh->hw_current. Returns number of completions called,
* indicating how much "real" work we did.
* Chases up to qh->hw_current. Returns nonzero if the caller should
* unlink qh.
*/
static unsigned
qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
Expand All @@ -302,13 +302,9 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
struct list_head *entry, *tmp;
int last_status;
int stopped;
unsigned count = 0;
u8 state;
struct ehci_qh_hw *hw = qh->hw;

if (unlikely (list_empty (&qh->qtd_list)))
return count;

/* completions (or tasks on other cpus) must never clobber HALT
* till we've gone through and cleaned everything up, even when
* they add urbs to this qh's queue or mark them for unlinking.
Expand Down Expand Up @@ -345,7 +341,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
if (last) {
if (likely (last->urb != urb)) {
ehci_urb_done(ehci, last->urb, last_status);
count++;
last_status = -EINPROGRESS;
}
ehci_qtd_free (ehci, last);
Expand Down Expand Up @@ -519,7 +514,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* last urb's completion might still need calling */
if (likely (last != NULL)) {
ehci_urb_done(ehci, last->urb, last_status);
count++;
ehci_qtd_free (ehci, last);
}

Expand Down Expand Up @@ -566,7 +560,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* otherwise, unlink already started */
}

return count;
return qh->needs_rescan;
}

/*-------------------------------------------------------------------------*/
Expand Down Expand Up @@ -1254,7 +1248,8 @@ static void end_unlink_async(struct ehci_hcd *ehci)
qh->qh_state = QH_STATE_IDLE;
qh->qh_next.qh = NULL;

qh_completions(ehci, qh);
if (!list_empty(&qh->qtd_list))
qh_completions(ehci, qh);
if (!list_empty(&qh->qtd_list) &&
ehci->rh_state == EHCI_RH_RUNNING)
qh_link_async(ehci, qh);
Expand Down Expand Up @@ -1348,7 +1343,7 @@ static void scan_async (struct ehci_hcd *ehci)
while (ehci->qh_scan_next) {
qh = ehci->qh_scan_next;
ehci->qh_scan_next = qh->qh_next.qh;
rescan:

/* clean any finished work for this qh */
if (!list_empty(&qh->qtd_list)) {
int temp;
Expand All @@ -1361,14 +1356,13 @@ static void scan_async (struct ehci_hcd *ehci)
* in single_unlink_async().
*/
temp = qh_completions(ehci, qh);
if (qh->needs_rescan) {
if (unlikely(temp)) {
start_unlink_async(ehci, qh);
} else if (list_empty(&qh->qtd_list)
&& qh->qh_state == QH_STATE_LINKED) {
qh->unlink_cycle = ehci->async_unlink_cycle;
check_unlinks_later = true;
} else if (temp != 0)
goto rescan;
}
}
}

Expand Down
12 changes: 5 additions & 7 deletions trunk/drivers/usb/host/ehci-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh)
qh->qh_state = QH_STATE_IDLE;
hw->hw_next = EHCI_LIST_END(ehci);

qh_completions(ehci, qh);
if (!list_empty(&qh->qtd_list))
qh_completions(ehci, qh);

/* reschedule QH iff another request is queued */
if (!list_empty(&qh->qtd_list) && ehci->rh_state == EHCI_RH_RUNNING) {
Expand Down Expand Up @@ -914,7 +915,7 @@ static void scan_intr(struct ehci_hcd *ehci)

list_for_each_entry_safe(qh, ehci->qh_scan_next, &ehci->intr_qh_list,
intr_node) {
rescan:

/* clean any finished work for this qh */
if (!list_empty(&qh->qtd_list)) {
int temp;
Expand All @@ -927,12 +928,9 @@ static void scan_intr(struct ehci_hcd *ehci)
* in qh_unlink_periodic().
*/
temp = qh_completions(ehci, qh);
if (unlikely(qh->needs_rescan ||
(list_empty(&qh->qtd_list) &&
qh->qh_state == QH_STATE_LINKED)))
if (unlikely(temp || (list_empty(&qh->qtd_list) &&
qh->qh_state == QH_STATE_LINKED)))
start_unlink_intr(ehci, qh);
else if (temp != 0)
goto rescan;
}
}
}
Expand Down

0 comments on commit 4d0687a

Please sign in to comment.