diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2020-12-16 23:03:35 +0100 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2021-01-19 22:23:38 +0100 |
commit | 17d399cd9c8936909bc8936a5837b6da9af9c29e (patch) | |
tree | 6c7da345cc161493bc761054d62fca317a76050b /drivers/thermal/thermal_helpers.c | |
parent | thermal/core: Remove unused macro THERMAL_TRIPS_NONE (diff) | |
download | linux-17d399cd9c8936909bc8936a5837b6da9af9c29e.tar.xz linux-17d399cd9c8936909bc8936a5837b6da9af9c29e.zip |
thermal/core: Precompute the delays from msecs to jiffies
The delays are stored in ms units and when the polling function is
called this delay is converted into jiffies at each call.
Instead of doing the conversion again and again, compute the jiffies
at init time and use the value directly when setting the polling.
Cc: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Thara Gopinath <thara.gopinath@linaro.org>
Link: https://lore.kernel.org/r/20201216220337.839878-1-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/thermal/thermal_helpers.c')
-rw-r--r-- | drivers/thermal/thermal_helpers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index c94bc824e5d3..7f50f412e02a 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -175,6 +175,13 @@ exit: mutex_unlock(&tz->lock); } +void thermal_set_delay_jiffies(unsigned long *delay_jiffies, int delay_ms) +{ + *delay_jiffies = msecs_to_jiffies(delay_ms); + if (delay_ms > 1000) + *delay_jiffies = round_jiffies(*delay_jiffies); +} + static void thermal_cdev_set_cur_state(struct thermal_cooling_device *cdev, int target) { |