From patchwork Tue Dec 5 05:32:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 120620 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5324764qgn; Mon, 4 Dec 2017 21:37:05 -0800 (PST) X-Google-Smtp-Source: AGs4zMafYuhND55geHAeKOSBKzHJGVWJMClCoKVari1SJK1TiKF82f3yrOJv3HPxqyBIeM023ol+ X-Received: by 10.159.198.9 with SMTP id f9mr17085002plo.74.1512452225558; Mon, 04 Dec 2017 21:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512452225; cv=none; d=google.com; s=arc-20160816; b=MFeffBaHWfYk/8PB9aPidDO9mlu1+Fn/fxpa81cuaUbL/UTsoKapeoaEVAyMKYv86X C09GwnbFpE458qZF3cuiQigviInGZxHu8AXib1P4QOI0nfCDflCHMCB01DwUaX+HLsxM 6OgDB+/HbX5PHUxVH3b73ZGukd3roErV0HNkDVU7+Yzgae+Z5c+azylHZiTcfFOpCD9i XE+aOxSNHRV2tPEAn/3JcPQkUxi+GOtb8ae3W7IEYJ5olCypisMuus3kByXQUnSyQ4gW E06RMqLk0YKUDWrDAu6t9QmVU/LKWB5D570haV2WzUkOMm838VseTMGwsihvSHFtaWgf btdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=PccslvD92bNB9TkedfMr6GiBS1oXvoafYYAxZNNvhIU=; b=Qg9qJN7EjUviTjCH/7Q5qWTd/Mf6/qanG0stL6pzAMWPRsLV1y0ZxZ57JWU4rK/5U8 PujgCVaKHKyLK38RxqKwfWPK5i+CrmvanWyT0ffxB9LZ9oqVpQqEOpGuauG6ILTLhj5p CsrzBNGxGR8wct9u9jqWgYIxkdHyFeEUuc7ATm2SFKqA/3qilRJbkyEEc0ZKjDOXALbj oGJmCOeGP/9pkohOi5wNhxXcXQ6JmNwv3D6cV6V8lxakg9IdW879w0WlMlryilKB2UYT hF75BjmwkszNo4rk01A3NmjxLOeMNE740fLrFrUPnjW9tlrkEuni7kwgYyViVutnsFjc GMjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MMvcgYTM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p184si8222777pfp.296.2017.12.04.21.37.05; Mon, 04 Dec 2017 21:37:05 -0800 (PST) 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 header.s=google header.b=MMvcgYTM; 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 S1752506AbdLEFhD (ORCPT + 28 others); Tue, 5 Dec 2017 00:37:03 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:45460 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbdLEFg4 (ORCPT ); Tue, 5 Dec 2017 00:36:56 -0500 Received: by mail-pf0-f193.google.com with SMTP id u19so10412388pfa.12 for ; Mon, 04 Dec 2017 21:36:56 -0800 (PST) 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=PccslvD92bNB9TkedfMr6GiBS1oXvoafYYAxZNNvhIU=; b=MMvcgYTM2hekj8M80SWYy6nKTzNWdNmo5+wRHddfe9/Bakxgacz7dXfn93PUsOIZHe NjjhtAG4IAJ1oJ2qaZ6Q9U2lPSDQm/3BVEl0qGSBAssjcQ8WWpTALXAxyJSn99yru6F5 wuU2bnkJ4txBgCU/NozIEp8tuxWROupGmj5+8= 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=PccslvD92bNB9TkedfMr6GiBS1oXvoafYYAxZNNvhIU=; b=UJUifbvX98QAjaFF3XUOdAziMmtHNBdPdSzQ8/UdhKZ8BrnnelVrtpX4cKO6Azbktb weQpUe/JKkWNVPwlhovd9oIR6QZF3HlsSW3b6QscIleJfRiUZRKSGO+kpJKq/iBeHLhs PNjVsPudCb/O9pkla0BdC9YACnBP7pGxVj1ntCsdvBW36w4+66VdMAZkCjSJ9BtZu/F8 AiXHY1kW8KFOtt8cKoDa3q3a6TOLCkdg/ADcWut6KJ+brjgA/k36BHhJY21ePJsYXdew ug+Dgfn12Ut18mBJbK3fRjP47FSwY16UYh/Nknk0Wu9dKiW/WZUC1HJp659XNBuDSPiV kLdg== X-Gm-Message-State: AJaThX7v16dPUl07Fh2TRClsvXSgCAFW/baJ7nUiQN5+u10W5RJpdKgf y1FGLp2T6X3VfXj3YetY5dAmCQ== X-Received: by 10.159.203.133 with SMTP id ay5mr16722999plb.252.1512452215684; Mon, 04 Dec 2017 21:36:55 -0800 (PST) Received: from localhost ([117.220.69.6]) by smtp.gmail.com with ESMTPSA id v88sm28250896pfk.31.2017.12.04.21.36.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Dec 2017 21:36:55 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , edubezval@gmail.com Cc: Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , javi.merino@kernel.org, amit.kachhap@gmail.com, rui.zhang@intel.com, ionela.voinescu@arm.com Subject: [PATCH V2 1/4] cpu_cooling: Make of_cpufreq_power_cooling_register() parse DT Date: Tue, 5 Dec 2017 11:02:43 +0530 Message-Id: <22be9e04703b04d0b48f57e62ba170bf81660c14.1512451487.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.14.1 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 All the callers of of_cpufreq_power_cooling_register() have almost identical code and it makes more sense to move that code into the helper as its all about reading DT properties. This got rid of lot of redundant code. Acked-by: Eduardo Valentin Signed-off-by: Viresh Kumar --- Documentation/thermal/cpu-cooling-api.txt | 7 ++--- drivers/cpufreq/arm_big_little.c | 23 +-------------- drivers/cpufreq/cpufreq-dt.c | 27 +---------------- drivers/cpufreq/mediatek-cpufreq.c | 22 +------------- drivers/cpufreq/qoriq-cpufreq.c | 14 +-------- drivers/thermal/cpu_cooling.c | 49 +++++++++++++++++++------------ include/linux/cpu_cooling.h | 15 ++-------- 7 files changed, 41 insertions(+), 116 deletions(-) -- 2.11.0 diff --git a/Documentation/thermal/cpu-cooling-api.txt b/Documentation/thermal/cpu-cooling-api.txt index 71653584cd03..4f6f5e9bb4d6 100644 --- a/Documentation/thermal/cpu-cooling-api.txt +++ b/Documentation/thermal/cpu-cooling-api.txt @@ -51,8 +51,7 @@ Dynamic power). "plat_static_func" is a function to calculate the static power consumed by these cpus (See 2.2 Static power). 1.1.4 struct thermal_cooling_device *of_cpufreq_power_cooling_register( - struct device_node *np, const struct cpumask *clip_cpus, u32 capacitance, - get_static_t plat_static_func) + struct cpufreq_policy *policy) Similar to cpufreq_power_cooling_register, this function register a cpufreq cooling device with power extensions using the device tree @@ -76,8 +75,8 @@ cpu. If you are using CONFIG_CPUFREQ_DT then the device. The `plat_static_func` parameter of `cpufreq_power_cooling_register()` -and `of_cpufreq_power_cooling_register()` is optional. If you don't -provide it, only dynamic power will be considered. +is optional. If you don't provide it, only dynamic power will be +considered. 2.1 Dynamic power diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index 65ec5f01aa8d..3d5ed4ef3927 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c @@ -526,34 +526,13 @@ static int bL_cpufreq_exit(struct cpufreq_policy *policy) static void bL_cpufreq_ready(struct cpufreq_policy *policy) { - struct device *cpu_dev = get_cpu_device(policy->cpu); int cur_cluster = cpu_to_cluster(policy->cpu); - struct device_node *np; /* Do not register a cpu_cooling device if we are in IKS mode */ if (cur_cluster >= MAX_CLUSTERS) return; - np = of_node_get(cpu_dev->of_node); - if (WARN_ON(!np)) - return; - - if (of_find_property(np, "#cooling-cells", NULL)) { - u32 power_coefficient = 0; - - of_property_read_u32(np, "dynamic-power-coefficient", - &power_coefficient); - - cdev[cur_cluster] = of_cpufreq_power_cooling_register(np, - policy, power_coefficient, NULL); - if (IS_ERR(cdev[cur_cluster])) { - dev_err(cpu_dev, - "running cpufreq without cooling device: %ld\n", - PTR_ERR(cdev[cur_cluster])); - cdev[cur_cluster] = NULL; - } - } - of_node_put(np); + cdev[cur_cluster] = of_cpufreq_power_cooling_register(policy); } static struct cpufreq_driver bL_cpufreq_driver = { diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 545946ad0752..1e7bec7694ab 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -319,33 +319,8 @@ static int cpufreq_exit(struct cpufreq_policy *policy) static void cpufreq_ready(struct cpufreq_policy *policy) { struct private_data *priv = policy->driver_data; - struct device_node *np = of_node_get(priv->cpu_dev->of_node); - if (WARN_ON(!np)) - return; - - /* - * For now, just loading the cooling device; - * thermal DT code takes care of matching them. - */ - if (of_find_property(np, "#cooling-cells", NULL)) { - u32 power_coefficient = 0; - - of_property_read_u32(np, "dynamic-power-coefficient", - &power_coefficient); - - priv->cdev = of_cpufreq_power_cooling_register(np, - policy, power_coefficient, NULL); - if (IS_ERR(priv->cdev)) { - dev_err(priv->cpu_dev, - "running cpufreq without cooling device: %ld\n", - PTR_ERR(priv->cdev)); - - priv->cdev = NULL; - } - } - - of_node_put(np); + priv->cdev = of_cpufreq_power_cooling_register(policy); } static struct cpufreq_driver dt_cpufreq_driver = { diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index e0d5090b303d..6ff783e1b18a 100644 --- a/drivers/cpufreq/mediatek-cpufreq.c +++ b/drivers/cpufreq/mediatek-cpufreq.c @@ -310,28 +310,8 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy, static void mtk_cpufreq_ready(struct cpufreq_policy *policy) { struct mtk_cpu_dvfs_info *info = policy->driver_data; - struct device_node *np = of_node_get(info->cpu_dev->of_node); - u32 capacitance = 0; - if (WARN_ON(!np)) - return; - - if (of_find_property(np, "#cooling-cells", NULL)) { - of_property_read_u32(np, DYNAMIC_POWER, &capacitance); - - info->cdev = of_cpufreq_power_cooling_register(np, - policy, capacitance, NULL); - - if (IS_ERR(info->cdev)) { - dev_err(info->cpu_dev, - "running cpufreq without cooling device: %ld\n", - PTR_ERR(info->cdev)); - - info->cdev = NULL; - } - } - - of_node_put(np); + info->cdev = of_cpufreq_power_cooling_register(policy); } static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index 4ada55b8856e..3a665c18e14e 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -275,20 +275,8 @@ static int qoriq_cpufreq_target(struct cpufreq_policy *policy, static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) { struct cpu_data *cpud = policy->driver_data; - struct device_node *np = of_get_cpu_node(policy->cpu, NULL); - if (of_find_property(np, "#cooling-cells", NULL)) { - cpud->cdev = of_cpufreq_cooling_register(np, policy); - - if (IS_ERR(cpud->cdev) && PTR_ERR(cpud->cdev) != -ENOSYS) { - pr_err("cpu%d is not running as cooling device: %ld\n", - policy->cpu, PTR_ERR(cpud->cdev)); - - cpud->cdev = NULL; - } - } - - of_node_put(np); + cpud->cdev = of_cpufreq_power_cooling_register(policy); } static struct cpufreq_driver qoriq_cpufreq_driver = { diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index dc63aba092e4..a31eb03c788e 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -873,38 +873,51 @@ EXPORT_SYMBOL(cpufreq_power_cooling_register); /** * of_cpufreq_power_cooling_register() - create cpufreq cooling device with power extensions - * @np: a valid struct device_node to the cooling device device tree node - * @policy: cpufreq policy - * @capacitance: dynamic power coefficient for these cpus - * @plat_static_func: function to calculate the static power consumed by these - * cpus (optional) + * @policy: CPUFreq policy. * * This interface function registers the cpufreq cooling device with * the name "thermal-cpufreq-%x". This api can support multiple * instances of cpufreq cooling devices. Using this API, the cpufreq - * cooling device will be linked to the device tree node provided. + * cooling device will be linked to the device tree node of the provided + * policy's CPU. * Using this function, the cooling device will implement the power * extensions by using a simple cpu power model. The cpus must have * registered their OPPs using the OPP library. * - * An optional @plat_static_func may be provided to calculate the - * static power consumed by these cpus. If the platform's static - * power consumption is unknown or negligible, make it NULL. + * It also takes into account, if property present in policy CPU node, the + * static power consumed by the cpu. * * Return: a valid struct thermal_cooling_device pointer on success, - * on failure, it returns a corresponding ERR_PTR(). + * and NULL on failure. */ struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct device_node *np, - struct cpufreq_policy *policy, - u32 capacitance, - get_static_t plat_static_func) +of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) { - if (!np) - return ERR_PTR(-EINVAL); + struct device_node *np = of_get_cpu_node(policy->cpu, NULL); + struct thermal_cooling_device *cdev = NULL; + u32 capacitance = 0; + + if (!np) { + pr_err("cpu_cooling: OF node not available for cpu%d\n", + policy->cpu); + return NULL; + } - return __cpufreq_cooling_register(np, policy, capacitance, - plat_static_func); + if (of_find_property(np, "#cooling-cells", NULL)) { + of_property_read_u32(np, "dynamic-power-coefficient", + &capacitance); + + cdev = __cpufreq_cooling_register(np, policy, capacitance, + NULL); + if (IS_ERR(cdev)) { + pr_err("cpu_cooling: cpu%d is not running as cooling device: %ld\n", + policy->cpu, PTR_ERR(cdev)); + cdev = NULL; + } + } + + of_node_put(np); + return cdev; } EXPORT_SYMBOL(of_cpufreq_power_cooling_register); diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index d4292ebc5c8b..f09d4feb34f4 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -56,10 +56,7 @@ of_cpufreq_cooling_register(struct device_node *np, struct cpufreq_policy *policy); struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct device_node *np, - struct cpufreq_policy *policy, - u32 capacitance, - get_static_t plat_static_func); +of_cpufreq_power_cooling_register(struct cpufreq_policy *policy); #else static inline struct thermal_cooling_device * of_cpufreq_cooling_register(struct device_node *np, @@ -69,10 +66,7 @@ of_cpufreq_cooling_register(struct device_node *np, } static inline struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct device_node *np, - struct cpufreq_policy *policy, - u32 capacitance, - get_static_t plat_static_func) +of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) { return NULL; } @@ -105,10 +99,7 @@ of_cpufreq_cooling_register(struct device_node *np, } static inline struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct device_node *np, - struct cpufreq_policy *policy, - u32 capacitance, - get_static_t plat_static_func) +of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) { return NULL; } From patchwork Tue Dec 5 05:32:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 120621 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5324790qgn; Mon, 4 Dec 2017 21:37:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMYmU7TOdWK3JaIC/08BVfAasKQnG5+mZSLBXd1bW/wOWEtY1VN6O9vj+5iebP5VJJYdnIj2 X-Received: by 10.84.131.40 with SMTP id 37mr17163976pld.302.1512452227508; Mon, 04 Dec 2017 21:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512452227; cv=none; d=google.com; s=arc-20160816; b=Avrzc4QZ4n/tIxQHyHnqNns09Rwoobtcq4zwN+LDjn/O1f0Ib+wEq2hG18QQOHy0FE W3oxt24KopO73ZHILc5jyYnvBNs+jZFJbsgSldt0s+CtofIW+M3FsOW3pkd0UNlzsi7e p5iyysTHcrQDpIhv88uJRgNpH9M5FAv2hq+eFOJ6q/kp1By57La8js5esS55WM5Vtp4M E43EjdAPPdzQsMC4RFGOQFkKeoYQWZUfrapndEbB3v5Rvg8zIsR92pbkXbJqqhrtcMqJ rxvDCJQHc7ctXaAUEhVey4eAb1ML9NqvoP+/dqyX77Cl7dQFzOnS2fjKXsqswi1WPmyk nXpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Ulb+C2teDbCkOJYFljDT9Xe+2RKaU9wuU2KA963q5uA=; b=IJ4IULNul0B1vRlFm0J+6Cp/thyqfLxoXB9vEapG9ZKanz6NOVgy3mb4pbx5LRR0pE gasWu33FyAF5Lcsywl3x/3IQgqc9+ugXmzO+mgkH+s5is8AsTka678m8DBI4UJfLuNs3 RoH8WrKgUS2PkLY6IKUMURi3Q9Y7TS18Rn6Uey5lz8MjLkqZjSlLIDWTurATrvnAsHhR W1ec1xQDX0GtriGtX7epXRBUqOpMYDAErW4UwKXWi3R066WtgU4BR010HSXylK2sHMMJ Us4jHJK8vI5UapVKDIsHZZv0tdy0aP3LKnf3PEEU5VpWS5ovVsreF7+22dw3ZekO5fSi Kdhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ElcNBF1e; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p184si8222777pfp.296.2017.12.04.21.37.07; Mon, 04 Dec 2017 21:37:07 -0800 (PST) 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 header.s=google header.b=ElcNBF1e; 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 S1752595AbdLEFhG (ORCPT + 28 others); Tue, 5 Dec 2017 00:37:06 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:41210 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752529AbdLEFhA (ORCPT ); Tue, 5 Dec 2017 00:37:00 -0500 Received: by mail-pf0-f195.google.com with SMTP id j28so10412981pfk.8 for ; Mon, 04 Dec 2017 21:37:00 -0800 (PST) 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=Ulb+C2teDbCkOJYFljDT9Xe+2RKaU9wuU2KA963q5uA=; b=ElcNBF1eWIVYaodFBgfFCt8NfFiVW1Ma5YozIwdWScq76dWumYXrfJQaamaNI+ZmLq uJYHD3Ita/M37xdw11Po1jTn3HCTFX3247us159uIFQREFVON6TuAXbR8RhYjGZE/bKV 7nvZnn+6akPtou40c7CJlnYCdO8XAk3I6DGPA= 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=Ulb+C2teDbCkOJYFljDT9Xe+2RKaU9wuU2KA963q5uA=; b=rZwQfR9S6nhMeQGveC63cYltHyZf8q4njCq8ErK3tSYWnuuGdHcby41c80GNUkdwNp FyddEUOhSRRRJvMHC/lbSLbmw6JXYoO9joU6m7mp/wdcU995K1g/7wqLsBQMo/YQ2WAB f83D+68uZnXqosRrqt1JHxB47ks0qiYtufpyzp4vNlIvnpWVN5z63ryVERuFRI1Nyruh qfoZEPMEYttts8lGEAANEKDnAuHeLK4EIyzd4lskH1wY0gQaTgfbfr8Hnp5BSlg8z3Cf WppmnSDiKrfpg7IJpVUcH+16GXoNIg5ebE310waVM88PtSvu1JZzmAuCZvXKsCztUWYL ZEJg== X-Gm-Message-State: AJaThX4AXOPqMcZdEEqiH4NUEnlyZ2/qrjeVEywut6I+I2w60gTJMXm1 n91Ib8jtIVH2NnIqAC66kAFTQA== X-Received: by 10.101.88.76 with SMTP id s12mr16512858pgr.215.1512452219729; Mon, 04 Dec 2017 21:36:59 -0800 (PST) Received: from localhost ([117.220.69.6]) by smtp.gmail.com with ESMTPSA id o84sm26941028pfa.46.2017.12.04.21.36.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Dec 2017 21:36:59 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , edubezval@gmail.com Cc: Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , javi.merino@kernel.org, amit.kachhap@gmail.com, rui.zhang@intel.com, ionela.voinescu@arm.com Subject: [PATCH V2 2/4] cpu_cooling: Remove unused cpufreq_power_cooling_register() Date: Tue, 5 Dec 2017 11:02:44 +0530 Message-Id: <0565cf18cd0286d686faf409e174572c7f566931.1512451487.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.14.1 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 isn't used by anyone, drop it. Acked-by: Eduardo Valentin Signed-off-by: Viresh Kumar --- Documentation/thermal/cpu-cooling-api.txt | 24 +++--------------------- drivers/thermal/cpu_cooling.c | 30 ------------------------------ include/linux/cpu_cooling.h | 10 ---------- 3 files changed, 3 insertions(+), 61 deletions(-) -- 2.11.0 diff --git a/Documentation/thermal/cpu-cooling-api.txt b/Documentation/thermal/cpu-cooling-api.txt index 4f6f5e9bb4d6..ea61e8bf7e2b 100644 --- a/Documentation/thermal/cpu-cooling-api.txt +++ b/Documentation/thermal/cpu-cooling-api.txt @@ -36,28 +36,14 @@ the user. The registration APIs returns the cooling device pointer. np: pointer to the cooling device device tree node clip_cpus: cpumask of cpus where the frequency constraints will happen. -1.1.3 struct thermal_cooling_device *cpufreq_power_cooling_register( - const struct cpumask *clip_cpus, u32 capacitance, - get_static_t plat_static_func) - -Similar to cpufreq_cooling_register, this function registers a cpufreq -cooling device. Using this function, the cooling device will -implement the power extensions by using a simple cpu power model. The -cpus must have registered their OPPs using the OPP library. - -The additional parameters are needed for the power model (See 2. Power -models). "capacitance" is the dynamic power coefficient (See 2.1 -Dynamic power). "plat_static_func" is a function to calculate the -static power consumed by these cpus (See 2.2 Static power). - -1.1.4 struct thermal_cooling_device *of_cpufreq_power_cooling_register( +1.1.3 struct thermal_cooling_device *of_cpufreq_power_cooling_register( struct cpufreq_policy *policy) -Similar to cpufreq_power_cooling_register, this function register a +Similar to cpufreq_cooling_register, this function register a cpufreq cooling device with power extensions using the device tree information supplied by the np parameter. -1.1.5 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) +1.1.4 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) This interface function unregisters the "thermal-cpufreq-%x" cooling device. @@ -74,10 +60,6 @@ cpu. If you are using CONFIG_CPUFREQ_DT then the `cpufreq_frequency_table` should already be assigned to the cpu device. -The `plat_static_func` parameter of `cpufreq_power_cooling_register()` -is optional. If you don't provide it, only dynamic power will be -considered. - 2.1 Dynamic power The dynamic power consumption of a processor depends on many factors. diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index a31eb03c788e..10199f7e1196 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -842,36 +842,6 @@ of_cpufreq_cooling_register(struct device_node *np, EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); /** - * cpufreq_power_cooling_register() - create cpufreq cooling device with power extensions - * @policy: cpufreq policy - * @capacitance: dynamic power coefficient for these cpus - * @plat_static_func: function to calculate the static power consumed by these - * cpus (optional) - * - * This interface function registers the cpufreq cooling device with - * the name "thermal-cpufreq-%x". This api can support multiple - * instances of cpufreq cooling devices. Using this function, the - * cooling device will implement the power extensions by using a - * simple cpu power model. The cpus must have registered their OPPs - * using the OPP library. - * - * An optional @plat_static_func may be provided to calculate the - * static power consumed by these cpus. If the platform's static - * power consumption is unknown or negligible, make it NULL. - * - * Return: a valid struct thermal_cooling_device pointer on success, - * on failure, it returns a corresponding ERR_PTR(). - */ -struct thermal_cooling_device * -cpufreq_power_cooling_register(struct cpufreq_policy *policy, u32 capacitance, - get_static_t plat_static_func) -{ - return __cpufreq_cooling_register(NULL, policy, capacitance, - plat_static_func); -} -EXPORT_SYMBOL(cpufreq_power_cooling_register); - -/** * of_cpufreq_power_cooling_register() - create cpufreq cooling device with power extensions * @policy: CPUFreq policy. * diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index f09d4feb34f4..c35778960a9c 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -41,10 +41,6 @@ typedef int (*get_static_t)(cpumask_t *cpumask, int interval, struct thermal_cooling_device * cpufreq_cooling_register(struct cpufreq_policy *policy); -struct thermal_cooling_device * -cpufreq_power_cooling_register(struct cpufreq_policy *policy, - u32 capacitance, get_static_t plat_static_func); - /** * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. * @np: a valid struct device_node to the cooling device device tree node. @@ -84,12 +80,6 @@ cpufreq_cooling_register(struct cpufreq_policy *policy) { return ERR_PTR(-ENOSYS); } -static inline struct thermal_cooling_device * -cpufreq_power_cooling_register(struct cpufreq_policy *policy, - u32 capacitance, get_static_t plat_static_func) -{ - return NULL; -} static inline struct thermal_cooling_device * of_cpufreq_cooling_register(struct device_node *np,