Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1362660

Re: [PATCH v12] cpufreq: powernv: Add sysfs attributes to show throttle stats

From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v12] cpufreq: powernv: Add sysfs attributes to show throttle stats
Date 2016-03-22 12:40 +0100
Message-ID <rfsPg-3If-37@gated-at.bofh.it> (permalink)
References <rfsmg-3ve-83@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v12] cpufreq: powernv: Add sysfs attributes to show throttle stats Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2016-03-22 12:10 +0100
  Re: [PATCH v12] cpufreq: powernv: Add sysfs attributes to show  throttle stats Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-22 12:40 +0100

csiph-web