On Sunday 06 January 2008, Karsten Wiese wrote:
> >       for (uframe = 0; uframe < 8; uframe++) {
> > -             if (likely (itd->index[uframe] == -1))
> > +             t = hc32_to_cpup(ehci, &itd->hw_bufp[uframe]);
> 
> NACK, struct ehci_itd has hw_bufp[7], not 8.

Here's a better way, on top of $SUBJECT patch.
Saves another four bytes too.  ;)

- Dave


--- g26.orig/drivers/usb/host/ehci-sched.c      2008-01-07 01:59:33.000000000 
-0800
+++ g26/drivers/usb/host/ehci-sched.c   2008-01-07 01:54:17.000000000 -0800
@@ -1456,6 +1456,8 @@ itd_patch(
 
        uframe &= 0x07;
 
+       itd->uframe_mask |= 1 << uframe;
+
        itd->hw_transaction[uframe] = uf->transaction;
        itd->hw_transaction[uframe] |= cpu_to_hc32(ehci, pg << 12);
        itd->hw_bufp[pg] |= cpu_to_hc32(ehci, uf->bufp & ~(u32)0);
@@ -1572,6 +1574,7 @@ itd_complete (
        unsigned                                urb_index = itd->index;
        struct ehci_iso_stream                  *stream = itd->stream;
        struct usb_device                       *dev;
+       unsigned                                mask = itd->uframe_mask;
 
        /* Caller guarantees this ITD is inactive.  We always
         * report something for each transfer it defines.
@@ -1579,9 +1582,8 @@ itd_complete (
        desc = &urb->iso_frame_desc[urb_index];
 
        /* for each uframe with a packet */
-       for (uframe = 0; uframe < 8; uframe++) {
-               t = hc32_to_cpup(ehci, &itd->hw_bufp[uframe]);
-               if ((t >> 12) == 0)
+       for (uframe = 0; uframe < 8; uframe++, mask >>= 1) {
+               if (!(mask & 1))
                        continue;
 
                t = hc32_to_cpup(ehci, &itd->hw_transaction [uframe]);
--- g26.orig/drivers/usb/host/ehci.h    2008-01-07 01:59:33.000000000 -0800
+++ g26/drivers/usb/host/ehci.h 2008-01-07 01:48:34.000000000 -0800
@@ -592,8 +592,9 @@ struct ehci_itd {
 
        /* any/all hw_transactions here may be used by that urb */
        unsigned                frame;          /* where scheduled */
-       unsigned                pg;
-       unsigned                index;          /* first urb->iso_frame_desc */
+       u8                      pg;
+       u8                      uframe_mask;
+       u16                     index;          /* first urb->iso_frame_desc */
 } __attribute__ ((aligned (32)));
 
 /*-------------------------------------------------------------------------*/
-
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