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

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

authored by

Paul Cercueil and committed by
Greg Kroah-Hartman
7456fe48 879a4a66

+3 -5
+3 -5
drivers/usb/host/ehci-platform.c
··· 410 410 return 0; 411 411 } 412 412 413 - #ifdef CONFIG_PM_SLEEP 414 - static int ehci_platform_suspend(struct device *dev) 413 + static int __maybe_unused ehci_platform_suspend(struct device *dev) 415 414 { 416 415 struct usb_hcd *hcd = dev_get_drvdata(dev); 417 416 struct usb_ehci_pdata *pdata = dev_get_platdata(dev); ··· 432 433 return ret; 433 434 } 434 435 435 - static int ehci_platform_resume(struct device *dev) 436 + static int __maybe_unused ehci_platform_resume(struct device *dev) 436 437 { 437 438 struct usb_hcd *hcd = dev_get_drvdata(dev); 438 439 struct usb_ehci_pdata *pdata = dev_get_platdata(dev); ··· 463 464 464 465 return 0; 465 466 } 466 - #endif /* CONFIG_PM_SLEEP */ 467 467 468 468 static const struct of_device_id vt8500_ehci_ids[] = { 469 469 { .compatible = "via,vt8500-ehci", }, ··· 497 499 .shutdown = usb_hcd_platform_shutdown, 498 500 .driver = { 499 501 .name = "ehci-platform", 500 - .pm = &ehci_platform_pm_ops, 502 + .pm = pm_ptr(&ehci_platform_pm_ops), 501 503 .of_match_table = vt8500_ehci_ids, 502 504 .acpi_match_table = ACPI_PTR(ehci_acpi_match), 503 505 }