Skip to content

Commit 3f3284d

Browse files
committed
Merge pull request #312 from wmdb/rpi-3.6.y
dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion ta...
2 parents bf3a6c5 + 9475f39 commit 3f3284d

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

drivers/usb/host/dwc_otg/dwc_otg_hcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ static void completion_tasklet_func(void *ptr)
704704
urb_tq_entry_t *item;
705705
dwc_irqflags_t flags;
706706

707+
/* This could just be spin_lock_irq */
707708
DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags);
708709
while (!DWC_TAILQ_EMPTY(&hcd->completed_urb_list)) {
709710
item = DWC_TAILQ_FIRST(&hcd->completed_urb_list);
@@ -713,7 +714,6 @@ static void completion_tasklet_func(void *ptr)
713714
DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags);
714715
DWC_FREE(item);
715716

716-
usb_hcd_unlink_urb_from_ep(hcd->priv, urb);
717717
usb_hcd_giveback_urb(hcd->priv, urb, urb->status);
718718

719719
DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags);

drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ static void free_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw,
265265

266266
/**
267267
* Sets the final status of an URB and returns it to the device driver. Any
268-
* required cleanup of the URB is performed.
268+
* required cleanup of the URB is performed. The HCD lock should be held on
269+
* entry.
269270
*/
270271
static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle,
271272
dwc_otg_hcd_urb_t * dwc_otg_urb, int32_t status)
272273
{
273274
struct urb *urb = (struct urb *)urb_handle;
274275
urb_tq_entry_t *new_entry;
276+
int rc = 0;
275277
if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) {
276278
DWC_PRINTF("%s: urb %p, device %d, ep %d %s, status=%d\n",
277279
__func__, urb, usb_pipedevice(urb->pipe),
@@ -363,9 +365,17 @@ static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle,
363365
#endif
364366
} else {
365367
new_entry->urb = urb;
366-
DWC_TAILQ_INSERT_TAIL(&hcd->completed_urb_list, new_entry,
367-
urb_tq_entries);
368-
DWC_TASK_HI_SCHEDULE(hcd->completion_tasklet);
368+
#if USB_URB_EP_LINKING
369+
rc = usb_hcd_check_unlink_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status);
370+
if(0 == rc) {
371+
usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb);
372+
}
373+
#endif
374+
if(0 == rc) {
375+
DWC_TAILQ_INSERT_TAIL(&hcd->completed_urb_list, new_entry,
376+
urb_tq_entries);
377+
DWC_TASK_HI_SCHEDULE(hcd->completion_tasklet);
378+
}
369379
}
370380
return 0;
371381
}

0 commit comments

Comments
 (0)