From patchwork Tue Dec 24 01:41:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 22741 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DCF9920555 for ; Tue, 24 Dec 2013 01:41:20 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id at1sf26562285iec.7 for ; Mon, 23 Dec 2013 17:41:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe:content-type:content-transfer-encoding; bh=CBFtOhSu9Lz1RG99hvn3Dom9g9LFLHDwBUdmcNe5BeU=; b=JrRkQ8Oc7ULC6ARu2jjEryqD8A7bf/zejFdfem2I7UBHZrNyCrxl2qEY6OS6ECB5wm oXf0MovUf3gd64Ganh8DwlUgXXOR78xBMkFpkP0HS8JmxSELUi43avOlgJwowuDwNItz bNCD7d7TP5ejCuS3hZIyLgRzzca5o7iKjPJXKR3NVNWPtjnOT/B+Y5CzJL6Q9PIjo8CV LuO2YMin8PEDaczFhhwKnG4cNj5LPHiDQIDgADDeKFFvt+WoCk6xMMOCgsTHrcHO7g/o xkrA0frDifNvl92y01b2FEOs2ZSzBjCYWRlKRODnaXmlft52t3dOmyyqC5ptBaG/kxqz a+ig== X-Gm-Message-State: ALoCoQkZbNMWVKW0LAi7Iq4LrxNjiwQPoD+9HLJ2COam4bWRuRkwe60A2ZTlFhwNpZVfwQ5a1SmE X-Received: by 10.182.111.134 with SMTP id ii6mr11852929obb.38.1387849280100; Mon, 23 Dec 2013 17:41:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.49 with SMTP id f17ls1749857qey.54.gmail; Mon, 23 Dec 2013 17:41:19 -0800 (PST) X-Received: by 10.221.39.195 with SMTP id tn3mr14843973vcb.2.1387849279942; Mon, 23 Dec 2013 17:41:19 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id ls10si4196330vec.95.2013.12.23.17.41.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Dec 2013 17:41:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jx11so3283246veb.34 for ; Mon, 23 Dec 2013 17:41:19 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr184441vcn.21.1387849279745; Mon, 23 Dec 2013 17:41:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp264504ved; Mon, 23 Dec 2013 17:41:19 -0800 (PST) X-Received: by 10.68.242.163 with SMTP id wr3mr29873030pbc.84.1387849278813; Mon, 23 Dec 2013 17:41:18 -0800 (PST) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id qx4si14066438pbc.195.2013.12.23.17.41.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Dec 2013 17:41:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.178 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id y10so5777401pdj.9 for ; Mon, 23 Dec 2013 17:41:18 -0800 (PST) X-Received: by 10.66.182.199 with SMTP id eg7mr29375138pac.135.1387849278445; Mon, 23 Dec 2013 17:41:18 -0800 (PST) Received: from localhost ([122.167.204.159]) by mx.google.com with ESMTPSA id gf5sm37382552pbc.22.2013.12.23.17.41.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Dec 2013 17:41:17 -0800 (PST) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn@mork.no, Viresh Kumar Subject: =?UTF-8?q?=5BPATCH=202/2=5D=20cpufreq=3A=20preserve=20user=5Fpolicy=20across=20suspend/resume?= Date: Tue, 24 Dec 2013 07:11:01 +0530 Message-Id: <03303e46795a89272ba66d5fa230cbfdb9a177a9.1387848958.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. Reported-by: Bjørn Mork Signed-off-by: Viresh Kumar --- 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 0a48e71..59e918e 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) @@ -1077,8 +1074,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); @@ -1109,6 +1108,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);