On Mon, 19 Oct 2009, Sarah Sharp wrote: > @@ -1354,6 +1354,7 @@ iso_stream_schedule ( > period <<= 3; > > now = ehci_readl(ehci, &ehci->regs->frame_index) % mod; > + next = now + ehci->i_thresh; The same math can accomodate both full-speed and high-speed devices. The difference can be confined to the definition of "next": /* For HS devices, allow scheduling within the isochronous * scheduling threshold. For FS/LS devices, don't. * (Work around for ICH9 bug.) */ next = (stream->highspeed ? now : now + ehci->i_thresh); I avoided using the unexplained abbreviation "IST" because it's likely to confuse readers. It feels a little funny to talk about FS/LS devices here, since LS devices can't do isochronous transfers, but I guess it's okay. > @@ -1365,16 +1366,29 @@ iso_stream_schedule ( > */ > if (likely (!list_empty (&stream->td_list))) { > start = stream->next_uframe; > - if (start < now) > - start += mod; > > /* Fell behind (by up to twice the slop amount)? */ > - if (start >= max - 2 * SCHEDULE_SLOP) > - start += period * DIV_ROUND_UP( > - max - start, period) - mod; > + /* For HS devices, allow scheduling within the IST. > + * For FS/LS devices, don't. (Work around for ICH9 bug.) > + */ > + if (stream->highspeed) { > + if (start < now) > + start += mod; > + > + if (start >= max - 2 * SCHEDULE_SLOP) > + start += period * DIV_ROUND_UP( > + max - start, period) - mod; Then the code above isn't needed. > + } else { > + if (((start - next) & (mod - 1)) >= > + mod - 2 * SCHEDULE_SLOP) > + start += period * DIV_ROUND_UP( > + (next - start) & (mod - 1), > + period); > + } > > /* Tried to schedule too far into the future? */ > - if (unlikely((start + sched->span) >= max)) { > + if (unlikely(((start - now) & (mod - 1)) + sched->span > + >= max - 2 * SCHEDULE_SLOP)) { > status = -EFBIG; > goto fail; > } The rest is okay. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html