2022-04-26 08:32:37

by Liu Xinpeng

[permalink] [raw]
Subject: [PATCH v4 4/4] watchdog: iTCO_wdg: Make code more clearly with macro definition

Using SET_NOIRQ_SYSTEM_SLEEP_PM_OPS reduces redundant code.

Signed-off-by: Liu Xinpeng <[email protected]>
Reviewed-by: Tzung-Bi Shih <[email protected]>
---
drivers/watchdog/iTCO_wdt.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index 3f2f4343644f..8d24cf4f4ca3 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -635,22 +635,18 @@ static int iTCO_wdt_resume_noirq(struct device *dev)

return 0;
}
+#endif /* CONFIG_PM_SLEEP */

static const struct dev_pm_ops iTCO_wdt_pm = {
- .suspend_noirq = iTCO_wdt_suspend_noirq,
- .resume_noirq = iTCO_wdt_resume_noirq,
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(iTCO_wdt_suspend_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 = &iTCO_wdt_pm,
},
};

--
2.23.0


2022-04-26 08:52:17

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v4 4/4] watchdog: iTCO_wdg: Make code more clearly with macro definition

On 4/26/22 00:10, Liu Xinpeng wrote:
> Using SET_NOIRQ_SYSTEM_SLEEP_PM_OPS reduces redundant code.
>
> Signed-off-by: Liu Xinpeng <[email protected]>
> Reviewed-by: Tzung-Bi Shih <[email protected]>
> ---
> drivers/watchdog/iTCO_wdt.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
> index 3f2f4343644f..8d24cf4f4ca3 100644
> --- a/drivers/watchdog/iTCO_wdt.c
> +++ b/drivers/watchdog/iTCO_wdt.c
> @@ -635,22 +635,18 @@ static int iTCO_wdt_resume_noirq(struct device *dev)
>
> return 0;
> }
> +#endif /* CONFIG_PM_SLEEP */
>
> static const struct dev_pm_ops iTCO_wdt_pm = {
> - .suspend_noirq = iTCO_wdt_suspend_noirq,
> - .resume_noirq = iTCO_wdt_resume_noirq,
> + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(iTCO_wdt_suspend_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 = &iTCO_wdt_pm,
> },
> };
>
Sorry, I fail to see how this is an improvement.

Guenter

2022-04-26 10:56:06

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v4 4/4] watchdog: iTCO_wdg: Make code more clearly with macro definition

On 4/26/22 00:10, Liu Xinpeng wrote:
> Using SET_NOIRQ_SYSTEM_SLEEP_PM_OPS reduces redundant code.
>
> Signed-off-by: Liu Xinpeng <[email protected]>
> Reviewed-by: Tzung-Bi Shih <[email protected]>

Also, Tzung-Bi never sent a Reviewed-by: tag. As with the other patches,
this is completely inappropriate. Really, who gave you that idea ?
You adding such tags without receiving them means we can never trust
your patches again since you are making things up.

Guenter

> ---
> drivers/watchdog/iTCO_wdt.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
> index 3f2f4343644f..8d24cf4f4ca3 100644
> --- a/drivers/watchdog/iTCO_wdt.c
> +++ b/drivers/watchdog/iTCO_wdt.c
> @@ -635,22 +635,18 @@ static int iTCO_wdt_resume_noirq(struct device *dev)
>
> return 0;
> }
> +#endif /* CONFIG_PM_SLEEP */
>
> static const struct dev_pm_ops iTCO_wdt_pm = {
> - .suspend_noirq = iTCO_wdt_suspend_noirq,
> - .resume_noirq = iTCO_wdt_resume_noirq,
> + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(iTCO_wdt_suspend_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 = &iTCO_wdt_pm,
> },
> };
>