linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: viresh kumar <viresh.kumar@linaro.org>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH Resend] cpufreq: remove sysfs files for CPU which failed to come back after resume
Date: Mon, 23 Dec 2013 21:15:40 +0530	[thread overview]
Message-ID: <52B85AA4.6070609@linaro.org> (raw)
In-Reply-To: <87pponx07s.fsf@nemi.mork.no>

On Monday 23 December 2013 05:12 PM, Bjørn Mork wrote:
> That would be great.  This could be just me.  I am quite good at
> breaking stuff.

No its not you. While we tried to make sure everything is preserved,
few special things still stayed out :)

And they are solved with this patch, log should be good enough to give
proper reasoning:

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Mon, 23 Dec 2013 20:51:54 +0530
Subject: [PATCH] cpufreq: preserve user_policy across suspend/resume

In __cpufreq_add_dev() we are reinitializing user_policy with default values and
hence would loose values of user_policy.{min|max|policy|governor} fields.

Preserve them by not overriding these for suspend/resume.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 16d7b4a..c5c3dac 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -839,9 +839,6 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)

 	/* set default policy */
 	ret = cpufreq_set_policy(policy, &new_policy);
-	policy->user_policy.policy = policy->policy;
-	policy->user_policy.governor = policy->governor;
-
 	if (ret) {
 		pr_debug("setting policy failed\n");
 		if (cpufreq_driver->exit)
@@ -1069,8 +1066,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
 	 */
 	cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);

-	policy->user_policy.min = policy->min;
-	policy->user_policy.max = policy->max;
+	if (!frozen) {
+		policy->user_policy.min = policy->min;
+		policy->user_policy.max = policy->max;
+	}

 	blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
 				     CPUFREQ_START, policy);
@@ -1101,6 +1100,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,

 	cpufreq_init_policy(policy);

+	if (!frozen) {
+		policy->user_policy.policy = policy->policy;
+		policy->user_policy.governor = policy->governor;
+	}
+
 	kobject_uevent(&policy->kobj, KOBJ_ADD);
 	up_read(&cpufreq_rwsem);



  reply	other threads:[~2013-12-23 15:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 15:56 [PATCH Resend] cpufreq: remove sysfs files for CPU which failed to come back after resume Viresh Kumar
2013-12-22  1:00 ` Rafael J. Wysocki
2013-12-23  5:55   ` Bjørn Mork
2013-12-23  6:02     ` Viresh Kumar
2013-12-23  6:55       ` Bjørn Mork
2013-12-23  7:55         ` viresh kumar
2013-12-23  9:23           ` Bjørn Mork
2013-12-23 10:45             ` Viresh Kumar
2013-12-23 10:57               ` Bjørn Mork
2013-12-23 11:13                 ` Viresh Kumar
2013-12-23 11:42                   ` Bjørn Mork
2013-12-23 15:45                     ` viresh kumar [this message]
2013-12-24  0:35                       ` Rafael J. Wysocki
2013-12-24  0:27                         ` Viresh Kumar
2013-12-24  0:43                           ` 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=52B85AA4.6070609@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=bjorn@mork.no \
    --cc=cpufreq@vger.kernel.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).