lkml.org 
[lkml]   [2020]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 16/20] usb/gadget/udc: bdc: Use pm_ptr() macro
Date
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 --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,
--
2.28.0
\
 
 \ /
  Last update: 2020-09-03 13:45    [W:0.109 / U:7.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site