Message ID | 20230226225406.979703-15-daniel.lezcano@linaro.org (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Daniel Lezcano |
Headers | show |
Series | Self-encapsulate the thermal zone device structure | expand |
Hi Adam, are you ok with this patch ? On 26/02/2023 23:54, Daniel Lezcano wrote: > The driver is reading the passive polling rate in the thermal zone > structure. We want to prevent the drivers to rummage around in the > thermal zone structure. > > On the other side, the delay is what the driver passed to the > thermal_zone_device_register() function, so it has already the > information. > > Reuse the information we have instead of reading the information we > set. > > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> > --- > drivers/thermal/da9062-thermal.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c > index e7097f354750..2d31b1f73423 100644 > --- a/drivers/thermal/da9062-thermal.c > +++ b/drivers/thermal/da9062-thermal.c > @@ -41,6 +41,8 @@ > > #define DA9062_MILLI_CELSIUS(t) ((t) * 1000) > > +static unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; > + > struct da9062_thermal_config { > const char *name; > }; > @@ -95,7 +97,10 @@ static void da9062_thermal_poll_on(struct work_struct *work) > thermal_zone_device_update(thermal->zone, > THERMAL_EVENT_UNSPECIFIED); > > - delay = thermal->zone->passive_delay_jiffies; > + /* > + * pp_tmp is between 1s and 10s, so we can round the jiffies > + */ > + delay = round_jiffies(msecs_to_jiffies(pp_tmp)); > queue_delayed_work(system_freezable_wq, &thermal->work, delay); > return; > } > @@ -155,7 +160,6 @@ static int da9062_thermal_probe(struct platform_device *pdev) > { > struct da9062 *chip = dev_get_drvdata(pdev->dev.parent); > struct da9062_thermal *thermal; > - unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; > const struct of_device_id *match; > int ret = 0; > > @@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device *pdev) > } > > dev_dbg(&pdev->dev, > - "TJUNC temperature polling period set at %d ms\n", > - jiffies_to_msecs(thermal->zone->passive_delay_jiffies)); > + "TJUNC temperature polling period set at %d ms\n", pp_tmp); > > ret = platform_get_irq_byname(pdev, "THERMAL"); > if (ret < 0)
On 27/02/2023 18:14, Daniel Lezcano wrote: >Hi Adam, > >are you ok with this patch ? Hi Daniel, Yep, looks good to me: On 26/02/2023 23:54, Daniel Lezcano wrote: > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> > --- > drivers/thermal/da9062-thermal.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com>
On 28/02/2023 11:04, DLG Adam Ward wrote: > On 27/02/2023 18:14, Daniel Lezcano wrote: >> Hi Adam, >> >> are you ok with this patch ? > > Hi Daniel, > Yep, looks good to me: > > On 26/02/2023 23:54, Daniel Lezcano wrote: >> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> >> --- >> drivers/thermal/da9062-thermal.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) > > Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Thanks
diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index e7097f354750..2d31b1f73423 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -41,6 +41,8 @@ #define DA9062_MILLI_CELSIUS(t) ((t) * 1000) +static unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; + struct da9062_thermal_config { const char *name; }; @@ -95,7 +97,10 @@ static void da9062_thermal_poll_on(struct work_struct *work) thermal_zone_device_update(thermal->zone, THERMAL_EVENT_UNSPECIFIED); - delay = thermal->zone->passive_delay_jiffies; + /* + * pp_tmp is between 1s and 10s, so we can round the jiffies + */ + delay = round_jiffies(msecs_to_jiffies(pp_tmp)); queue_delayed_work(system_freezable_wq, &thermal->work, delay); return; } @@ -155,7 +160,6 @@ static int da9062_thermal_probe(struct platform_device *pdev) { struct da9062 *chip = dev_get_drvdata(pdev->dev.parent); struct da9062_thermal *thermal; - unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; const struct of_device_id *match; int ret = 0; @@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device *pdev) } dev_dbg(&pdev->dev, - "TJUNC temperature polling period set at %d ms\n", - jiffies_to_msecs(thermal->zone->passive_delay_jiffies)); + "TJUNC temperature polling period set at %d ms\n", pp_tmp); ret = platform_get_irq_byname(pdev, "THERMAL"); if (ret < 0)
The driver is reading the passive polling rate in the thermal zone structure. We want to prevent the drivers to rummage around in the thermal zone structure. On the other side, the delay is what the driver passed to the thermal_zone_device_register() function, so it has already the information. Reuse the information we have instead of reading the information we set. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/thermal/da9062-thermal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)