From patchwork Mon Mar 6 09:09:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 94911 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1294852qgd; Mon, 6 Mar 2017 01:11:07 -0800 (PST) X-Received: by 10.99.172.2 with SMTP id v2mr19024510pge.100.1488791467255; Mon, 06 Mar 2017 01:11:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si11385516plj.27.2017.03.06.01.11.07; Mon, 06 Mar 2017 01:11:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbdCFJLF (ORCPT + 5 others); Mon, 6 Mar 2017 04:11:05 -0500 Received: from mx2.suse.de ([195.135.220.15]:37030 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752811AbdCFJKq (ORCPT ); Mon, 6 Mar 2017 04:10:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C0DB3ADD9; Mon, 6 Mar 2017 09:09:40 +0000 (UTC) From: Jiri Slaby To: stable@vger.kernel.org Cc: Viresh Kumar , "Rafael J . Wysocki" , Jiri Slaby Subject: [patch added to 3.12-stable] cpufreq: preserve user_policy across suspend/resume Date: Mon, 6 Mar 2017 10:09:23 +0100 Message-Id: <20170306090936.30522-11-jslaby@suse.cz> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170306090936.30522-1-jslaby@suse.cz> References: <20170306090936.30522-1-jslaby@suse.cz> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Viresh Kumar This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. -- 2.12.0 =============== 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 Signed-off-by: Viresh Kumar [rjw: Changelog] Signed-off-by: Rafael J. Wysocki Signed-off-by: Jiri Slaby --- 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);