]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xhci: use pm_ptr() instead of #ifdef for CONFIG_PM conditionals
authorArnd Bergmann <arnd@arndb.de>
Tue, 28 Mar 2023 13:10:43 +0000 (15:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jan 2025 16:16:04 +0000 (17:16 +0100)
commit0bd4efe3226d229189573d9881aec868700d9293
tree6d092eae1fd5a4a9d7c181f62f4ec8455a85bc8b
parentc3d052cae566ec2285f5999958a5deb415a0f59e
xhci: use pm_ptr() instead of #ifdef for CONFIG_PM conditionals

commit 130eac4170859fb368681e00d390f20f44bbf27b upstream.

A recent patch caused an unused-function warning in builds with
CONFIG_PM disabled, after the function became marked 'static':

drivers/usb/host/xhci-pci.c:91:13: error: 'xhci_msix_sync_irqs' defined but not used [-Werror=unused-function]
   91 | static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
      |             ^~~~~~~~~~~~~~~~~~~

This could be solved by adding another #ifdef, but as there is
a trend towards removing CONFIG_PM checks in favor of helper
macros, do the same conversion here and use pm_ptr() to get
either a function pointer or NULL but avoid the warning.

As the hidden functions reference some other symbols, make
sure those are visible at compile time, at the minimal cost of
a few extra bytes for 'struct usb_device'.

Fixes: 9abe15d55dcc ("xhci: Move xhci MSI sync function to to xhci-pci")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230328131114.1296430-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-pci.c
include/linux/usb.h
include/linux/usb/hcd.h