[PATCH 19/20] usb/gadget/udc: renesas: Use pm_ptr() macro

Paul Cercueil paul at crapouillou.net
Thu Sep 3 21:25:53 AEST 2020


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 at crapouillou.net>
---
 drivers/usb/gadget/udc/renesas_usb3.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 0c418ce50ba0..4e8ba5914eff 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2867,8 +2867,7 @@ static int renesas_usb3_probe(struct platform_device *pdev)
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int renesas_usb3_suspend(struct device *dev)
+static int __maybe_unused renesas_usb3_suspend(struct device *dev)
 {
 	struct renesas_usb3 *usb3 = dev_get_drvdata(dev);
 
@@ -2884,7 +2883,7 @@ static int renesas_usb3_suspend(struct device *dev)
 	return 0;
 }
 
-static int renesas_usb3_resume(struct device *dev)
+static int __maybe_unused renesas_usb3_resume(struct device *dev)
 {
 	struct renesas_usb3 *usb3 = dev_get_drvdata(dev);
 
@@ -2899,7 +2898,6 @@ static int renesas_usb3_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(renesas_usb3_pm_ops, renesas_usb3_suspend,
 			renesas_usb3_resume);
@@ -2909,7 +2907,7 @@ static struct platform_driver renesas_usb3_driver = {
 	.remove		= renesas_usb3_remove,
 	.driver		= {
 		.name =	udc_name,
-		.pm		= &renesas_usb3_pm_ops,
+		.pm		= pm_ptr(&renesas_usb3_pm_ops),
 		.of_match_table = of_match_ptr(usb3_of_match),
 	},
 };
-- 
2.28.0



More information about the openbmc mailing list