Message ID | c024f35421c67d7b1a3a20bc280fb5131ce6db43.1604567599.git.viresh.kumar@linaro.org |
---|---|
State | New |
Headers | show |
Series | thermal: Rearrange thermal_zone_device_set_polling() | expand |
On 05/11/2020 10:13, Viresh Kumar wrote: > Rearrange thermal_zone_device_set_polling() to make it more readable and > reduce duplicate code. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- Hi Viresh, I have a series where this function is reworked and conflicts with your changes. The delay is converted into jiffies at init time and no conversion happen in this function anymore. Do you mind if we discard this patch ? > drivers/thermal/thermal_core.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index c6d74bc1c90b..7dfab370a369 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -291,16 +291,17 @@ static int __init thermal_register_governors(void) > static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, > int delay) > { > - if (delay > 1000) > - mod_delayed_work(system_freezable_power_efficient_wq, > - &tz->poll_queue, > - round_jiffies(msecs_to_jiffies(delay))); > - else if (delay) > + if (delay) { > + int time = msecs_to_jiffies(delay); > + > + if (delay > 1000) > + time = round_jiffies(time); > + > mod_delayed_work(system_freezable_power_efficient_wq, > - &tz->poll_queue, > - msecs_to_jiffies(delay)); > - else > + &tz->poll_queue, time); > + } else { > cancel_delayed_work(&tz->poll_queue); > + } > } > > static inline bool should_stop_polling(struct thermal_zone_device *tz) > -- <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
On 05-11-20, 12:32, Daniel Lezcano wrote: > On 05/11/2020 10:13, Viresh Kumar wrote: > > Rearrange thermal_zone_device_set_polling() to make it more readable and > > reduce duplicate code. > > > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > > --- > > Hi Viresh, > > I have a series where this function is reworked and conflicts with your > changes. The delay is converted into jiffies at init time and no > conversion happen in this function anymore. > > Do you mind if we discard this patch ? Discarded :) -- viresh
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index c6d74bc1c90b..7dfab370a369 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -291,16 +291,17 @@ static int __init thermal_register_governors(void) static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, int delay) { - if (delay > 1000) - mod_delayed_work(system_freezable_power_efficient_wq, - &tz->poll_queue, - round_jiffies(msecs_to_jiffies(delay))); - else if (delay) + if (delay) { + int time = msecs_to_jiffies(delay); + + if (delay > 1000) + time = round_jiffies(time); + mod_delayed_work(system_freezable_power_efficient_wq, - &tz->poll_queue, - msecs_to_jiffies(delay)); - else + &tz->poll_queue, time); + } else { cancel_delayed_work(&tz->poll_queue); + } } static inline bool should_stop_polling(struct thermal_zone_device *tz)
Rearrange thermal_zone_device_set_polling() to make it more readable and reduce duplicate code. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/thermal/thermal_core.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) -- 2.25.0.rc1.19.g042ed3e048af