2019-07-31 12:59:58

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH] thermal: rcar_gen3_thermal: Use devm_add_action_or_reset() helper

Use the devm_add_action_or_reset() helper instead of open-coding the
same operations.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/thermal/rcar_gen3_thermal.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index a56463308694e937..2db7e7f8baf939fd 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -443,11 +443,10 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
if (ret)
goto error_unregister;

- ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone);
- if (ret) {
- rcar_gen3_hwmon_action(zone);
+ ret = devm_add_action_or_reset(dev, rcar_gen3_hwmon_action,
+ zone);
+ if (ret)
goto error_unregister;
- }

ret = of_thermal_get_ntrips(tsc->zone);
if (ret < 0)
--
2.17.1


2019-07-31 16:35:53

by Ulrich Hecht

[permalink] [raw]
Subject: Re: [PATCH] thermal: rcar_gen3_thermal: Use devm_add_action_or_reset() helper


> On July 31, 2019 at 2:50 PM Geert Uytterhoeven <[email protected]> wrote:
>
>
> Use the devm_add_action_or_reset() helper instead of open-coding the
> same operations.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> drivers/thermal/rcar_gen3_thermal.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index a56463308694e937..2db7e7f8baf939fd 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -443,11 +443,10 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> if (ret)
> goto error_unregister;
>
> - ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone);
> - if (ret) {
> - rcar_gen3_hwmon_action(zone);
> + ret = devm_add_action_or_reset(dev, rcar_gen3_hwmon_action,
> + zone);
> + if (ret)
> goto error_unregister;
> - }
>
> ret = of_thermal_get_ntrips(tsc->zone);
> if (ret < 0)
> --
> 2.17.1
>

Reviewed-by: Ulrich Hecht <[email protected]>

CU
Uli

2019-07-31 21:33:16

by Niklas Söderlund

[permalink] [raw]
Subject: Re: [PATCH] thermal: rcar_gen3_thermal: Use devm_add_action_or_reset() helper

Hi Geert,

Thanks for your work.

On 2019-07-31 14:50:53 +0200, Geert Uytterhoeven wrote:
> Use the devm_add_action_or_reset() helper instead of open-coding the
> same operations.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Reviewed-by: Niklas S?derlund <[email protected]>

> ---
> drivers/thermal/rcar_gen3_thermal.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index a56463308694e937..2db7e7f8baf939fd 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -443,11 +443,10 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> if (ret)
> goto error_unregister;
>
> - ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone);
> - if (ret) {
> - rcar_gen3_hwmon_action(zone);
> + ret = devm_add_action_or_reset(dev, rcar_gen3_hwmon_action,
> + zone);
> + if (ret)
> goto error_unregister;
> - }
>
> ret = of_thermal_get_ntrips(tsc->zone);
> if (ret < 0)
> --
> 2.17.1
>

--
Regards,
Niklas S?derlund

2019-08-28 10:03:27

by Zhang, Rui

[permalink] [raw]
Subject: Re: [PATCH] thermal: rcar_gen3_thermal: Use devm_add_action_or_reset() helper

On Wed, 2019-07-31 at 20:44 +0200, Niklas Söderlund wrote:
> Hi Geert,
>
> Thanks for your work.
>
> On 2019-07-31 14:50:53 +0200, Geert Uytterhoeven wrote:
> > Use the devm_add_action_or_reset() helper instead of open-coding
> > the
> > same operations.
> >
> > Signed-off-by: Geert Uytterhoeven <[email protected]>
>
> Reviewed-by: Niklas Söderlund <[email protected]>
>
Hi, Geert,

https://patchwork.kernel.org/patch/11034969/ is the same fix submitted
a few days earlier, so I will take that patch instead. Thanks for the
patch anyway.

thanks,
rui

> > ---
> > drivers/thermal/rcar_gen3_thermal.c | 7 +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/thermal/rcar_gen3_thermal.c
> > b/drivers/thermal/rcar_gen3_thermal.c
> > index a56463308694e937..2db7e7f8baf939fd 100644
> > --- a/drivers/thermal/rcar_gen3_thermal.c
> > +++ b/drivers/thermal/rcar_gen3_thermal.c
> > @@ -443,11 +443,10 @@ static int rcar_gen3_thermal_probe(struct
> > platform_device *pdev)
> > if (ret)
> > goto error_unregister;
> >
> > - ret = devm_add_action(dev, rcar_gen3_hwmon_action,
> > zone);
> > - if (ret) {
> > - rcar_gen3_hwmon_action(zone);
> > + ret = devm_add_action_or_reset(dev,
> > rcar_gen3_hwmon_action,
> > + zone);
> > + if (ret)
> > goto error_unregister;
> > - }
> >
> > ret = of_thermal_get_ntrips(tsc->zone);
> > if (ret < 0)
> > --
> > 2.17.1
> >
>
>