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: 2844587 X-Patchwork-Delegate: lethal@linux-sh.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 375149F271 for ; Wed, 14 Aug 2013 13:44:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77D7D20621 for ; Wed, 14 Aug 2013 13:44:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 232442061C for ; Wed, 14 Aug 2013 13:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759931Ab3HNNdA (ORCPT ); Wed, 14 Aug 2013 09:33:00 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:58143 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759888Ab3HNNcy (ORCPT ); Wed, 14 Aug 2013 09:32:54 -0400 Received: by mail-pd0-f179.google.com with SMTP id v10so6333281pde.24 for ; Wed, 14 Aug 2013 06:32:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Hlp02v0J0Rlh7hOPPvl3yRRussZsgSlGQb7ECF/7yp4=; b=k3Z8DOhjbi5gOXSssS3O35DGzrcpSPdeRWn/PIGFMrzDITEu2zxv2JQBeyjFH4EVJj 4vNIPjyCAOAT48yXZD0cZ/BrZzxQ1/0+dgkLBF+FWwjX94WOaqGPrfRmmY3FBJe+JkwF wfVoVMsXI18kx03Ocoumv4ceFZVDEly2bjzgHL5FoLhOm8ZiS6F12MAYVJNxL6V0v8oV 6B3WvBNBNpmxJGm4oMGQOtElb3qq+YDeSyCYuH3HojzD5a3+JMdD5+wHBfnYxOtYtmJ3 8sVUC0Fkp6I0k9u6WGUp7AY1jzIB1X3wNTcD9cIrBgOFPCJbaZM+2wC/rdkzHr1t8ONx rfJQ== X-Gm-Message-State: ALoCoQlLJj2wv6HLvIvcvMzHBws8r9b7gJLfU+B3HM3ycXye6qCifDYtSD1Zxleih9gYn03ZW5tS 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: Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);