From patchwork Wed Apr 19 05:29:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 97594 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp159235qgf; Tue, 18 Apr 2017 22:31:09 -0700 (PDT) X-Received: by 10.84.241.65 with SMTP id u1mr1575379plm.28.1492579869061; Tue, 18 Apr 2017 22:31:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5si1294599pfb.367.2017.04.18.22.31.08; Tue, 18 Apr 2017 22:31:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1759908AbdDSFbF (ORCPT + 12 others); Wed, 19 Apr 2017 01:31:05 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:36604 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759885AbdDSFbC (ORCPT ); Wed, 19 Apr 2017 01:31:02 -0400 Received: by mail-pf0-f178.google.com with SMTP id 194so6972922pfv.3 for ; Tue, 18 Apr 2017 22:30:56 -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=4HJsZRN6zF5/LRAe1wDfyitNxbWDnwbtd4xl0aZuYT0=; b=Nym9QrmiBQA8ILZfaImKUrQLpqjeL9RyA055AwPr1UB/49odiLAWxgt/3zUeTkaIx5 qN7N/Js3bBZGcU7niqf/PFk8T5GyulElaxWfcsi1SthdzedED5FLXX8ovHUkuj+IrNAy rQEQMteVGiz8f1po3M19bfGAsAXqGC6MG8jRw= 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=4HJsZRN6zF5/LRAe1wDfyitNxbWDnwbtd4xl0aZuYT0=; b=ZeX2S8wnJ4cz5C2YShI+IkjlOxaV285/nMZ8YzYTX/MX/cUMrpqx+RuGMcmSduYAd0 gMtMMgv+QpDCg6vTEnmmT+v3lzStgQr9SGT62O4eiRQJbFnvxpBMz+R94UbFqLvHNTFj A+iJU7SLqhGJwy4YjVdOwd+BoQPw+QlBUBLKstuowV4zTGlmM+oTL0ZYOzufiE55Sa/i aHZcaDso4SVPBjc7AJjmyqLS/WQnsFESge1ewEMTaZJQMPryHhuvtpERfvm3tb4Xj9Ku zi5vsrPBVpWeCBp0E3mQOA4fEeEKmjmUj/sJqU+iMZKe3L0dCdAqoYbM634I9QOCbouI FB3w== X-Gm-Message-State: AN3rC/6t/kS7y5d2tchULWwRJX2UIHqPS1SH86KBvIHC5m8iavuLIKOh 6805r7W/GyxMd1wk X-Received: by 10.98.93.147 with SMTP id n19mr1220548pfj.226.1492579850770; Tue, 18 Apr 2017 22:30:50 -0700 (PDT) Received: from localhost ([122.172.121.5]) by smtp.gmail.com with ESMTPSA id x65sm1647411pfb.111.2017.04.18.22.30.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Apr 2017 22:30:50 -0700 (PDT) From: Viresh Kumar To: Javi Merino , Zhang Rui , Eduardo Valentin , Lukasz Luba , Amit Daniel Kachhap , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, Rafael Wysocki , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Punit Agrawal Subject: [PATCH V3 05/17] thermal: cpu_cooling: remove cpufreq_cooling_get_level() Date: Wed, 19 Apr 2017 10:59:00 +0530 Message-Id: <04010983e89a99ad35fd754d3ca0577139ab8759.1492579345.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.12.0.432.g71c3a4f4ba37 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There is only one user of cpufreq_cooling_get_level() and that already has pointer to the cpufreq_cdev 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.12.0.432.g71c3a4f4ba37 diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index f1e784c22c5a..1f4b6a719d05 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -136,37 +136,6 @@ static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev, } /** - * 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_cdev; - - mutex_lock(&cooling_list_lock); - list_for_each_entry(cpufreq_cdev, &cpufreq_cdev_list, node) { - if (cpumask_test_cpu(cpu, &cpufreq_cdev->allowed_cpus)) { - unsigned long level = get_level(cpufreq_cdev, 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. @@ -697,7 +666,7 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev, normalised_power = (dyn_power * 100) / last_load; target_freq = cpu_power_to_freq(cpufreq_cdev, normalised_power); - *state = cpufreq_cooling_get_level(cpu, target_freq); + *state = get_level(cpufreq_cdev, 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__ */