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>
This commit is contained in:
parent
d208571943
commit
9734fd7a27
@ -571,7 +571,6 @@ static void xhci_pci_remove(struct pci_dev *dev)
|
|||||||
pci_set_power_state(dev, PCI_D3hot);
|
pci_set_power_state(dev, PCI_D3hot);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
|
||||||
/*
|
/*
|
||||||
* In some Intel xHCI controllers, in order to get D3 working,
|
* In some Intel xHCI controllers, in order to get D3 working,
|
||||||
* through a vendor specific SSIC CONFIG register at offset 0x883c,
|
* through a vendor specific SSIC CONFIG register at offset 0x883c,
|
||||||
@ -721,7 +720,6 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
|
|||||||
if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
|
if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
|
||||||
pci_set_power_state(pdev, PCI_D3hot);
|
pci_set_power_state(pdev, PCI_D3hot);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PM */
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -763,21 +761,17 @@ static struct pci_driver xhci_pci_driver = {
|
|||||||
/* suspend and resume implemented later */
|
/* suspend and resume implemented later */
|
||||||
|
|
||||||
.shutdown = usb_hcd_pci_shutdown,
|
.shutdown = usb_hcd_pci_shutdown,
|
||||||
#ifdef CONFIG_PM
|
|
||||||
.driver = {
|
.driver = {
|
||||||
.pm = &usb_hcd_pci_pm_ops
|
.pm = pm_ptr(&usb_hcd_pci_pm_ops),
|
||||||
},
|
},
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init xhci_pci_init(void)
|
static int __init xhci_pci_init(void)
|
||||||
{
|
{
|
||||||
xhci_init_driver(&xhci_pci_hc_driver, &xhci_pci_overrides);
|
xhci_init_driver(&xhci_pci_hc_driver, &xhci_pci_overrides);
|
||||||
#ifdef CONFIG_PM
|
|
||||||
xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
|
xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
|
||||||
xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
|
xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
|
||||||
xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;
|
xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;
|
||||||
#endif
|
|
||||||
return pci_register_driver(&xhci_pci_driver);
|
return pci_register_driver(&xhci_pci_driver);
|
||||||
}
|
}
|
||||||
module_init(xhci_pci_init);
|
module_init(xhci_pci_init);
|
||||||
|
@ -697,13 +697,12 @@ struct usb_device {
|
|||||||
|
|
||||||
unsigned long active_duration;
|
unsigned long active_duration;
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
|
||||||
unsigned long connect_time;
|
unsigned long connect_time;
|
||||||
|
|
||||||
unsigned do_remote_wakeup:1;
|
unsigned do_remote_wakeup:1;
|
||||||
unsigned reset_resume:1;
|
unsigned reset_resume:1;
|
||||||
unsigned port_is_suspended:1;
|
unsigned port_is_suspended:1;
|
||||||
#endif
|
|
||||||
struct wusb_dev *wusb_dev;
|
struct wusb_dev *wusb_dev;
|
||||||
int slot_id;
|
int slot_id;
|
||||||
struct usb2_lpm_parameters l1_params;
|
struct usb2_lpm_parameters l1_params;
|
||||||
|
@ -486,9 +486,7 @@ extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
|
|||||||
|
|
||||||
extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
|
extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
|
||||||
extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
|
extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
|
||||||
#endif
|
|
||||||
#endif /* CONFIG_USB_PCI */
|
#endif /* CONFIG_USB_PCI */
|
||||||
|
|
||||||
/* pci-ish (pdev null is ok) buffer alloc/mapping support */
|
/* pci-ish (pdev null is ok) buffer alloc/mapping support */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user