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>
Subject: Re: [PATCH] cpufreq: Drop unnecessary arguments from two functions
Date: Wed, 22 Jul 2015 12:16:48 +0530 [thread overview]
Message-ID: <20150722064648.GA30970@linux> (raw)
In-Reply-To: <1710735.NHMxY7dJsV@vostro.rjw.lan>
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
next prev parent reply other threads:[~2015-07-22 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 2:09 [PATCH] cpufreq: Drop unnecessary arguments from two functions Rafael J. Wysocki
2015-07-22 6:46 ` Viresh Kumar [this message]
2015-07-22 17:48 ` [PATCH v2] " Rafael J. Wysocki
2015-07-22 20:15 ` 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=20150722064648.GA30970@linux \
--to=viresh.kumar@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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).