Small updates to the EHCI driver's ISO support:

 - Get rid of the Kconfig option for full speed ISO.  It may
   not be perfect yet, but it hasn't appeared to be dangerous
   and pretty much every configuration wants it.

 - Instead of two places to disable an empty periodic schedule
   after an ISO transfer completes, just have one.

 - After the periodic schedule is disabled, we can short-circuit
   the schedule scan ... it can't possibly have more work to do.

Assuming a typical config with split iso enabled, the only change
in behavior should be almost unobservable:  quicker termination
of periodic scans when the schedule gets emptied.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
 drivers/usb/host/Kconfig      |    9 --------
 drivers/usb/host/ehci-sched.c |   47 ++++++++++--------------------------------
 2 files changed, 12 insertions(+), 44 deletions(-)

--- g26.orig/drivers/usb/host/Kconfig   2007-12-30 23:12:01.000000000 -0800
+++ g26/drivers/usb/host/Kconfig        2007-12-30 23:12:20.000000000 -0800
@@ -29,15 +29,6 @@ config USB_EHCI_HCD
          To compile this driver as a module, choose M here: the
          module will be called ehci-hcd.
 
-config USB_EHCI_SPLIT_ISO
-       bool "Full speed ISO transactions (EXPERIMENTAL)"
-       depends on USB_EHCI_HCD && EXPERIMENTAL
-       default n
-       ---help---
-         This code is new and hasn't been used with many different
-         EHCI or USB 2.0 transaction translator implementations.
-         It should work for ISO-OUT transfers, like audio.
-
 config USB_EHCI_ROOT_HUB_TT
        bool "Root Hub Transaction Translators (EXPERIMENTAL)"
        depends on USB_EHCI_HCD && EXPERIMENTAL
--- g26.orig/drivers/usb/host/ehci-sched.c      2007-12-30 23:11:25.000000000 
-0800
+++ g26/drivers/usb/host/ehci-sched.c   2007-12-30 23:23:06.000000000 -0800
@@ -1625,15 +1625,11 @@ itd_complete (
                BUG_ON (itd->urb == urb);
         */
 
-       /* give urb back to the driver ... can be out-of-order */
+       /* give urb back to the driver; completion often (re)submits */
        dev = urb->dev;
        ehci_urb_done(ehci, urb, 0);
        urb = NULL;
-
-       /* defer stopping schedule; completion can submit */
        ehci->periodic_sched--;
-       if (unlikely (!ehci->periodic_sched))
-               (void) disable_periodic (ehci);
        ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
        if (unlikely (list_empty (&stream->td_list))) {
@@ -1712,8 +1708,6 @@ done:
        return status;
 }
 
-#ifdef CONFIG_USB_EHCI_SPLIT_ISO
-
 /*-------------------------------------------------------------------------*/
 
 /*
@@ -1998,15 +1992,11 @@ sitd_complete (
                BUG_ON (sitd->urb == urb);
         */
 
-       /* give urb back to the driver */
+       /* give urb back to the driver; completion often (re)submits */
        dev = urb->dev;
        ehci_urb_done(ehci, urb, 0);
        urb = NULL;
-
-       /* defer stopping schedule; completion can submit */
        ehci->periodic_sched--;
-       if (!ehci->periodic_sched)
-               (void) disable_periodic (ehci);
        ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
        if (list_empty (&stream->td_list)) {
@@ -2082,26 +2072,6 @@ done:
        return status;
 }
 
-#else
-
-static inline int
-sitd_submit (struct ehci_hcd *ehci, struct urb *urb, gfp_t mem_flags)
-{
-       ehci_dbg (ehci, "split iso support is disabled\n");
-       return -ENOSYS;
-}
-
-static inline unsigned
-sitd_complete (
-       struct ehci_hcd         *ehci,
-       struct ehci_sitd        *sitd
-) {
-       ehci_err (ehci, "sitd_complete %p?\n", sitd);
-       return 0;
-}
-
-#endif /* USB_EHCI_SPLIT_ISO */
-
 /*-------------------------------------------------------------------------*/
 
 static void
@@ -2238,8 +2208,14 @@ restart:
                        }
 
                        /* assume completion callbacks modify the queue */
-                       if (unlikely (modified))
-                               goto restart;
+                       if (unlikely (modified)) {
+                               if (likely(ehci->periodic_sched > 0))
+                                       goto restart;
+                               /* maybe we can short-circuit this scan! */
+                               disable_periodic(ehci);
+                               now_uframe = clock;
+                               break;
+                       }
                }
 
                /* stop when we catch up to the HC */
@@ -2255,7 +2231,8 @@ restart:
                if (now_uframe == clock) {
                        unsigned        now;
 
-                       if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state))
+                       if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state)
+                                       || ehci->periodic_sched == 0)
                                break;
                        ehci->next_uframe = now_uframe;
                        now = ehci_readl(ehci, &ehci->regs->frame_index) % mod;
-
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to