diff mbox series

[16/20] usb/gadget/udc: bdc: Use pm_ptr() macro

Message ID 20200903112554.34263-17-paul@crapouillou.net (mailing list archive)
State New, archived
Headers show
Series usb: Use new pm_ptr() macro | expand

Commit Message

Paul Cercueil Sept. 3, 2020, 11:25 a.m. UTC
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>
---
 drivers/usb/gadget/udc/bdc/bdc_core.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index 5ff36525044e..da3a7a59ccae 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -597,8 +597,7 @@  static int bdc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int bdc_suspend(struct device *dev)
+static int __maybe_unused bdc_suspend(struct device *dev)
 {
 	struct bdc *bdc = dev_get_drvdata(dev);
 	int ret;
@@ -611,7 +610,7 @@  static int bdc_suspend(struct device *dev)
 	return ret;
 }
 
-static int bdc_resume(struct device *dev)
+static int __maybe_unused bdc_resume(struct device *dev)
 {
 	struct bdc *bdc = dev_get_drvdata(dev);
 	int ret;
@@ -630,8 +629,6 @@  static int bdc_resume(struct device *dev)
 	return 0;
 }
 
-#endif /* CONFIG_PM_SLEEP */
-
 static SIMPLE_DEV_PM_OPS(bdc_pm_ops, bdc_suspend,
 		bdc_resume);
 
@@ -644,7 +641,7 @@  static const struct of_device_id bdc_of_match[] = {
 static struct platform_driver bdc_driver = {
 	.driver		= {
 		.name	= BRCM_BDC_NAME,
-		.pm = &bdc_pm_ops,
+		.pm = pm_ptr(&bdc_pm_ops),
 		.of_match_table	= bdc_of_match,
 	},
 	.probe		= bdc_probe,