diff mbox series

[3/3] watchdog: iTCO_wdt: use pm_ptr()

Message ID 20201117152214.32244-3-info@metux.net
State New
Headers show
Series [1/3] watchdog: iTCO_wdt: use module_platform_device() macro | expand

Commit Message

Enrico Weigelt, metux IT consult Nov. 17, 2020, 3:22 p.m. UTC
Reduce a little bit of boilerplate by using pm_ptr().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/watchdog/iTCO_wdt.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Guenter Roeck Nov. 30, 2020, 10:17 p.m. UTC | #1
On Tue, Nov 17, 2020 at 04:22:14PM +0100, Enrico Weigelt, metux IT consult wrote:
> Reduce a little bit of boilerplate by using pm_ptr().

> 

> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>

> ---

>  drivers/watchdog/iTCO_wdt.c | 5 +----

>  1 file changed, 1 insertion(+), 4 deletions(-)

> 

> diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c

> index edc588a06ae6..660fc262fbc0 100644

> --- a/drivers/watchdog/iTCO_wdt.c

> +++ b/drivers/watchdog/iTCO_wdt.c

> @@ -636,16 +636,13 @@ static const struct dev_pm_ops iTCO_wdt_pm = {

>  	.resume_noirq = iTCO_wdt_resume_noirq,

>  };

>  

> -#define ITCO_WDT_PM_OPS	(&iTCO_wdt_pm)

> -#else

> -#define ITCO_WDT_PM_OPS	NULL

>  #endif /* CONFIG_PM_SLEEP */

>  

>  static struct platform_driver iTCO_wdt_driver = {

>  	.probe          = iTCO_wdt_probe,

>  	.driver         = {

>  		.name   = DRV_NAME,

> -		.pm     = ITCO_WDT_PM_OPS,

> +		.pm     = pm_ptr(&iTCO_wdt_pm),


Not sure if this works. The ifdef is for CONFIG_PM_SLEEP,
but pm_ptr depends on CONFIG_PM. While PM_SLEEP selects PM,
PM is also selected by other means. Other drivers using pm_ptr
also use SIMPLE_DEV_PM_OPS() and __maybe_unused for the function
declarations. This is not the case here. With this in mind,
I'd rather not make this change without changing the rest
of the code as well to ensure consistency.

Thanks,
Guenter

>  	},

>  };

>
diff mbox series

Patch

diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index edc588a06ae6..660fc262fbc0 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -636,16 +636,13 @@  static const struct dev_pm_ops iTCO_wdt_pm = {
 	.resume_noirq = iTCO_wdt_resume_noirq,
 };
 
-#define ITCO_WDT_PM_OPS	(&iTCO_wdt_pm)
-#else
-#define ITCO_WDT_PM_OPS	NULL
 #endif /* CONFIG_PM_SLEEP */
 
 static struct platform_driver iTCO_wdt_driver = {
 	.probe          = iTCO_wdt_probe,
 	.driver         = {
 		.name   = DRV_NAME,
-		.pm     = ITCO_WDT_PM_OPS,
+		.pm     = pm_ptr(&iTCO_wdt_pm),
 	},
 };