Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: EHCI: improvements to unlink_empty_async_suspended()

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 <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
8df0d77d 87d61912

+7 -3
+2 -1
drivers/usb/host/ehci-hub.c
··· 347 347 goto done; 348 348 ehci->rh_state = EHCI_RH_SUSPENDED; 349 349 350 + unlink_empty_async_suspended(ehci); 351 + 350 352 /* Any IAA cycle that started before the suspend is now invalid */ 351 353 end_iaa_cycle(ehci); 352 - unlink_empty_async_suspended(ehci); 353 354 ehci_handle_start_intr_unlinks(ehci); 354 355 ehci_handle_intr_unlinks(ehci); 355 356 end_free_itds(ehci);
+5 -2
drivers/usb/host/ehci-q.c
··· 1459 1459 } 1460 1460 } 1461 1461 1462 + #ifdef CONFIG_PM 1463 + 1462 1464 /* The root hub is suspended; unlink all the async QHs */ 1463 - static void __maybe_unused unlink_empty_async_suspended(struct ehci_hcd *ehci) 1465 + static void unlink_empty_async_suspended(struct ehci_hcd *ehci) 1464 1466 { 1465 1467 struct ehci_qh *qh; 1466 1468 ··· 1471 1469 WARN_ON(!list_empty(&qh->qtd_list)); 1472 1470 single_unlink_async(ehci, qh); 1473 1471 } 1474 - start_iaa_cycle(ehci); 1475 1472 } 1473 + 1474 + #endif 1476 1475 1477 1476 /* makes sure the async qh will become idle */ 1478 1477 /* caller must own ehci->lock */