lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 15 Apr 2014 11:26:06 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Stratos Karafotis <stratosk@...aphore.gr>
Cc:	Zhang Rui <rui.zhang@...el.com>,
	Eduardo Valentin <eduardo.valentin@...com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 14/20] thermal: cpu_cooling: Use cpufreq_for_each_valid_entry
 macro for iteration

On 15 April 2014 02:40, Stratos Karafotis <stratosk@...aphore.gr> wrote:
> The cpufreq core supports the cpufreq_for_each_valid_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@...aphore.gr>
> ---
>  drivers/thermal/cpu_cooling.c | 33 +++++++++++++--------------------
>  1 file changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index 4246262..3040629 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -144,11 +144,11 @@ static int get_property(unsigned int cpu, unsigned long input,
>                         unsigned int *output,
>                         enum cpufreq_cooling_property property)
>  {
> -       int i, j;
> +       int i;
>         unsigned long max_level = 0, level = 0;
>         unsigned int freq = CPUFREQ_ENTRY_INVALID;
>         int descend = -1;
> -       struct cpufreq_frequency_table *table =
> +       struct cpufreq_frequency_table *pos, *table =
>                                         cpufreq_frequency_get_table(cpu);
>
>         if (!output)
> @@ -157,20 +157,16 @@ static int get_property(unsigned int cpu, unsigned long input,
>         if (!table)
>                 return -EINVAL;
>
> -       for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
> -               /* ignore invalid entries */
> -               if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
> -                       continue;
> -
> +       cpufreq_for_each_valid_entry(pos, table) {
>                 /* ignore duplicate entry */
> -               if (freq == table[i].frequency)
> +               if (freq == pos->frequency)
>                         continue;
>
>                 /* get the frequency order */
>                 if (freq != CPUFREQ_ENTRY_INVALID && descend == -1)
> -                       descend = !!(freq > table[i].frequency);
> +                       descend = !!(freq > pos->frequency);

drop !! as well, its not required here. Mention that in log.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ