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

usb/host: ehci-npcm7xx: 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-4-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Paul Cercueil and committed by
Greg Kroah-Hartman
f0dbd25f 1874b630

+3 -5
+3 -5
drivers/usb/host/ehci-npcm7xx.c
··· 37 37 38 38 static struct hc_driver __read_mostly ehci_npcm7xx_hc_driver; 39 39 40 - #ifdef CONFIG_PM_SLEEP 41 - static int ehci_npcm7xx_drv_suspend(struct device *dev) 40 + static int __maybe_unused ehci_npcm7xx_drv_suspend(struct device *dev) 42 41 { 43 42 struct usb_hcd *hcd = dev_get_drvdata(dev); 44 43 bool do_wakeup = device_may_wakeup(dev); ··· 45 46 return ehci_suspend(hcd, do_wakeup); 46 47 } 47 48 48 - static int ehci_npcm7xx_drv_resume(struct device *dev) 49 + static int __maybe_unused ehci_npcm7xx_drv_resume(struct device *dev) 49 50 { 50 51 struct usb_hcd *hcd = dev_get_drvdata(dev); 51 52 52 53 ehci_resume(hcd, false); 53 54 return 0; 54 55 } 55 - #endif /* CONFIG_PM_SLEEP */ 56 56 57 57 static SIMPLE_DEV_PM_OPS(ehci_npcm7xx_pm_ops, ehci_npcm7xx_drv_suspend, 58 58 ehci_npcm7xx_drv_resume); ··· 181 183 .driver = { 182 184 .name = "npcm7xx-ehci", 183 185 .bus = &platform_bus_type, 184 - .pm = &ehci_npcm7xx_pm_ops, 186 + .pm = pm_ptr(&ehci_npcm7xx_pm_ops), 185 187 .of_match_table = npcm7xx_ehci_id_table, 186 188 } 187 189 };