public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Rafael Wysocki <rjw@rjwysocki.net>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2] cpufreq: Always remove sysfs cpuX/cpufreq link on ->remove_dev()
Date: Sat, 21 Nov 2015 06:42:09 -0800	[thread overview]
Message-ID: <1448116929.3069.1.camel@linux.intel.com> (raw)
In-Reply-To: <c194a71ce0a2fac9b8a2ee8d12a00ec1642f9784.1448076972.git.viresh.kumar@linaro.org>

On Sat, 2015-11-21 at 09:06 +0530, Viresh Kumar wrote:
> Subsys interface's ->remove_dev() is called when the cpufreq driver
> is
> unregistering or the CPU is getting physically removed. We keep
> removing
> the cpuX/cpufreq link for all CPUs except the last one, which is a
> mistake as all CPUs contain a link now.
> 
> Because of this, one CPU from each policy will still contain a link
> (to
> an already removed policyX directory), after the cpufreq driver is
> unregistered.
> 
> Fix that by removing the link first and then only see if the policy
> is
> required to be freed. That will make sure that no links are left out.
> 
> Fixes: 96bdda61f58b ("cpufreq: create cpu/cpufreq/policyX
> directories")
> Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com

Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com
> >
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> [v2] Drop the unnecessary 'return', sorry about that :(
> 
>  drivers/cpufreq/cpufreq.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 7c48e7316d91..a83c995a62df 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1401,13 +1401,10 @@ static void cpufreq_remove_dev(struct device
> *dev, struct subsys_interface *sif)
>  	}
>  
>  	cpumask_clear_cpu(cpu, policy->real_cpus);
> +	remove_cpu_dev_symlink(policy, cpu);
>  
> -	if (cpumask_empty(policy->real_cpus)) {
> +	if (cpumask_empty(policy->real_cpus))
>  		cpufreq_policy_free(policy, true);
> -		return;
> -	}
> -
> -	remove_cpu_dev_symlink(policy, cpu);
>  }
>  
>  static void handle_update(struct work_struct *work)

  reply	other threads:[~2015-11-21 14:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1448074212.3450.4.camel@linux.intel.com>
2015-11-21  3:34 ` [PATCH] cpufreq: Always remove sysfs cpuX/cpufreq link on ->remove_dev() Viresh Kumar
2015-11-21  3:36 ` [PATCH V2] " Viresh Kumar
2015-11-21 14:42   ` Srinivas Pandruvada [this message]
2015-11-23 22:47     ` Rafael J. Wysocki

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=1448116929.3069.1.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.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