All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stratos Karafotis <stratosk@semaphore.gr>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 02/20] cpufreq: acpi-cpufreq: Use cpufreq_for_each_entry macro for iteration
Date: Tue, 15 Apr 2014 14:00:08 +0300	[thread overview]
Message-ID: <534D1138.90409@semaphore.gr> (raw)
In-Reply-To: <CAKohpok5+Eai=OOs9J+uYp4NaYmovXqkkg_Bvx0025_XyS4xTQ@mail.gmail.com>

On 15/04/2014 08:32 πμ, Viresh Kumar wrote:
> On 15 April 2014 02:38, Stratos Karafotis <stratosk@semaphore.gr> wrote:
>> The cpufreq core supports the cpufreq_for_each_entry macro helper
>> for iteration over the cpufreq_frequency_table, so use it.
>>
>> It should have no functional changes.
>>
>> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
>> ---
>>  drivers/cpufreq/acpi-cpufreq.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
>> index 000e4e0..12a5750 100644
>> --- a/drivers/cpufreq/acpi-cpufreq.c
>> +++ b/drivers/cpufreq/acpi-cpufreq.c
>> @@ -213,7 +213,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
>>
>>  static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
>>  {
>> -       int i;
>> +       struct cpufreq_frequency_table *pos;
>>         struct acpi_processor_performance *perf;
>>
>>         if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
>> @@ -223,11 +223,11 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
>>
>>         perf = data->acpi_data;
>>
>> -       for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
>> -               if (msr == perf->states[data->freq_table[i].driver_data].status)
>> -                       return data->freq_table[i].frequency;
>> +       cpufreq_for_each_entry(pos, data->freq_table) {
>> +               if (msr == perf->states[pos->driver_data].status)
>> +                       return pos->frequency;
>>         }
>> -       return data->freq_table[0].frequency;
>> +       return data->freq_table->frequency;
> 
> This isn't a related change, isn't it? Also it make it less readable.
> So probably
> just leave it as is.
> 

I thought that since we use pointer notation it would be more clear.
But, I will change it according to your suggestion.


Stratos

      reply	other threads:[~2014-04-15 11:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14 21:08 [PATCH 02/20] cpufreq: acpi-cpufreq: Use cpufreq_for_each_entry macro for iteration Stratos Karafotis
2014-04-15  5:32 ` Viresh Kumar
2014-04-15 11:00   ` Stratos Karafotis [this message]

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=534D1138.90409@semaphore.gr \
    --to=stratosk@semaphore.gr \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.