From patchwork Fri Sep 13 13:00:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20144 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D4DEF20358 for ; Fri, 13 Sep 2013 13:13:42 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id gf11sf1197748vcb.6 for ; Fri, 13 Sep 2013 06:13:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=IO1e8bhiK9wM7tV+ibel02TXDDOp6ZvppMuZNnDkE8I=; b=Xk+tyFBvnWg7vL/UUBLU3QEeibPrBSJrmz8CitHzTsyd5+3ulzuDQHwrEFrqUyzWHl nSu6cBWDrApBal6a6EEMf1bDKywoBGQMnEn0nidCLoZGWuiSbEmOJtPhvKSpEh2yC1oZ u2xcKK+YNnjLiIuTOzONyuf7mLqC8AAPChTy5b+R6Lcvq1UwsegFWBlaLHHUKSeddo9Y EeHFB/IRZ7IetIYhpEpGiBokbWzt1Bn4rDjZ/cxLOBcRXhgBf+RYot7iecC4r0COs/X2 3wWBn+UlDnhKh5WxT/zssWvN+jiPVrEr5ImzvnbLRVOe8auJLGolGKILj+/sccs/7Nul KIOw== X-Gm-Message-State: ALoCoQlpiXiD7L+QAEqVAf/ezL90OsMINYvLvTuYEGkh6/IZssogjWmNU1t4gG8S5LVSlWxXD9a4 X-Received: by 10.236.227.165 with SMTP id d35mr679240yhq.51.1379078022631; Fri, 13 Sep 2013 06:13:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.5.9 with SMTP id o9ls1133293qeo.49.gmail; Fri, 13 Sep 2013 06:13:42 -0700 (PDT) X-Received: by 10.52.230.74 with SMTP id sw10mr9685247vdc.6.1379078022418; Fri, 13 Sep 2013 06:13:42 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id gn1si3098750vec.105.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:13:42 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id kw10so938779vcb.1 for ; Fri, 13 Sep 2013 06:13:42 -0700 (PDT) X-Received: by 10.58.161.116 with SMTP id xr20mr11949307veb.2.1379078022337; Fri, 13 Sep 2013 06:13:42 -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 u4csp79965vcz; Fri, 13 Sep 2013 06:13:41 -0700 (PDT) X-Received: by 10.68.172.164 with SMTP id bd4mr13346654pbc.153.1379078021234; Fri, 13 Sep 2013 06:13:41 -0700 (PDT) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by mx.google.com with ESMTPS id j3si7443624pbw.99.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:13:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.47 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.47; Received: by mail-pb0-f47.google.com with SMTP id rr4so1217514pbb.34 for ; Fri, 13 Sep 2013 06:13:40 -0700 (PDT) X-Received: by 10.66.254.170 with SMTP id aj10mr15128191pad.142.1379078020577; Fri, 13 Sep 2013 06:13:40 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id xe9sm18066472pab.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:13:40 -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, linux-arm-kernel@lists.infradead.org, Viresh Kumar Subject: [PATCH 090/228] cpufreq: call cpufreq_driver->get() after calling ->init() Date: Fri, 13 Sep 2013 18:30:36 +0530 Message-Id: <65ceb79aa6cf70ee2ee64f92ffe92e43e8663c4e.1379063063.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.220.170 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. 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 c7274e6..1e6b602 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1081,6 +1081,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); @@ -1135,6 +1143,9 @@ err_out_unregister: per_cpu(cpufreq_cpu_data, j) = NULL; write_unlock_irqrestore(&cpufreq_driver_lock, flags); +err_get_freq: + if (cpufreq_driver->exit) + cpufreq_driver->exit(policy); err_set_policy_cpu: cpufreq_policy_free(policy); nomem_out: