Skip to content

Commit 3fc2410

Browse files
arndbaloktiwa
authored andcommitted
xhci: use pm_ptr() instead of #ifdef for CONFIG_PM conditionals
commit 130eac4 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: 9abe15d ("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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 1f91ebde6e35db144b952b87cf36bab7fb5426c2) Signed-off-by: Alok Tiwari <[email protected]>
1 parent 5ae7c46 commit 3fc2410

File tree

3 files changed

+1
-8
lines changed

3 files changed

+1
-8
lines changed

drivers/usb/host/xhci-pci.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ static void xhci_pci_remove(struct pci_dev *dev)
521521
usb_hcd_pci_remove(dev);
522522
}
523523

524-
#ifdef CONFIG_PM
525524
/*
526525
* In some Intel xHCI controllers, in order to get D3 working,
527526
* through a vendor specific SSIC CONFIG register at offset 0x883c,
@@ -662,7 +661,6 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
662661
if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
663662
pci_set_power_state(pdev, PCI_D3hot);
664663
}
665-
#endif /* CONFIG_PM */
666664

667665
/*-------------------------------------------------------------------------*/
668666

@@ -696,11 +694,9 @@ static struct pci_driver xhci_pci_driver = {
696694
static int __init xhci_pci_init(void)
697695
{
698696
xhci_init_driver(&xhci_pci_hc_driver, &xhci_pci_overrides);
699-
#ifdef CONFIG_PM
700697
xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
701698
xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
702699
xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;
703-
#endif
704700
return pci_register_driver(&xhci_pci_driver);
705701
}
706702
module_init(xhci_pci_init);

include/linux/usb.h

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

700700
unsigned long active_duration;
701701

702-
#ifdef CONFIG_PM
703702
unsigned long connect_time;
704703

705704
unsigned do_remote_wakeup:1;
706705
unsigned reset_resume:1;
707706
unsigned port_is_suspended:1;
708-
#endif
707+
709708
struct wusb_dev *wusb_dev;
710709
int slot_id;
711710
enum usb_device_removable removable;

include/linux/usb/hcd.h

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

489489
extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
490490

491-
#ifdef CONFIG_PM
492491
extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
493-
#endif
494492
#endif /* CONFIG_USB_PCI */
495493

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

0 commit comments

Comments
 (0)