Skip to content

Commit 9734fd7

Browse files
arndbgregkh
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d208571 commit 9734fd7

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

drivers/usb/host/xhci-pci.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,6 @@ static void xhci_pci_remove(struct pci_dev *dev)
571571
pci_set_power_state(dev, PCI_D3hot);
572572
}
573573

574-
#ifdef CONFIG_PM
575574
/*
576575
* In some Intel xHCI controllers, in order to get D3 working,
577576
* through a vendor specific SSIC CONFIG register at offset 0x883c,
@@ -721,7 +720,6 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
721720
if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
722721
pci_set_power_state(pdev, PCI_D3hot);
723722
}
724-
#endif /* CONFIG_PM */
725723

726724
/*-------------------------------------------------------------------------*/
727725

@@ -763,21 +761,17 @@ static struct pci_driver xhci_pci_driver = {
763761
/* suspend and resume implemented later */
764762

765763
.shutdown = usb_hcd_pci_shutdown,
766-
#ifdef CONFIG_PM
767764
.driver = {
768-
.pm = &usb_hcd_pci_pm_ops
765+
.pm = pm_ptr(&usb_hcd_pci_pm_ops),
769766
},
770-
#endif
771767
};
772768

773769
static int __init xhci_pci_init(void)
774770
{
775771
xhci_init_driver(&xhci_pci_hc_driver, &xhci_pci_overrides);
776-
#ifdef CONFIG_PM
777772
xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
778773
xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
779774
xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;
780-
#endif
781775
return pci_register_driver(&xhci_pci_driver);
782776
}
783777
module_init(xhci_pci_init);

include/linux/usb.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,13 +697,12 @@ struct usb_device {
697697

698698
unsigned long active_duration;
699699

700-
#ifdef CONFIG_PM
701700
unsigned long connect_time;
702701

703702
unsigned do_remote_wakeup:1;
704703
unsigned reset_resume:1;
705704
unsigned port_is_suspended:1;
706-
#endif
705+
707706
struct wusb_dev *wusb_dev;
708707
int slot_id;
709708
struct usb2_lpm_parameters l1_params;

include/linux/usb/hcd.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,7 @@ extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
486486

487487
extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
488488

489-
#ifdef CONFIG_PM
490489
extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
491-
#endif
492490
#endif /* CONFIG_USB_PCI */
493491

494492
/* pci-ish (pdev null is ok) buffer alloc/mapping support */

0 commit comments

Comments
 (0)