[PATCH] Ohci-hcd: fix endless loop (second take)

From: Colin Leroy
Date: Sat Nov 27 2004 - 01:18:43 EST


Hi,

Following patch fixes an endless loop that happens after having
slept and resumed my iBook with a linux-wlan-ng controller plugged in,
removed the stick and plugged it back (getting "IRQ lossage" message).

It supercedes the previous one where
.I hadn't noticed limit was unsigned,
.Decrementing limit was twice too fast,
.the goto was a bit useless.

Signed-off-by: Colin Leroy <colin@xxxxxxxxxx>
--- a/drivers/usb/host/ohci-hcd.c 2004-11-26 11:28:21.284259057 +0100
+++ b/drivers/usb/host/ohci-hcd.c 2004-11-26 11:28:03.437351150 +0100
@@ -344,7 +344,7 @@
int epnum = ep & USB_ENDPOINT_NUMBER_MASK;
unsigned long flags;
struct ed *ed;
- unsigned limit = 1000;
+ int limit = 1000;

/* ASSERT: any requests/urbs are being unlinked */
/* ASSERT: nobody can be submitting urbs for this any more */
@@ -375,6 +375,11 @@
spin_unlock_irqrestore (&ohci->lock, flags);
set_current_state (TASK_UNINTERRUPTIBLE);
schedule_timeout (1);
+ if (limit < 1000) {
+ ohci_warn (ohci, "Can't recover, restarting.\n");
+ ohci_restart(ohci);
+ return;
+ }
goto rescan;
case ED_IDLE: /* fully unlinked */
if (list_empty (&ed->td_list)) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/