diff options
Diffstat (limited to 'drivers/usb/host/ohci-hcd.c')
-rw-r--r-- | drivers/usb/host/ohci-hcd.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 8f6b695af6a4..604cad1bcf9c 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -216,31 +216,26 @@ static int ohci_urb_enqueue ( | |||
216 | frame &= ~(ed->interval - 1); | 216 | frame &= ~(ed->interval - 1); |
217 | frame |= ed->branch; | 217 | frame |= ed->branch; |
218 | urb->start_frame = frame; | 218 | urb->start_frame = frame; |
219 | ed->last_iso = frame + ed->interval * (size - 1); | ||
219 | } | 220 | } |
220 | } else if (ed->type == PIPE_ISOCHRONOUS) { | 221 | } else if (ed->type == PIPE_ISOCHRONOUS) { |
221 | u16 next = ohci_frame_no(ohci) + 1; | 222 | u16 next = ohci_frame_no(ohci) + 1; |
222 | u16 frame = ed->last_iso + ed->interval; | 223 | u16 frame = ed->last_iso + ed->interval; |
224 | u16 length = ed->interval * (size - 1); | ||
223 | 225 | ||
224 | /* Behind the scheduling threshold? */ | 226 | /* Behind the scheduling threshold? */ |
225 | if (unlikely(tick_before(frame, next))) { | 227 | if (unlikely(tick_before(frame, next))) { |
226 | 228 | ||
227 | /* USB_ISO_ASAP: Round up to the first available slot */ | 229 | /* URB_ISO_ASAP: Round up to the first available slot */ |
228 | if (urb->transfer_flags & URB_ISO_ASAP) { | 230 | if (urb->transfer_flags & URB_ISO_ASAP) { |
229 | frame += (next - frame + ed->interval - 1) & | 231 | frame += (next - frame + ed->interval - 1) & |
230 | -ed->interval; | 232 | -ed->interval; |
231 | 233 | ||
232 | /* | 234 | /* |
233 | * Not ASAP: Use the next slot in the stream. If | 235 | * Not ASAP: Use the next slot in the stream, |
234 | * the entire URB falls before the threshold, fail. | 236 | * no matter what. |
235 | */ | 237 | */ |
236 | } else { | 238 | } else { |
237 | if (tick_before(frame + ed->interval * | ||
238 | (urb->number_of_packets - 1), next)) { | ||
239 | retval = -EXDEV; | ||
240 | usb_hcd_unlink_urb_from_ep(hcd, urb); | ||
241 | goto fail; | ||
242 | } | ||
243 | |||
244 | /* | 239 | /* |
245 | * Some OHCI hardware doesn't handle late TDs | 240 | * Some OHCI hardware doesn't handle late TDs |
246 | * correctly. After retiring them it proceeds | 241 | * correctly. After retiring them it proceeds |
@@ -251,9 +246,16 @@ static int ohci_urb_enqueue ( | |||
251 | urb_priv->td_cnt = DIV_ROUND_UP( | 246 | urb_priv->td_cnt = DIV_ROUND_UP( |
252 | (u16) (next - frame), | 247 | (u16) (next - frame), |
253 | ed->interval); | 248 | ed->interval); |
249 | if (urb_priv->td_cnt >= urb_priv->length) { | ||
250 | ++urb_priv->td_cnt; /* Mark it */ | ||
251 | ohci_dbg(ohci, "iso underrun %p (%u+%u < %u)\n", | ||
252 | urb, frame, length, | ||
253 | next); | ||
254 | } | ||
254 | } | 255 | } |
255 | } | 256 | } |
256 | urb->start_frame = frame; | 257 | urb->start_frame = frame; |
258 | ed->last_iso = frame + length; | ||
257 | } | 259 | } |
258 | 260 | ||
259 | /* fill the TDs and link them to the ed; and | 261 | /* fill the TDs and link them to the ed; and |