unlink_empty_async_suspended() is marked __maybe_unused.  This is
because its caller, ehci_bus_suspend(), is protected by "#ifdef
CONFIG_PM".  We should use the same protection here instead of
__maybe_unused.

unlink_empty_async_suspended() gets called only when the root hub is
suspended.  It's silly for it to call start_iaa_cycle() at such a
time; the IAA mechanism doesn't work when the root hub isn't running.
It should call end_unlink_async() instead.  But even this isn't
necessary, since there already is a call to end_iaa_cycle() right
before the call to unlink_empty_async_suspended().  All we have to do
is interchange the two subroutine calls.

Signed-off-by: Alan Stern <st...@rowland.harvard.edu>

---

v2:     This patch is new; it didn't appear in v1.


[as1796]


 drivers/usb/host/ehci-hub.c |    3 ++-
 drivers/usb/host/ehci-q.c   |    7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

Index: usb-4.4/drivers/usb/host/ehci-hub.c
===================================================================
--- usb-4.4.orig/drivers/usb/host/ehci-hub.c
+++ usb-4.4/drivers/usb/host/ehci-hub.c
@@ -347,9 +347,10 @@ static int ehci_bus_suspend (struct usb_
                goto done;
        ehci->rh_state = EHCI_RH_SUSPENDED;
 
+       unlink_empty_async_suspended(ehci);
+
        /* Any IAA cycle that started before the suspend is now invalid */
        end_iaa_cycle(ehci);
-       unlink_empty_async_suspended(ehci);
        ehci_handle_start_intr_unlinks(ehci);
        ehci_handle_intr_unlinks(ehci);
        end_free_itds(ehci);
Index: usb-4.4/drivers/usb/host/ehci-q.c
===================================================================
--- usb-4.4.orig/drivers/usb/host/ehci-q.c
+++ usb-4.4/drivers/usb/host/ehci-q.c
@@ -1459,8 +1459,10 @@ static void unlink_empty_async(struct eh
        }
 }
 
+#ifdef CONFIG_PM
+
 /* The root hub is suspended; unlink all the async QHs */
-static void __maybe_unused unlink_empty_async_suspended(struct ehci_hcd *ehci)
+static void unlink_empty_async_suspended(struct ehci_hcd *ehci)
 {
        struct ehci_qh          *qh;
 
@@ -1469,9 +1471,10 @@ static void __maybe_unused unlink_empty_
                WARN_ON(!list_empty(&qh->qtd_list));
                single_unlink_async(ehci, qh);
        }
-       start_iaa_cycle(ehci);
 }
 
+#endif
+
 /* makes sure the async qh will become idle */
 /* caller must own ehci->lock */
 


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to