From patchwork Wed Jun 1 10:34:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69012 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp15152qge; Wed, 1 Jun 2016 03:35:39 -0700 (PDT) X-Received: by 10.98.5.133 with SMTP id 127mr7271732pff.110.1464777339686; Wed, 01 Jun 2016 03:35:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dw10si11192861pab.58.2016.06.01.03.35.39; Wed, 01 Jun 2016 03:35:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758073AbcFAKfg (ORCPT + 30 others); Wed, 1 Jun 2016 06:35:36 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:35644 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757633AbcFAKe4 (ORCPT ); Wed, 1 Jun 2016 06:34:56 -0400 Received: by mail-pf0-f169.google.com with SMTP id g64so12937867pfb.2 for ; Wed, 01 Jun 2016 03:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=JGn6Uvm7m6Mlbwo8mlI1euuTWbONE5lzcjLY9u+i4d4=; b=bBke3mD0DIf8xBM9XDMQzKUEkJVaI/hMu2aMb9uSGMOugreJuOSWFxu9mHdrdmBuEB TK1Laul3jjoJoFid3szI8+sT4EabIBdUwkWEodt75q5oMLMm1Z4hlq7W+FEgZHsfNAX9 8LitEmP0kLOS7jWZmRQe7oAJs9al89HZf3RlY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=JGn6Uvm7m6Mlbwo8mlI1euuTWbONE5lzcjLY9u+i4d4=; b=VEwPDnZHpYqbbdONSGG2N0aB3Esy4cMtblUUzbAnJ2ElqRzP46Epklkv34cjUU3xET QiCaePBqxDSFFwP0oIGlXlQO3YlTAMJx6qkM0bVqD3i3pqA7tUv6Kex7FQxD/heyQ9eI ij6e9NjTl+47jc13GgUh57H/SE/QEnPx3TYnkJdFm1gXcGL/lyVAgOtRTcqzDWy2+vW/ VEDZQFwTXhcb7nKSO7/23CTtWXQTCQlwaZSUtIQTXYkD3/p2JQnLXrTQPAqq0THf6oME AUCWKo4h4q8nvgdlMfNFAoeOYqmx0T5MUHq9YxY/sg8RPf4NI1IjbI0W4302eug+HBVR dSNw== X-Gm-Message-State: ALyK8tImU6EX7PLrxM6Fb9X5fckd/f2JVy/wq2a31KJ5U8ztu+kTThrnF2Ee6d1Lli7qPUkm X-Received: by 10.98.104.133 with SMTP id d127mr5124225pfc.154.1464777295072; Wed, 01 Jun 2016 03:34:55 -0700 (PDT) Received: from localhost ([122.167.174.248]) by smtp.gmail.com with ESMTPSA id 141sm47023470pfx.68.2016.06.01.03.34.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 03:34:54 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/8] cpufreq: Drop 'freq_table' argument of __target_index() Date: Wed, 1 Jun 2016 16:04:21 +0530 Message-Id: X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is already present as part of the policy and so no need to pass it from the caller. Also, 'freq_table' is guaranteed to be valid in this function and so no need to check it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a28144697128..1685e930770f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1852,14 +1852,17 @@ static int __target_intermediate(struct cpufreq_policy *policy, return ret; } -static int __target_index(struct cpufreq_policy *policy, - struct cpufreq_frequency_table *freq_table, int index) +static int __target_index(struct cpufreq_policy *policy, int index) { struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0}; unsigned int intermediate_freq = 0; + unsigned int newfreq = policy->freq_table[index].frequency; int retval = -EINVAL; bool notify; + if (newfreq == policy->cur) + return 0; + notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION); if (notify) { /* Handle switching to intermediate frequency */ @@ -1874,7 +1877,7 @@ static int __target_index(struct cpufreq_policy *policy, freqs.old = freqs.new; } - freqs.new = freq_table[index].frequency; + freqs.new = newfreq; pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n", __func__, policy->cpu, freqs.old, freqs.new); @@ -1911,7 +1914,6 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, unsigned int relation) { unsigned int old_target_freq = target_freq; - struct cpufreq_frequency_table *freq_table; int index, retval; if (cpufreq_disabled()) @@ -1941,12 +1943,6 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, if (!cpufreq_driver->target_index) return -EINVAL; - freq_table = policy->freq_table; - if (unlikely(!freq_table)) { - pr_err("%s: Unable to find freq_table\n", __func__); - return -EINVAL; - } - retval = cpufreq_frequency_table_target(policy, target_freq, relation, &index); if (unlikely(retval)) { @@ -1954,10 +1950,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, return retval; } - if (freq_table[index].frequency == policy->cur) - return 0; - - return __target_index(policy, freq_table, index); + return __target_index(policy, index); } EXPORT_SYMBOL_GPL(__cpufreq_driver_target);