From patchwork Tue Apr 25 10:27:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 98188 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1879834qgf; Tue, 25 Apr 2017 03:28:44 -0700 (PDT) X-Received: by 10.84.239.8 with SMTP id w8mr37707901plk.73.1493116124824; Tue, 25 Apr 2017 03:28:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c129si3836718pfa.91.2017.04.25.03.28.44; Tue, 25 Apr 2017 03:28:44 -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 S1429631AbdDYK2i (ORCPT + 10 others); Tue, 25 Apr 2017 06:28:38 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:35569 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1429541AbdDYK1v (ORCPT ); Tue, 25 Apr 2017 06:27:51 -0400 Received: by mail-pf0-f170.google.com with SMTP id v14so21408078pfd.2 for ; Tue, 25 Apr 2017 03:27:51 -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=3FKmQHXJDyOjg3YeMO0kZTkp30nsbdUkwv3cJiCvk88=; b=VqYQsMwJHc0sRO+RG1NJqWofk4qAWg7try1vb4r1sn8NtMI9F7aHVLHAwoVxBshym1 lXaHqkMCPk8usNLacoZqeO+2df2RYj5Cw6O7FbmQg/AcrkXEMaSuKMhOAqfRIRUyMR4O 2TRIlbzEMhkjCSgrzBfaDlweWdueB+djkwmLI= 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=3FKmQHXJDyOjg3YeMO0kZTkp30nsbdUkwv3cJiCvk88=; b=nP9FNbF7b4Oeu6NatH36/Ibe9Jn4qcEYD/m5jdNMFMhdPOn7gjGEJRVPGikd3Sae2t L9PqmQvwrRH3y5VKkdFoksyKsUErH0qLlIKZip33DXv2Z3cEAyDKE9Q9gQirXJGi60BT eZxPLnp1/hpLA1OcQlQq99p1ZU4LB9vXekJNWNcABbNURPxk08gGiQX0UTARQyhIi+eP jwBkkdNs+2ofJ2kJTeWTYemBUwSUsF3QxnCHm61r3czrckKLAZnHyXyrdjHLWo180y4d fplI1UB7QwvtWhF6mKywBIeAaqJNL9z110MOkcAdRNVm5pYJ1Ji7kqgBxEwyVa8TYWq1 Eagw== X-Gm-Message-State: AN3rC/6vBUyoMows0tGoMrl0AKMr9xRwSGdb8twAa0CjKIMBA2U2OvJo 3iay8E9f5fZrunRp X-Received: by 10.84.238.137 with SMTP id v9mr37290956plk.189.1493116065633; Tue, 25 Apr 2017 03:27:45 -0700 (PDT) Received: from localhost ([122.172.121.5]) by smtp.gmail.com with ESMTPSA id q85sm35746071pfj.112.2017.04.25.03.27.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Apr 2017 03:27:44 -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 V4 05/17] thermal: cpu_cooling: remove cpufreq_cooling_get_level() Date: Tue, 25 Apr 2017 15:57:12 +0530 Message-Id: <04010983e89a99ad35fd754d3ca0577139ab8759.1493115651.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-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_cdev structure. It can directly call get_level() instead and we can get rid of cpufreq_cooling_get_level(). Signed-off-by: Viresh Kumar Tested-by: Lukasz Luba --- 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__ */