Messages in this thread | | | Date | Tue, 15 Dec 2020 23:58:32 +0100 | From | Daniel Lezcano <> | Subject | Re: [PATCH 2/4] thermal/core: Precompute the jiffies |
| |
On Tue, Dec 15, 2020 at 09:38:06AM -0500, Thara Gopinath wrote: > Hi Daniel, > > On 12/2/20 7:06 AM, Daniel Lezcano wrote: > > 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. > > A generic comment. You can avoid patch 1 of this series and directly > have patch 2 , right? There is no need to rename polling_delay/passive_delay > to *_delay_ms and then remove it again?
Yes, I can simplify that.
> > > > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> > > ---
[ ... ]
> > +static inline void thermal_zone_set_polling_delay( > > + struct thermal_zone_device *tz, int delay_ms) > > +{ > > + tz->polling_delay_ms = delay_ms; > > + tz->polling_delay_jiffies = msecs_to_jiffies(delay_ms); > > + if (delay_ms > 1000) > > + tz->polling_delay_jiffies = round_jiffies(tz->polling_delay_jiffies); > > +} > > How about one function instead? > static inline void thermal_zone_set_delay_jiffies(int *delay_jiffes, int > delay_ms) > { > *delay_jiffies = msecs_to_jiffies(delay_ms); > if (delay_ms > 1000) > *delay_jiffies = round_jiffies(*delay_jiffies); > } > > And then calling thermal_zone_set_delay_jiffies(&tz->passive_delay_jiffies, > passive_delay)..
Yes, agree. I'll do this change.
Thanks for the review
-- Daniel
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
| |