Linux Power Management development
 help / color / mirror / Atom feed
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>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH] cpufreq: Rearrange cpufreq_add_dev()
Date: Thu, 7 Apr 2016 10:00:10 +0530	[thread overview]
Message-ID: <20160407043010.GC14903@vireshk-i7> (raw)
In-Reply-To: <25180596.UsWVYNr6Fj@vostro.rjw.lan>

On 07-04-16, 03:31, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Reorganize the code in cpufreq_add_dev() to avoid using the ret
> variable and reduce the indentation level in it.
> 
> No functional changes.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpufreq/cpufreq.c |   26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> Index: linux-pm/drivers/cpufreq/cpufreq.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/cpufreq.c
> +++ linux-pm/drivers/cpufreq/cpufreq.c
> @@ -1311,26 +1311,24 @@ out_free_policy:
>   */
>  static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
>  {
> +	struct cpufreq_policy *policy;
>  	unsigned cpu = dev->id;
> -	int ret;
>  
>  	dev_dbg(dev, "%s: adding CPU%u\n", __func__, cpu);
>  
> -	if (cpu_online(cpu)) {
> -		ret = cpufreq_online(cpu);
> -	} else {
> -		/*
> -		 * A hotplug notifier will follow and we will handle it as CPU
> -		 * online then.  For now, just create the sysfs link, unless
> -		 * there is no policy or the link is already present.
> -		 */
> -		struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu);
> +	if (cpu_online(cpu))
> +		return cpufreq_online(cpu);
>  
> -		ret = policy && !cpumask_test_and_set_cpu(cpu, policy->real_cpus)
> -			? add_cpu_dev_symlink(policy, cpu) : 0;
> -	}
> +	/*
> +	 * A hotplug notifier will follow and we will handle it as CPU online
> +	 * then.  For now, just create the sysfs link, unless there is no policy
> +	 * or the link is already present.
> +	 */
> +	policy = per_cpu(cpufreq_cpu_data, cpu);
> +	if (!policy || cpumask_test_and_set_cpu(cpu, policy->real_cpus))
> +		return 0;
>  
> -	return ret;
> +	return add_cpu_dev_symlink(policy, cpu);
>  }
>  
>  static void cpufreq_offline(unsigned int cpu)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

      reply	other threads:[~2016-04-07  4:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07  1:31 [PATCH] cpufreq: Rearrange cpufreq_add_dev() Rafael J. Wysocki
2016-04-07  4:30 ` 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=20160407043010.GC14903@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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