From patchwork Thu Mar 16 05:29:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 95375 Delivered-To: patch@linaro.org Received: by 10.140.89.134 with SMTP id v6csp660661qgd; Wed, 15 Mar 2017 22:30:30 -0700 (PDT) X-Received: by 10.99.184.18 with SMTP id p18mr8129164pge.20.1489642230697; Wed, 15 Mar 2017 22:30:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d82si2946670pfe.328.2017.03.15.22.30.30; Wed, 15 Mar 2017 22:30:30 -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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbdCPFaP (ORCPT + 25 others); Thu, 16 Mar 2017 01:30:15 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:35268 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362AbdCPFaN (ORCPT ); Thu, 16 Mar 2017 01:30:13 -0400 Received: by mail-pg0-f41.google.com with SMTP id b129so19567172pgc.2 for ; Wed, 15 Mar 2017 22:30:12 -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=7PowYXdYn9FSuefGPmR8P3kiSxJh9M5R/Cw8/89t+UQ=; b=j7pMufmWKAW+j6MOo2d4uaZqKLWfkwP7DLChceUQpf5xtK6pwKrRNtahK6MwliaEG8 6qKsnaEuxCYl9C3gNQVHQfRSGKK9ClNvWui/abVyL72QQmaQgRN4Js43TTCDr4hJgVPP a1wJnAIwW7rU916SdRD2xN5Cs5HpWbkog03Hg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=7PowYXdYn9FSuefGPmR8P3kiSxJh9M5R/Cw8/89t+UQ=; b=YY0QKJUJpzA48E1Io/m5iDNo+BruoHpCeIf9L5aV9MdE+YEk1tVGMSxvMjdkKqoMxw NbKRJbAuKyGIRokIU4yry5Yk1g7ssCNctpbBtFwk9CC6xjDrBT9LqMw3pCVfdTPHGy7a Yx76nCxdk9W/6g55WjvmzNVbTllD6oods42NzWakPPzGzZm+EcxB1AieDmFBt4DyAsJG ObZQ2sAVW0Pva3M4xL/+UWZTZ1cV/7Lj45t4rw2m178856Um0S3CvNSyvkYKvfw+2GPX +bmCRTccwOts6AqHiPCCdwLD3xd1nsMiNcuM/BexamXlXg+1CGJK+Mb1eOOPKG94sXzC bhYg== X-Gm-Message-State: AFeK/H1y65otIA0eT8VImdDqBLQ5YzJofAiBauthYWhm+4tYmHpmkgeI7wU0LVXS2RvTP0yi X-Received: by 10.99.174.71 with SMTP id e7mr8019463pgp.3.1489642212271; Wed, 15 Mar 2017 22:30:12 -0700 (PDT) Received: from localhost ([122.171.239.200]) by smtp.gmail.com with ESMTPSA id d189sm7475246pga.17.2017.03.15.22.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Mar 2017 22:30:11 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Javi Merino , Zhang Rui , Eduardo Valentin , Amit Daniel Kachhap , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: [PATCH 05/17] thermal: cpu_cooling: remove cpufreq_cooling_get_level() Date: Thu, 16 Mar 2017 10:59:40 +0530 Message-Id: <707918c88ce650ea11d160e31965482cdebc9a39.1489640000.git.viresh.kumar@linaro.org> 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 There is only one user of cpufreq_cooling_get_level() and that already has pointer to the cpufreq_dev structure. It can directly call get_level() instead and we can get rid of cpufreq_cooling_get_level(). Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 33 +-------------------------------- include/linux/cpu_cooling.h | 6 ------ 2 files changed, 1 insertion(+), 38 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index e2931c20c309..99dc6833de75 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -137,37 +137,6 @@ static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_dev, } /** - * cpufreq_cooling_get_level - for a given cpu, return the cooling level. - * @cpu: cpu for which the level is required - * @freq: the frequency of interest - * - * This function will match the cooling level corresponding to the - * requested @freq and return it. - * - * Return: The matched cooling level on success or THERMAL_CSTATE_INVALID - * otherwise. - */ -unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq) -{ - struct cpufreq_cooling_device *cpufreq_dev; - - mutex_lock(&cooling_list_lock); - list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { - if (cpumask_test_cpu(cpu, &cpufreq_dev->allowed_cpus)) { - unsigned long level = get_level(cpufreq_dev, freq); - - mutex_unlock(&cooling_list_lock); - return level; - } - } - mutex_unlock(&cooling_list_lock); - - pr_err("%s: cpu:%d not part of any cooling device\n", __func__, cpu); - return THERMAL_CSTATE_INVALID; -} -EXPORT_SYMBOL_GPL(cpufreq_cooling_get_level); - -/** * cpufreq_thermal_notifier - notifier callback for cpufreq policy change. * @nb: struct notifier_block * with callback info. * @event: value showing cpufreq event for which this function invoked. @@ -698,7 +667,7 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev, normalised_power = (dyn_power * 100) / last_load; target_freq = cpu_power_to_freq(cpufreq_dev, normalised_power); - *state = cpufreq_cooling_get_level(cpu, target_freq); + *state = get_level(cpufreq_dev, target_freq); if (*state == THERMAL_CSTATE_INVALID) { dev_err_ratelimited(&cdev->device, "Failed to convert %dKHz for cpu %d into a cdev state\n", diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index c156f5082758..96c5e4c2f9c8 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -82,7 +82,6 @@ of_cpufreq_power_cooling_register(struct device_node *np, */ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); -unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq); #else /* !CONFIG_CPU_THERMAL */ static inline struct thermal_cooling_device * cpufreq_cooling_register(const struct cpumask *clip_cpus) @@ -117,11 +116,6 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { return; } -static inline -unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq) -{ - return THERMAL_CSTATE_INVALID; -} #endif /* CONFIG_CPU_THERMAL */ #endif /* __CPU_COOLING_H__ */