Merge branch 'release-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/ak...
[pandora-kernel.git] / drivers / usb / host / ehci-q.c
index 5ae6891..2622b65 100644 (file)
@@ -285,7 +285,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
        int                     stopped;
        unsigned                count = 0;
        u8                      state;
-       u32                     halt = HALT_BIT(ehci);
+       __le32                  halt = HALT_BIT(ehci);
 
        if (unlikely (list_empty (&qh->qtd_list)))
                return count;
@@ -883,7 +883,7 @@ static struct ehci_qh *qh_append_tds (
 )
 {
        struct ehci_qh          *qh = NULL;
-       u32                     qh_addr_mask = cpu_to_hc32(ehci, 0x7f);
+       __hc32                  qh_addr_mask = cpu_to_hc32(ehci, 0x7f);
 
        qh = (struct ehci_qh *) *ptr;
        if (unlikely (qh == NULL)) {
@@ -1116,8 +1116,7 @@ static void scan_async (struct ehci_hcd *ehci)
        struct ehci_qh          *qh;
        enum ehci_timer_action  action = TIMER_IO_WATCHDOG;
 
-       if (!++(ehci->stamp))
-               ehci->stamp++;
+       ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index);
        timer_action_done (ehci, TIMER_ASYNC_SHRINK);
 rescan:
        qh = ehci->async->qh_next.qh;
@@ -1142,18 +1141,20 @@ rescan:
                                }
                        }
 
-                       /* unlink idle entries, reducing HC PCI usage as well
+                       /* unlink idle entries, reducing DMA usage as well
                         * as HCD schedule-scanning costs.  delay for any qh
                         * we just scanned, there's a not-unusual case that it
                         * doesn't stay idle for long.
                         * (plus, avoids some kind of re-activation race.)
                         */
-                       if (list_empty (&qh->qtd_list)) {
-                               if (qh->stamp == ehci->stamp)
+                       if (list_empty(&qh->qtd_list)
+                                       && qh->qh_state == QH_STATE_LINKED) {
+                               if (!ehci->reclaim
+                                       && ((ehci->stamp - qh->stamp) & 0x1fff)
+                                               >= (EHCI_SHRINK_FRAMES * 8))
+                                       start_unlink_async(ehci, qh);
+                               else
                                        action = TIMER_ASYNC_SHRINK;
-                               else if (!ehci->reclaim
-                                           && qh->qh_state == QH_STATE_LINKED)
-                                       start_unlink_async (ehci, qh);
                        }
 
                        qh = qh->qh_next.qh;