public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: "Prakash, Prashanth" <pprakash@codeaurora.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: create sysfs symlink for cpus onlined after boot
Date: Mon, 10 Apr 2017 15:41:12 +0530	[thread overview]
Message-ID: <20170410101112.GJ24555@vireshk-i7> (raw)
In-Reply-To: <7178193.VD2MsPrHSl@aspire.rjw.lan>

On 27-03-17, 19:29, Rafael J. Wysocki wrote:
> OK, queued up, thanks!
> 
> I'll push it for merging by the end of the week unless someone (Viresh in
> particular) finds any problems with it.

Sorry for being late to the party. I don't see any cases where this
would break, but maybe we can simplify things by always creating links
while onlining a CPU.

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index bc96d423781a..f700e06d4bad 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -922,9 +922,6 @@ static void add_cpu_dev_symlink(struct cpufreq_policy *policy, unsigned int cpu)
 {
        struct device *dev = get_cpu_device(cpu);
 
-       if (!dev)
-               return;
-
        if (cpumask_test_and_set_cpu(cpu, policy->real_cpus))
                return;
 
@@ -1013,6 +1010,8 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cp
 {
        int ret = 0;
 
+       add_cpu_dev_symlink(policy, cpu);
+
        /* Has this CPU been taken care of already? */
        if (cpumask_test_cpu(cpu, policy->cpus))
                return 0;
@@ -1188,10 +1187,8 @@ static int cpufreq_online(unsigned int cpu)
                policy->user_policy.min = policy->min;
                policy->user_policy.max = policy->max;
 
-               for_each_cpu(j, policy->related_cpus) {
+               for_each_cpu(j, policy->related_cpus)
                        per_cpu(cpufreq_cpu_data, j) = policy;
-                       add_cpu_dev_symlink(policy, j);
-               }
        } else {
                policy->min = policy->user_policy.min;
                policy->max = policy->user_policy.max;
@@ -1266,6 +1263,7 @@ static int cpufreq_online(unsigned int cpu)
                goto out_exit_policy;
        }
 
+       add_cpu_dev_symlink(policy, cpu);
        up_write(&policy->rwsem);
 
        kobject_uevent(&policy->kobj, KOBJ_ADD);
@@ -1311,11 +1309,6 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
                        return ret;
        }
 
-       /* Create sysfs link on CPU registration */
-       policy = per_cpu(cpufreq_cpu_data, cpu);
-       if (policy)
-               add_cpu_dev_symlink(policy, cpu);
-
        return 0;
 }
 
-- 
viresh

      reply	other threads:[~2017-04-10 10:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 21:24 [PATCH] cpufreq: create sysfs symlink for cpus onlined after boot Prashanth Prakash
2017-03-23 23:30 ` Rafael J. Wysocki
2017-03-24 16:31   ` Prakash, Prashanth
2017-03-25 13:30     ` Rafael J. Wysocki
2017-03-25 17:15       ` Rafael J. Wysocki
2017-03-26  1:05         ` Rafael J. Wysocki
2017-03-26  1:19           ` Rafael J. Wysocki
2017-03-27 16:55             ` Prakash, Prashanth
2017-03-27 17:29               ` Rafael J. Wysocki
2017-04-10 10:11                 ` 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=20170410101112.GJ24555@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pprakash@codeaurora.org \
    --cc=rafael@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