- struct ehci_qh *prev;
-
-#ifdef DEBUG
- assert_spin_locked(&ehci->lock);
- if (ehci->async_unlink
- || (qh->qh_state != QH_STATE_LINKED
- && qh->qh_state != QH_STATE_UNLINK_WAIT)
- )
- BUG ();
-#endif
-
- qh->qh_state = QH_STATE_UNLINK;
- ehci->async_unlink = qh;
- if (!qh->unlink_next)
- ehci->async_unlink_last = qh;
-
- prev = ehci->async;
- while (prev->qh_next.qh != qh)
- prev = prev->qh_next.qh;
-
- prev->hw->hw_next = qh->hw->hw_next;
- prev->qh_next = qh->qh_next;
- if (ehci->qh_scan_next == qh)
- ehci->qh_scan_next = qh->qh_next.qh;
- wmb ();
-
- /* If the controller isn't running, we don't have to wait for it */
- if (unlikely(ehci->rh_state < EHCI_RH_RUNNING)) {
- /* if (unlikely (qh->unlink_next != 0))
- * this will recurse, probably not much
- */
- end_unlink_async (ehci);
+ /*
+ * If the QH isn't linked then there's nothing we can do
+ * unless we were called during a giveback, in which case
+ * qh_completions() has to deal with it.
+ */
+ if (qh->qh_state != QH_STATE_LINKED) {
+ if (qh->qh_state == QH_STATE_COMPLETING)
+ qh->needs_rescan = 1;