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


Groups > linux.kernel > #1189681

Re: [PATCH] cpufreq: Drop unnecessary arguments from two functions

From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] cpufreq: Drop unnecessary arguments from two functions
Date 2015-07-22 08:50 +0200
Message-ID <pOW0O-7v8-15@gated-at.bofh.it> (permalink)
References <pORkt-Iv-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 22-07-15, 04:09, Rafael J. Wysocki wrote:
>  static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
>  {
>  	unsigned int cpu = dev->id;
> +	struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu);
>  	int ret;
>  
>  	/*
> @@ -1530,7 +1525,6 @@ static int cpufreq_remove_dev(struct dev
>  	 * link or free policy here.
>  	 */
>  	if (cpu_is_offline(cpu)) {
> -		struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu);
>  		struct cpumask mask;
>  
>  		if (!policy)
> @@ -1547,17 +1541,18 @@ static int cpufreq_remove_dev(struct dev
>  			remove_cpu_dev_symlink(policy, cpu);
>  			return 0;
>  		}
> +	} else {
> +		ret = __cpufreq_remove_dev_prepare(dev);
> +		if (!ret)
> +			ret = __cpufreq_remove_dev_finish(dev);
>  
> -		cpufreq_policy_free(policy, true);
> -		return 0;
> +		/* The CPU is online, so the policy cannot be inactive here. */
> +		if (ret)
> +			return ret;
>  	}
>  
> -	ret = __cpufreq_remove_dev_prepare(dev, sif);
> -
> -	if (!ret)
> -		ret = __cpufreq_remove_dev_finish(dev, sif);
> -
> -	return ret;
> +	cpufreq_policy_free(policy, true);

You need to check for policy_is_inactive(policy) before freeing
policy. cpufreq_remove_dev() will be called one by one for all CPUs of
a policy ..

-- 
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] cpufreq: Drop unnecessary arguments from two functions Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-22 08:50 +0200

csiph-web