Skip to content

Commit 0adad09

Browse files
dlezcanorafaeljw
authored andcommitted
thermal/drivers/da9062: Don't access the thermal zone device fields
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> Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent dbb0ea1 commit 0adad09

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/thermal/da9062-thermal.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
#define DA9062_MILLI_CELSIUS(t) ((t) * 1000)
4343

44+
static unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD;
45+
4446
struct da9062_thermal_config {
4547
const char *name;
4648
};
@@ -95,7 +97,10 @@ static void da9062_thermal_poll_on(struct work_struct *work)
9597
thermal_zone_device_update(thermal->zone,
9698
THERMAL_EVENT_UNSPECIFIED);
9799

98-
delay = thermal->zone->passive_delay_jiffies;
100+
/*
101+
* pp_tmp is between 1s and 10s, so we can round the jiffies
102+
*/
103+
delay = round_jiffies(msecs_to_jiffies(pp_tmp));
99104
queue_delayed_work(system_freezable_wq, &thermal->work, delay);
100105
return;
101106
}
@@ -155,7 +160,6 @@ static int da9062_thermal_probe(struct platform_device *pdev)
155160
{
156161
struct da9062 *chip = dev_get_drvdata(pdev->dev.parent);
157162
struct da9062_thermal *thermal;
158-
unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD;
159163
const struct of_device_id *match;
160164
int ret = 0;
161165

@@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device *pdev)
208212
}
209213

210214
dev_dbg(&pdev->dev,
211-
"TJUNC temperature polling period set at %d ms\n",
212-
jiffies_to_msecs(thermal->zone->passive_delay_jiffies));
215+
"TJUNC temperature polling period set at %d ms\n", pp_tmp);
213216

214217
ret = platform_get_irq_byname(pdev, "THERMAL");
215218
if (ret < 0)

0 commit comments

Comments
 (0)