Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1410161 > unrolled thread

Re: [PATCH v2 1/3] cpufreq: add resolve_freq driver callback

Started byViresh Kumar <viresh.kumar@linaro.org>
First post2016-05-31 13:20 +0200
Last post2016-05-31 20:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 1/3] cpufreq: add resolve_freq driver callback Viresh Kumar <viresh.kumar@linaro.org> - 2016-05-31 13:20 +0200
    Re: [PATCH v2 1/3] cpufreq: add resolve_freq driver callback Steve Muckle <steve.muckle@linaro.org> - 2016-05-31 20:20 +0200

#1410161 — Re: [PATCH v2 1/3] cpufreq: add resolve_freq driver callback

FromViresh Kumar <viresh.kumar@linaro.org>
Date2016-05-31 13:20 +0200
SubjectRe: [PATCH v2 1/3] cpufreq: add resolve_freq driver callback
Message-ID<rEPSh-20r-19@gated-at.bofh.it>
On 25-05-16, 19:52, Steve Muckle wrote:
> +unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
> +					 unsigned int target_freq)
> +{
> +	struct cpufreq_frequency_table *freq_table;
> +	int index, retval;
> +
> +	clamp_val(target_freq, policy->min, policy->max);

Rafael will kill me for this, as I have fallen into the same trap and
copied your *incorrect* code :(

This is a useless statement unless you do:

target_freq = clamp_val(target_freq, policy->min, policy->max);

-- 
viresh

[toc] | [next] | [standalone]


#1410513

FromSteve Muckle <steve.muckle@linaro.org>
Date2016-05-31 20:20 +0200
Message-ID<rEWqJ-68v-11@gated-at.bofh.it>
In reply to#1410161
On Tue, May 31, 2016 at 04:44:51PM +0530, Viresh Kumar wrote:
> On 25-05-16, 19:52, Steve Muckle wrote:
> > +unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
> > +					 unsigned int target_freq)
> > +{
> > +	struct cpufreq_frequency_table *freq_table;
> > +	int index, retval;
> > +
> > +	clamp_val(target_freq, policy->min, policy->max);
> 
> Rafael will kill me for this, as I have fallen into the same trap and
> copied your *incorrect* code :(
> 
> This is a useless statement unless you do:
> 
> target_freq = clamp_val(target_freq, policy->min, policy->max);

Well I wouldn't worry too much, I copied it from Rafael's code in
cpufreq_driver_fast_switch() which also has this problem and needs to be
fixed.

Perhaps clamp_val could be changed to force the compiler to check that
its return value is being used.

thanks,
Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web