All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Jiri Slaby <jslaby@suse.cz>
Subject: [patch added to 3.12-stable] cpufreq: preserve user_policy across suspend/resume
Date: Mon,  6 Mar 2017 10:09:23 +0100	[thread overview]
Message-ID: <20170306090936.30522-11-jslaby@suse.cz> (raw)
In-Reply-To: <20170306090936.30522-1-jslaby@suse.cz>

From: Viresh Kumar <viresh.kumar@linaro.org>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 08fd8c1cf0a99abf34e09a8b99b74872e0d73a23 upstream.

Prevent __cpufreq_add_dev() from overwriting the existing values of
user_policy.{min|max|policy|governor} with defaults during resume
from system suspend.

Fixes: 5302c3fb2e62 ("cpufreq: Perform light-weight init/teardown during suspend/resume")
Reported-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 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 355a5597e098..a7b2a5f53b2b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -860,9 +860,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)
@@ -1091,8 +1088,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);
@@ -1123,6 +1122,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);
 
-- 
2.12.0

  parent reply	other threads:[~2017-03-06  9:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06  9:09 [patch added to 3.12-stable] ext4: validate s_first_meta_bg at mount time Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] ext4: fix fencepost in s_first_meta_bg validation Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] ocfs2: do not write error flag to user structure we cannot copy from/to Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] 6lowpan: release device on error path Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] mfd: pm8921: Potential NULL dereference in pm8921_remove() Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] Staging: vt6655-6: potential NULL dereference in hostap_disable_hostapd() Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] drm/nv50/disp: min/max are reversed in nv50_crtc_gamma_set() Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] cpufreq: fix garbage kobjects on errors during suspend/resume Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] cpufreq: remove sysfs files for CPUs which failed to come back after resume Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] cpufreq: Clean up after a failing light-weight initialization Jiri Slaby
2017-03-06  9:09 ` Jiri Slaby [this message]
2017-03-06  9:09 ` [patch added to 3.12-stable] ipv6: fix the use of pcpu_tstats in ip6_tunnel Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] net: 6lowpan: fix lowpan_header_create non-compression memcpy call Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] ipv6: simplify detection of first operational link-local address on interface Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] net: sctp: rework multihoming retransmission path selection to rfc4960 Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] vti4: Don't count header length twice Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] PCI: mvebu: Use max_t() instead of max(resource_size_t,) Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] PCI: mvebu: split PCIe BARs into multiple MBus windows when needed Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] gianfar: Check if phydev present on ethtool -A Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] net: filter: x86: fix JIT address randomization Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] net: filter: s390: " Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] USB: cdc-acm: fix double usb_autopm_put_interface() in acm_port_activate() Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] USB: cdc-acm: fix open and suspend race Jiri Slaby
2017-03-06  9:09 ` [patch added to 3.12-stable] USB: cdc-acm: fix failed open not being detected Jiri Slaby

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=20170306090936.30522-11-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.