USB: OHCI: make URB completions single-threaded
URBs for a particular endpoint should complete sequentially. That is,
we shouldn't call the completion handler for one URB until the handler
for the previous URB has returned.
When the OHCI watchdog routine is added, there will be two paths for
completing URBs: interrupt handler and watchdog routine. Their
activities have to be synchronized so that completions don't occur in
multiple threads concurrently.
For that purpose, this patch creates an ohci_work() routine which will
be responsible for calling process_done_list() and finish_unlinks(),
the two routines that detect when an URB is complete. Everything will
funnel through ohci_work(), and it will be careful not to run in more
than one thread at a time.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index dccb90e..8991692 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -40,8 +40,7 @@
(OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
static void update_done_list(struct ohci_hcd *);
-static void process_done_list(struct ohci_hcd *);
-static void finish_unlinks (struct ohci_hcd *, u16);
+static void ohci_work(struct ohci_hcd *);
#ifdef CONFIG_PM
static int ohci_rh_suspend (struct ohci_hcd *ohci, int autostop)
@@ -89,8 +88,7 @@
spin_lock_irq (&ohci->lock);
}
update_done_list(ohci);
- process_done_list(ohci);
- finish_unlinks (ohci, ohci_frame_no(ohci));
+ ohci_work(ohci);
/*
* Some controllers don't handle "global" suspend properly if