linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
	ego@linux.vnet.ibm.com, linux-pm@vger.kernel.org,
	rjw@rjwysocki.net, shreyas@linux.vnet.ibm.com,
	linux-api@vger.kernel.org
Subject: Re: [PATCH v12] cpufreq: powernv: Add sysfs attributes to show throttle stats
Date: Tue, 22 Mar 2016 17:03:07 +0530	[thread overview]
Message-ID: <20160322113307.GI5272@vireshk-i7> (raw)
In-Reply-To: <1458643717-2847-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com>

I really wanted to Ack this time, but you know I am nitpicking again :(

On 22-03-16, 16:18, Shilpasri G Bhat wrote:
>  static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  {
> -	int base, i;
> +	int base, i, ret;
>  
>  	base = cpu_first_thread_sibling(policy->cpu);
>  
>  	for (i = 0; i < threads_per_core; i++)
>  		cpumask_set_cpu(base + i, policy->cpus);
>  
> +	if (!policy->driver_data) {

Declare ret here, as it is going to be used only within the if block.

> +		ret = sysfs_create_group(&policy->kobj, &throttle_attr_grp);
> +		if (ret) {
> +			pr_info("Failed to create throttle stats directory for cpu %d\n",
> +				policy->cpu);
> +			return ret;
> +		}
> +		/*
> +		 * policy->driver_data is used as a flag for one-time
> +		 * creation of throttle sysfs files.
> +		 */
> +		policy->driver_data = (void *)policy;

This is far better then the ugly solution I suggested on our private chat :),
but you should drop (void *) typecast. Its not required.

-- 
viresh

      reply	other threads:[~2016-03-22 11:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 10:48 [PATCH v12] cpufreq: powernv: Add sysfs attributes to show throttle stats Shilpasri G Bhat
2016-03-22 11:33 ` 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=20160322113307.GI5272@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=ego@linux.vnet.ibm.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rjw@rjwysocki.net \
    --cc=shilpa.bhat@linux.vnet.ibm.com \
    --cc=shreyas@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).