linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sekhar Nori <nsekhar@ti.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@sisk.pl, arvind.chauhan@arm.com, robin.randhawa@arm.com,
	Steve.Bannister@arm.com, Liviu.Dudau@arm.com,
	charles.garcia-tobin@arm.com, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linaro-kernel@lists.linaro.org,
	Sascha Hauer <kernel@pengutronix.de>,
	Paul Mundt <lethal@linux-sh.org>,
	linux-sh@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/2] cpufreq: drivers: Remove unnecessary assignments of policy-> members
Date: Mon, 25 Mar 2013 09:53:41 +0000	[thread overview]
Message-ID: <51501BD5.2070807@ti.com> (raw)
In-Reply-To: <CAKohpomTt-ajNeh-OwV9X-HNBddJzL=JB+ggFY0msmsuZabvjA@mail.gmail.com>

On 3/25/2013 2:15 PM, Viresh Kumar wrote:
> On 25 March 2013 14:06, Sekhar Nori <nsekhar@ti.com> wrote:
>> There is a line in the code a little above the ones you deleted that
>> also sets these same variables. I guess you were relying on that line to
>> set policy->cur, but that also sets policy->{min, max} which can be
>> cleaned up.
> 
> This code is rather confusing or wrong, this was the state of code before
> this patch:
> 
> 	policy->cur = policy->min = policy->max = davinci_getspeed(0);
> 
> 	if (freq_table) {
> 		result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
> 		if (!result)
> 			cpufreq_frequency_table_get_attr(freq_table,
> 							policy->cpu);
> 	} else {
> 		policy->cpuinfo.min_freq = policy->min;
> 		policy->cpuinfo.max_freq = policy->max;
> 	}
> 
>         policy->min = policy->cpuinfo.min_freq;
>         policy->max = policy->cpuinfo.max_freq;
>         policy->cur = davinci_getspeed(0);
> 
> 
> The tricky part is if/else, where if don't return error if
> cpufreq_frequency_table_cpuinfo() fails. We want to set ->min[max]
> and cpuinfo.min[max] always. And i can see this code not doing that for some
> case even with my patch.
> 
> Possible scenarios:
> 1. Valid freq_table: My patch + what you suggested is required.
> 2. Invalid freq_table: We never set cpuinfo.min[max] with or without my patch
> 3. No freq_table: Only my patch is required.
> 
> If i do what you suggested then 2 and 3 would fail... If you want to
> return error
> in case cpufreq_frequency_table_cpuinfo(), then i can fix it properly.

So down in the cpufreq driver probe below, we bail out if freq_table is
not provided. So all this checking for freq_table in the code you pasted
above is superfluous. If you can clean that part up and add checking for
cpufreq_frequency_table_cpuinfo() as you proposed, I will be glad to
test it out ;)

Thanks,
Sekhar

  reply	other threads:[~2013-03-25  9:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2ece6d9fe8dfb6882a1c83a1cb2404bacc40b22d.1364138740.git.viresh.kumar@linaro.org>
2013-03-24 15:41 ` [PATCH 2/2] cpufreq: drivers: Remove unnecessary assignments of policy-> members Viresh Kumar
2013-03-25  8:48   ` Sekhar Nori
2013-03-25  8:57     ` Viresh Kumar
2013-03-25  9:53       ` Sekhar Nori [this message]
2013-03-25 10:36         ` Viresh Kumar
2013-03-26  6:18           ` Sekhar Nori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51501BD5.2070807@ti.com \
    --to=nsekhar@ti.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=Steve.Bannister@arm.com \
    --cc=arvind.chauhan@arm.com \
    --cc=charles.garcia-tobin@arm.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lethal@linux-sh.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=robin.randhawa@arm.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).