linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] omap2+: pm: Use if...else instead of goto
Date: Fri, 24 Jun 2011 18:18:19 +0530	[thread overview]
Message-ID: <4E048793.1020505@ti.com> (raw)
In-Reply-To: <1308911742-27394-2-git-send-email-premi@ti.com>

On 6/24/2011 4:05 PM, Sanjeev Premi wrote:
> This patch replaces the use of goto with simple
> if...else syntax. No change in functionality.
>
> This also means that the comment describing the
> dependency between CONFIG_SMP and calculation
> of loops_per_jiffy can be unified.
>
> Signed-off-by: Sanjeev Premi<premi@ti.com>
> ---
Don't see need of this patch as well considering your second patch.
So NAK.

>   arch/arm/mach-omap2/omap2plus-cpufreq.c |   59 +++++++++++++-----------------
>   1 files changed, 26 insertions(+), 33 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> index 1f3b2e1..ce9d534 100644
> --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
> +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> @@ -96,57 +96,50 @@ static int omap_target(struct cpufreq_policy *policy,
>   	if (freqs.old == freqs.new&&  policy->cur == freqs.new)
>   		return ret;
>
> -	if (!is_smp()) {
> -		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
> -		goto set_freq;
> -	}
> -
> -	/* notifiers */
> -	for_each_cpu(i, policy->cpus) {
> -		freqs.cpu = i;
> +	/* Notify transitions */
> +	if (is_smp()) {
> +		for_each_cpu(i, policy->cpus) {
> +			freqs.cpu = i;
> +			cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
> +		}
> +	} else {
>   		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
>   	}
>
> -set_freq:
>   #ifdef CONFIG_CPU_FREQ_DEBUG
>   	pr_info("cpufreq-omap: transition: %u -->  %u\n", freqs.old, freqs.new);
>   #endif
>
>   	ret = clk_set_rate(mpu_clk, freqs.new * 1000);
>
> -	/*
> -	 * Generic CPUFREQ driver jiffy update is under !SMP. So jiffies
> -	 * won't get updated when UP machine cpufreq build with
> -	 * CONFIG_SMP enabled. Below code is added only to manage that
> -	 * scenario
> -	 */
>   	freqs.new = omap_getspeed(policy->cpu);
> -	if (!is_smp()) {
> -		loops_per_jiffy =
> -			 cpufreq_scale(loops_per_jiffy, freqs.old, freqs.new);
> -		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
> -		goto skip_lpj;
> -	}
>
> -#ifdef CONFIG_SMP
>   	/*
> -	 * Note that loops_per_jiffy is not updated on SMP systems in
> -	 * cpufreq driver. So, update the per-CPU loops_per_jiffy value
> -	 * on frequency transition. We need to update all dependent CPUs.
> +	 * In the generic cpufreq driver jiffies are updated only for
> +	 * non-SMP cases. Ensure that jiffies are bing updated for both
> +	 * SMP systems and UP systems built with CONFIG_SMP enabled.
>   	 */
> -	for_each_cpu(i, policy->cpus)
> -		per_cpu(cpu_data, i).loops_per_jiffy =
> -			cpufreq_scale(per_cpu(cpu_data, i).loops_per_jiffy,
> -					freqs.old, freqs.new);
> +	if (is_smp()) {
> +#ifdef CONFIG_SMP
> +		for_each_cpu(i, policy->cpus)
> +			per_cpu(cpu_data, i).loops_per_jiffy =
> +				cpufreq_scale(per_cpu(cpu_data, i).loops_per_jiffy,
> +						freqs.old,
> +						freqs.new);
>   #endif
> +		/* Notify transitions */
> +		for_each_cpu(i, policy->cpus) {
> +			freqs.cpu = i;
> +			cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
> +		}
> +	} else {
> +		loops_per_jiffy = cpufreq_scale(loops_per_jiffy,
> +					freqs.old, freqs.new);
>
> -	/* notifiers */
> -	for_each_cpu(i, policy->cpus) {
> -		freqs.cpu = i;
> +		/* Notify transitions */
>   		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
>   	}
>
> -skip_lpj:
>   	return ret;
>   }
>

  reply	other threads:[~2011-06-24 12:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24 10:35 [PATCH 0/2] omap2+: pm: Fix code syntax and BogoMIPS Sanjeev Premi
2011-06-24 10:35 ` [PATCH 1/2] omap2+: pm: Use if...else instead of goto Sanjeev Premi
2011-06-24 12:48   ` Santosh Shilimkar [this message]
2011-06-24 12:54     ` Premi, Sanjeev
2011-06-24 12:59       ` Santosh Shilimkar
2011-06-24 13:01         ` Premi, Sanjeev
2011-06-24 10:35 ` [PATCH 2/2] omap2+: pm: cpufreq: Fix loops_per_jiffy calculation Sanjeev Premi
2011-06-24 10:43   ` Russell King - ARM Linux
2011-06-24 10:48     ` Premi, Sanjeev
2011-06-24 10:51       ` Russell King - ARM Linux
2011-06-24 11:11         ` Premi, Sanjeev
2011-06-24 12:45         ` Santosh Shilimkar
2011-06-24 12:52           ` Premi, Sanjeev
2011-06-24 13:01             ` Santosh Shilimkar

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=4E048793.1020505@ti.com \
    --to=santosh.shilimkar@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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).