From patchwork Thu Dec 18 12:00:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42432 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4E8F526C8B for ; Thu, 18 Dec 2014 12:01:23 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf764644eek.8 for ; Thu, 18 Dec 2014 04:01:22 -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=KxHYTHx+z2QqTIVpY6YpRvXjP/8MsFUEHIzCpht3cD8=; b=Jpecl7xsdTS4uSjzLSWrxKCvfCoVf6UadNJzF1/Yjw47y2ga3DUD8RClhkTKtiSSZF rnhKL9pAQxDsKTKdtXGobwN7v+/1QyGTJzebO/jOfGiVlh2LnB1R/rnb6dFlBpDISAxg HEHp1XuVNtzjACkuWMcqH4ao+EUZAIsBf6IjFmA8oOM/onpiNaz9Hux8SzEThjSBjeWT Jvao752PEWVCACfRArLU6csWSchlzdiHHecRft7o6HIgr5UH4q/o88tvkbeIaZTu6yHA clgvujikPZsjIFBVXoL43QeVtlRYvXKJ37R77rIXRsII1ko5fdv9oMfz2kPl+XbAuz4/ L4nA== X-Gm-Message-State: ALoCoQl5nk1el/0oFqrEb/tZ1zHhh0tM7KTs3vY+q/HSOsx8qf50LRA7zhCmzcQ69PJXwvG7WXGV X-Received: by 10.194.133.39 with SMTP id oz7mr277618wjb.3.1418904082470; Thu, 18 Dec 2014 04:01:22 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.200 with SMTP id d8ls797836lah.18.gmail; Thu, 18 Dec 2014 04:01:22 -0800 (PST) X-Received: by 10.112.63.133 with SMTP id g5mr1830129lbs.33.1418904082250; Thu, 18 Dec 2014 04:01:22 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id j15si6694045lbg.30.2014.12.18.04.01.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:01:22 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id u10so824589lbd.31 for ; Thu, 18 Dec 2014 04:01:22 -0800 (PST) X-Received: by 10.112.159.129 with SMTP id xc1mr1905571lbb.24.1418904082164; Thu, 18 Dec 2014 04:01:22 -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.142.69 with SMTP id ru5csp1680395lbb; Thu, 18 Dec 2014 04:01:20 -0800 (PST) X-Received: by 10.66.146.167 with SMTP id td7mr2635624pab.101.1418904079977; Thu, 18 Dec 2014 04:01:19 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ov3si9608661pbc.228.2014.12.18.04.01.19; Thu, 18 Dec 2014 04:01: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 S1752246AbaLRMBS (ORCPT + 12 others); Thu, 18 Dec 2014 07:01:18 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:49340 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751564AbaLRMBS (ORCPT ); Thu, 18 Dec 2014 07:01:18 -0500 Received: by mail-pa0-f48.google.com with SMTP id rd3so1284535pab.21 for ; Thu, 18 Dec 2014 04:01:17 -0800 (PST) X-Received: by 10.66.100.136 with SMTP id ey8mr2624143pab.93.1418904077454; Thu, 18 Dec 2014 04:01:17 -0800 (PST) Received: from localhost ([122.166.148.73]) by mx.google.com with ESMTPSA id fz15sm6604487pdb.71.2014.12.18.04.01.16 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:01:16 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH 04/13] cpufreq: stats: pass 'stat' to cpufreq_stats_update() Date: Thu, 18 Dec 2014 17:30:21 +0530 Message-Id: <662f310dbb4aa67a258c8b9d3a4a52e1b3ff1846.1418902789.git.viresh.kumar@linaro.org> 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.172 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(). 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;