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

usb/host: ehci-spear: Use pm_ptr() macro

Use the newly introduced pm_ptr() macro, and mark the suspend/resume
functions __maybe_unused. These functions can then be moved outside the
CONFIG_PM_SUSPEND block, and the compiler can then process them and
detect build failures independently of the config. If unused, they will
simply be discarded by the compiler.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20200903112554.34263-3-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Paul Cercueil and committed by
Greg Kroah-Hartman
1874b630 7456fe48

+3 -5
+3 -5
drivers/usb/host/ehci-spear.c
··· 34 34 35 35 static struct hc_driver __read_mostly ehci_spear_hc_driver; 36 36 37 - #ifdef CONFIG_PM_SLEEP 38 - static int ehci_spear_drv_suspend(struct device *dev) 37 + static int __maybe_unused ehci_spear_drv_suspend(struct device *dev) 39 38 { 40 39 struct usb_hcd *hcd = dev_get_drvdata(dev); 41 40 bool do_wakeup = device_may_wakeup(dev); ··· 42 43 return ehci_suspend(hcd, do_wakeup); 43 44 } 44 45 45 - static int ehci_spear_drv_resume(struct device *dev) 46 + static int __maybe_unused ehci_spear_drv_resume(struct device *dev) 46 47 { 47 48 struct usb_hcd *hcd = dev_get_drvdata(dev); 48 49 49 50 ehci_resume(hcd, false); 50 51 return 0; 51 52 } 52 - #endif /* CONFIG_PM_SLEEP */ 53 53 54 54 static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, 55 55 ehci_spear_drv_resume); ··· 153 155 .driver = { 154 156 .name = "spear-ehci", 155 157 .bus = &platform_bus_type, 156 - .pm = &ehci_spear_pm_ops, 158 + .pm = pm_ptr(&ehci_spear_pm_ops), 157 159 .of_match_table = spear_ehci_id_table, 158 160 } 159 161 };