From patchwork Fri Jan 2 05:46:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42662 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1A45126CB5 for ; Fri, 2 Jan 2015 05:47:23 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf10463778lbj.7 for ; Thu, 01 Jan 2015 21:47:21 -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=q5w+XvITNwqFx1JVP9fenQR4+qpDWzjjZa9NW1SkzCM=; b=VNjw9d5A83qxnUuaXeWPmAnAwloHibSsD/4Y11xuJb4GuG81LxtxstxqJ8ZERXWPvs IU70eSFt4zSKtNMnkN8ILFN5PAr4Rla1thY+SMSk/Jl2oB6D4zVBnBVqDeTRxc7Bd+D6 x6CpdJGpNgz1dMT4fl/NotrMFGOGu2h3sU7IVM3erVmImuDKl8liyruLFihfyYhgKuim 6idLWH4eQBrrZ6jGq6oxd5bYXYVe/bXePhXY5NQ3ZRfWbnrbTb25qsLZODwD61ChzLaY 7/+i6zQ6nYCMS9mekMClG9E9dh2fpNdgiE1vSj5pIikamqITfRDbbS1SFGn99GVzBYRX NBig== X-Gm-Message-State: ALoCoQlQLGKQCz1ChO4c83QgBL113/n01KLqhZHsRf58qyQ+c5anFrDMt2MszSeq/NYF/NP9z8kg X-Received: by 10.112.43.65 with SMTP id u1mr3404lbl.16.1420177641742; Thu, 01 Jan 2015 21:47:21 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.226 with SMTP id kt2ls2323560lac.52.gmail; Thu, 01 Jan 2015 21:47:21 -0800 (PST) X-Received: by 10.152.115.146 with SMTP id jo18mr68644443lab.9.1420177641534; Thu, 01 Jan 2015 21:47:21 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id je12si50265530lac.90.2015.01.01.21.47.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 Jan 2015 21:47:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ms9so15123179lab.38 for ; Thu, 01 Jan 2015 21:47:21 -0800 (PST) X-Received: by 10.112.41.234 with SMTP id i10mr75631992lbl.25.1420177641407; Thu, 01 Jan 2015 21:47:21 -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 c8csp114447lbb; Thu, 1 Jan 2015 21:47:20 -0800 (PST) X-Received: by 10.70.133.35 with SMTP id oz3mr116068007pdb.69.1420177639505; Thu, 01 Jan 2015 21:47:19 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si68097479pdc.177.2015.01.01.21.47.18; Thu, 01 Jan 2015 21:47:19 -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 S1750702AbbABFrS (ORCPT + 12 others); Fri, 2 Jan 2015 00:47:18 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:42705 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbbABFrR (ORCPT ); Fri, 2 Jan 2015 00:47:17 -0500 Received: by mail-pa0-f41.google.com with SMTP id rd3so23664967pab.28 for ; Thu, 01 Jan 2015 21:47:17 -0800 (PST) X-Received: by 10.66.120.129 with SMTP id lc1mr121166660pab.86.1420177636914; Thu, 01 Jan 2015 21:47:16 -0800 (PST) Received: from localhost ([122.167.116.151]) by mx.google.com with ESMTPSA id ok9sm19160191pbb.52.2015.01.01.21.47.15 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 01 Jan 2015 21:47:16 -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 V2 04/14] cpufreq: stats: pass 'stat' to cpufreq_stats_update() Date: Fri, 2 Jan 2015 11:16:41 +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.215.51 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: , cpufreq_stats_update() needs only 'stat' pointer for its use and nothing else. Currently it works fine as we have a per-cpu variable for storing stats. But later commits would remove it and hence we better pass 'stat' to cpufreq_stats_update(). Reviewed-by: Prarit Bhargava Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_stats.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 62b6133f06aa..ebd9e4c5c124 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -38,14 +38,11 @@ struct cpufreq_stats_attribute { ssize_t(*show) (struct cpufreq_stats *, char *); }; -static int cpufreq_stats_update(unsigned int cpu) +static int cpufreq_stats_update(struct cpufreq_stats *stat) { - struct cpufreq_stats *stat; - unsigned long long cur_time; + unsigned long long cur_time = get_jiffies_64(); - cur_time = get_jiffies_64(); spin_lock(&cpufreq_stats_lock); - stat = per_cpu(cpufreq_stats_table, cpu); if (stat->time_in_state) stat->time_in_state[stat->last_index] += cur_time - stat->last_time; @@ -70,7 +67,7 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf) struct cpufreq_stats *stat = per_cpu(cpufreq_stats_table, policy->cpu); if (!stat) return 0; - cpufreq_stats_update(stat->cpu); + cpufreq_stats_update(stat); for (i = 0; i < stat->state_num; i++) { len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i], (unsigned long long) @@ -88,7 +85,7 @@ static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf) struct cpufreq_stats *stat = per_cpu(cpufreq_stats_table, policy->cpu); if (!stat) return 0; - cpufreq_stats_update(stat->cpu); + cpufreq_stats_update(stat); len += snprintf(buf + len, PAGE_SIZE - len, " From : To\n"); len += snprintf(buf + len, PAGE_SIZE - len, " : "); for (i = 0; i < stat->state_num; i++) { @@ -313,7 +310,7 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, if (old_index == -1 || new_index == -1) return 0; - cpufreq_stats_update(freq->cpu); + cpufreq_stats_update(stat); if (old_index == new_index) return 0;