From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: Simplify the cpufreq_for_each_valid_entry()
Date: Fri, 26 Feb 2016 08:02:24 +0530 [thread overview]
Message-ID: <20160226023224.GD2639@vireshk-i7> (raw)
In-Reply-To: <1966438.kvLUD13Eaz@vostro.rjw.lan>
On 26-02-16, 00:22, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> That macro uses an internal static inline function that is first
> totally unnecessary and second hard to read, so simplify it and
> get rid of that monster.
>
> No functional changes.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> include/linux/cpufreq.h | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> Index: linux-pm/include/linux/cpufreq.h
> ===================================================================
> --- linux-pm.orig/include/linux/cpufreq.h
> +++ linux-pm/include/linux/cpufreq.h
> @@ -534,16 +534,6 @@ static inline void dev_pm_opp_free_cpufr
> }
> #endif
>
> -static inline bool cpufreq_next_valid(struct cpufreq_frequency_table **pos)
> -{
> - while ((*pos)->frequency != CPUFREQ_TABLE_END)
> - if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
> - return true;
> - else
> - (*pos)++;
> - return false;
> -}
> -
> /*
> * cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
> * @pos: the cpufreq_frequency_table * to use as a loop cursor.
> @@ -560,8 +550,11 @@ static inline bool cpufreq_next_valid(st
> * @table: the cpufreq_frequency_table * to iterate over.
> */
>
> -#define cpufreq_for_each_valid_entry(pos, table) \
> - for (pos = table; cpufreq_next_valid(&pos); pos++)
> +#define cpufreq_for_each_valid_entry(pos, table) \
> + for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++) \
> + if (pos->frequency == CPUFREQ_ENTRY_INVALID) \
> + continue; \
> + else
>
> int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
> struct cpufreq_frequency_table *table);
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
prev parent reply other threads:[~2016-02-26 2:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 23:22 [PATCH] cpufreq: Simplify the cpufreq_for_each_valid_entry() Rafael J. Wysocki
2016-02-26 2:32 ` Viresh Kumar [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=20160226023224.GD2639@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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