From patchwork Fri Jan 2 07:04:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42680 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 204EE26CD1 for ; Fri, 2 Jan 2015 07:05:31 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf10388197eek.9 for ; Thu, 01 Jan 2015 23:05:30 -0800 (PST) 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 :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=iWho5JTYBay8xutE287u0J7eV4CM9nttGdibKaR4B+Y=; b=gYAnO1g7JiDOixr4nBiuY707V32XWKhul1+QgtbcCkv5XK13oR19FWQV6SJpZrY8kb UvHpXycVnhvyTMsN9fkV6wUkHjnqgYbXsy9jYPdhXoqWfCt3BiCLBpmeO6foZqHt29pt kXozBxIOQSEIzfYCNJwhELA/oSMgI6fIfnnAqiIOiqDhowlvrlAp6uipskatJX7I5vKh SFdYciSrsrESNIgcvNvgt97h7YY9I5FozTPR6qVvv7PB3aEb/o2oemkSMzeiuuJzNW0W ptOKYKpJ5l0kPDPuV4bqxx4THLA71x/AMjo7/F1tYddED2gN9nrhXNE012Fu6QygaYQV Iwhw== X-Gm-Message-State: ALoCoQlc85FYQVcrvwZ+p781H35DTcS/PvkU97vkNZ1RlJCIvnA2CcQegI3wVkRCfcvD9Y3A4qNr X-Received: by 10.112.188.199 with SMTP id gc7mr554298lbc.6.1420182330361; Thu, 01 Jan 2015 23:05:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.70 with SMTP id lm6ls1159195lac.41.gmail; Thu, 01 Jan 2015 23:05:30 -0800 (PST) X-Received: by 10.152.7.206 with SMTP id l14mr74893448laa.1.1420182330115; Thu, 01 Jan 2015 23:05:30 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id v20si50502071laz.0.2015.01.01.23.05.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 Jan 2015 23:05:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id b6so14392504lbj.22 for ; Thu, 01 Jan 2015 23:05:30 -0800 (PST) X-Received: by 10.112.163.33 with SMTP id yf1mr13887792lbb.56.1420182330033; Thu, 01 Jan 2015 23:05:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp126152lbb; Thu, 1 Jan 2015 23:05:29 -0800 (PST) X-Received: by 10.66.181.136 with SMTP id dw8mr122281582pac.117.1420182327510; Thu, 01 Jan 2015 23:05:27 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dl1si29047854pbb.67.2015.01.01.23.05.26; Thu, 01 Jan 2015 23:05:27 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750753AbbABHFZ (ORCPT + 12 others); Fri, 2 Jan 2015 02:05:25 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:56469 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750744AbbABHFZ (ORCPT ); Fri, 2 Jan 2015 02:05:25 -0500 Received: by mail-pd0-f178.google.com with SMTP id r10so23255742pdi.37 for ; Thu, 01 Jan 2015 23:05:24 -0800 (PST) X-Received: by 10.66.55.41 with SMTP id o9mr95567991pap.80.1420182324804; Thu, 01 Jan 2015 23:05:24 -0800 (PST) Received: from localhost ([122.167.116.151]) by mx.google.com with ESMTPSA id r1sm38660659pdb.24.2015.01.01.23.05.23 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 01 Jan 2015 23:05:24 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, prarit@redhat.com, skannan@codeaurora.org, Viresh Kumar Subject: [PATCH 08/17] cpufreq: pass policy to __cpufreq_get() Date: Fri, 2 Jan 2015 12:34:29 +0530 Message-Id: X-Mailer: git-send-email 2.2.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , There is no point finding out the 'policy' again within __cpufreq_get() when all the callers already have it. Just make them pass policy instead. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 3e80b97d64b8..35d4734ce856 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -62,7 +62,7 @@ static DECLARE_RWSEM(cpufreq_rwsem); /* internal prototypes */ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); -static unsigned int __cpufreq_get(unsigned int cpu); +static unsigned int __cpufreq_get(struct cpufreq_policy *policy); static void handle_update(struct work_struct *work); /** @@ -562,7 +562,7 @@ store_one(scaling_max_freq, max); static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, char *buf) { - unsigned int cur_freq = __cpufreq_get(policy->cpu); + unsigned int cur_freq = __cpufreq_get(policy); if (!cur_freq) return sprintf(buf, ""); return sprintf(buf, "%u\n", cur_freq); @@ -1568,15 +1568,14 @@ unsigned int cpufreq_quick_get_max(unsigned int cpu) } EXPORT_SYMBOL(cpufreq_quick_get_max); -static unsigned int __cpufreq_get(unsigned int cpu) +static unsigned int __cpufreq_get(struct cpufreq_policy *policy) { - struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); unsigned int ret_freq = 0; if (!cpufreq_driver->get) return ret_freq; - ret_freq = cpufreq_driver->get(cpu); + ret_freq = cpufreq_driver->get(policy->cpu); if (ret_freq && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { @@ -1604,7 +1603,7 @@ unsigned int cpufreq_get(unsigned int cpu) if (policy) { down_read(&policy->rwsem); - ret_freq = __cpufreq_get(cpu); + ret_freq = __cpufreq_get(policy); up_read(&policy->rwsem); cpufreq_cpu_put(policy);