From patchwork Wed Aug 14 13:31:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19114 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AAEFC2390D for ; Wed, 14 Aug 2013 13:32:55 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 6sf11151692qeb.5 for ; Wed, 14 Aug 2013 06:32:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Hlp02v0J0Rlh7hOPPvl3yRRussZsgSlGQb7ECF/7yp4=; b=Jvf7FSKWoYeawHmvqQVbWV51ZlYtqzGxqcvtiOespnSbe1Yio5tkkS3Alt4uih8BX7 O92B+hTfBr61EDKZLNVy3KlfYpkmulcW88FmIg4TbnFDdwq1iI1K2OrMzTYv3EMufPL+ RBLnsfhwwTtcbJTO7L/DhYkU0el0/9qV0TdvgIgvpgMnqs0Gf3LVCeHWZ/pQaZhosxEq UnbfZsd+mI4tPGdRixF7C14yLr0pwcetCloYG20Kce7A35AVk+thgsieSdzzuAgHngbi hYv0gcXs0S6N2vpu5r8BpuiLGaopsQ9KN+TxZPCi4USzGuU0WHM+8H6KEUm97bZzKHMJ DTLA== X-Received: by 10.58.118.201 with SMTP id ko9mr2448562veb.8.1376487175324; Wed, 14 Aug 2013 06:32:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.110.195 with SMTP id ic3ls3181345qeb.62.gmail; Wed, 14 Aug 2013 06:32:55 -0700 (PDT) X-Received: by 10.52.73.229 with SMTP id o5mr78398vdv.54.1376487175186; Wed, 14 Aug 2013 06:32:55 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id qc1si11031304vec.8.2013.08.14.06.32.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 06:32:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id cy12so7704700veb.32 for ; Wed, 14 Aug 2013 06:32:55 -0700 (PDT) X-Gm-Message-State: ALoCoQlClt7vltDTo5RwsO8lv5BNkB1YbHWfNo+t12WfuOTHGkD51mqoaCvxauXVd+t1l2/PVDy+ X-Received: by 10.52.103.101 with SMTP id fv5mr1092567vdb.31.1376487175066; Wed, 14 Aug 2013 06:32:55 -0700 (PDT) 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.220.174.196 with SMTP id u4csp213035vcz; Wed, 14 Aug 2013 06:32:54 -0700 (PDT) X-Received: by 10.66.196.110 with SMTP id il14mr589076pac.130.1376487174089; Wed, 14 Aug 2013 06:32:54 -0700 (PDT) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by mx.google.com with ESMTPS id fa5si11076154pab.332.2013.08.14.06.32.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 06:32:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.177 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.177; Received: by mail-pd0-f177.google.com with SMTP id y10so175059pdj.8 for ; Wed, 14 Aug 2013 06:32:53 -0700 (PDT) X-Received: by 10.68.230.131 with SMTP id sy3mr9967680pbc.34.1376487173574; Wed, 14 Aug 2013 06:32:53 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id jf4sm50358049pbb.19.2013.08.14.06.32.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 14 Aug 2013 06:32:52 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar , Andrew Lunn , "David S. Miller" , Dmitry Eremin-Solenikov , Eric Miao , Hans-Christian Egtvedt , Jesper Nilsson , John Crispin , Kukjin Kim , Linus Walleij , linux-cris-kernel@axis.com, linux-sh@vger.kernel.org, Mikael Starvik , Paul Mundt , Russell King , Santosh Shilimkar , Sekhar Nori , Shawn Guo , spear-devel@list.st.com, Stephen Warren , Steven Miao , Tony Luck Subject: [PATCH 01/37] cpufreq: call cpufreq_driver->get() after calling ->init() Date: Wed, 14 Aug 2013 19:01:50 +0530 Message-Id: <2345f33fd6215a0754a71b4dc1ca02f8ff874211.1376486713.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: 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.173 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: , Almost all drivers set policy->cur with current cpu frequency in their ->init() part. This can be done for all of them at core level and so they wouldn't need to do it. This patch adds supporting code in cpufreq core for calling get() after we have called init() for a policy. Cc: Andrew Lunn Cc: David S. Miller Cc: Dmitry Eremin-Solenikov Cc: Eric Miao Cc: Hans-Christian Egtvedt Cc: Jesper Nilsson Cc: John Crispin Cc: Kukjin Kim Cc: Linus Walleij Cc: linux-cris-kernel@axis.com Cc: linux-sh@vger.kernel.org Cc: Mikael Starvik Cc: Paul Mundt Cc: Russell King Cc: Santosh Shilimkar Cc: Sekhar Nori Cc: Shawn Guo Cc: spear-devel@list.st.com Cc: Stephen Warren Cc: Steven Miao Cc: Tony Luck Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4d37306..a7a1d3e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1038,6 +1038,14 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, goto err_set_policy_cpu; } + if (cpufreq_driver->get) { + policy->cur = cpufreq_driver->get(policy->cpu); + if (!policy->cur) { + pr_err("%s: ->get() failed\n", __func__); + goto err_get_freq; + } + } + /* related cpus should atleast have policy->cpus */ cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); @@ -1097,6 +1105,9 @@ err_out_unregister: } write_unlock_irqrestore(&cpufreq_driver_lock, flags); +err_get_freq: + if (cpufreq_driver->exit) + cpufreq_driver->exit(policy); err_set_policy_cpu: per_cpu(cpufreq_policy_cpu, cpu) = -1; cpufreq_policy_free(policy);