From patchwork Tue Dec 5 05:32:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10092151 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A17C60327 for ; Tue, 5 Dec 2017 05:37:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BEB82893B for ; Tue, 5 Dec 2017 05:37:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 109A428CBC; Tue, 5 Dec 2017 05:37:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E7C82893B for ; Tue, 5 Dec 2017 05:37:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbdLEFha (ORCPT ); Tue, 5 Dec 2017 00:37:30 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:40830 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbdLEFhE (ORCPT ); Tue, 5 Dec 2017 00:37:04 -0500 Received: by mail-pf0-f194.google.com with SMTP id v26so10421643pfl.7 for ; Mon, 04 Dec 2017 21:37:04 -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=cMpNi9l6FoW+mbB1Lc84c7FE5AkYhqEaRBjbkOID9JE=; b=UroBesbR3kPEi73anfIDCQ5qfRz/qZchdJ8+1Yh+cGT/EfAFbs/IWJhSTHAeb5o+7q MUxcvHexP+lpOCrVymhiA0fJN8OVMJNLx6fi5Do6mDvKA9edQQ+Zc+vVQDVmu1Jx9aOQ 9J0ZW8jgaT/k+Tup7TvWnsYJnI33PG2BaJxjw= 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=cMpNi9l6FoW+mbB1Lc84c7FE5AkYhqEaRBjbkOID9JE=; b=t+V9yqPS/PIK+3XvMr+IszTlKvWMygjLh4P071hQRxwXhk31IWg+LeO6CzqtzKFZ76 94GDJ3D1h03PDuyUc+viV7nR/h30iQpFCA79GGbeVHIIaF8R5B1dUSDKMk7tMxUOa3CJ LFHO8etwxLmIw9yiPgO524TfhO3iTy/0tP9rKylfP3gARWxSTez8tjl8SdenqKZSTloy QC7ePg17qyOMGx7RS8AYnf6qs4dMhE+Z872FNNp2YTrAKS8oUSYaOAXXrbxxTkc34S7v xpgNrBFVEnYu4hiUCEbwnZ610JXRK4j3kVFXcc/afTwzMofbs42tBdkt9C+IWsDTJwz2 Ni3w== X-Gm-Message-State: AJaThX4aL/6j0KXqj3Fza55WhLagT3PAzt+6RGAqxfJwydQ2lyO02lIt uV5OvrZEwEVE4i7o06+SK4r6cQ== X-Google-Smtp-Source: AGs4zMbiPTTRlc06xsiOtFLF+FY22ZliM0KKO2CBkHFeT2cPc/pCR3R16EMOaFsj40RNXXHBLGagTQ== X-Received: by 10.99.176.76 with SMTP id z12mr16087524pgo.358.1512452223911; Mon, 04 Dec 2017 21:37:03 -0800 (PST) Received: from localhost ([117.220.69.6]) by smtp.gmail.com with ESMTPSA id r1sm27039890pfg.98.2017.12.04.21.37.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Dec 2017 21:37:03 -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 3/4] cpu_cooling: Keep only one of_cpufreq*cooling_register() helper Date: Tue, 5 Dec 2017 11:02:45 +0530 Message-Id: <8a3b025d3214f6e792196c24df3eb12fa45e89a3.1512451487.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.14.1 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 X-Virus-Scanned: ClamAV using ClamSMTP of_cpufreq_cooling_register() isn't used by anyone and so can be removed, but then we would be left with two routines: cpufreq_cooling_register() and of_cpufreq_power_cooling_register() that would look odd. Remove current implementation of of_cpufreq_cooling_register() and rename of_cpufreq_power_cooling_register() as of_cpufreq_cooling_register(). This simplifies lots of stuff. Acked-by: Eduardo Valentin Signed-off-by: Viresh Kumar --- Documentation/thermal/cpu-cooling-api.txt | 14 ++------ drivers/cpufreq/arm_big_little.c | 2 +- drivers/cpufreq/cpufreq-dt.c | 2 +- drivers/cpufreq/mediatek-cpufreq.c | 2 +- drivers/cpufreq/qoriq-cpufreq.c | 2 +- drivers/thermal/cpu_cooling.c | 28 ++-------------- include/linux/cpu_cooling.h | 53 ++++++++----------------------- 7 files changed, 23 insertions(+), 80 deletions(-) diff --git a/Documentation/thermal/cpu-cooling-api.txt b/Documentation/thermal/cpu-cooling-api.txt index ea61e8bf7e2b..7a1c89db0419 100644 --- a/Documentation/thermal/cpu-cooling-api.txt +++ b/Documentation/thermal/cpu-cooling-api.txt @@ -26,24 +26,16 @@ the user. The registration APIs returns the cooling device pointer. clip_cpus: cpumask of cpus where the frequency constraints will happen. 1.1.2 struct thermal_cooling_device *of_cpufreq_cooling_register( - struct device_node *np, const struct cpumask *clip_cpus) + struct cpufreq_policy *policy) This interface function registers the cpufreq cooling device with the name "thermal-cpufreq-%x" linking it with a device tree node, in order to bind it via the thermal DT code. This api can support multiple instances of cpufreq cooling devices. - 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 *of_cpufreq_power_cooling_register( - struct cpufreq_policy *policy) - -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. + policy: CPUFreq policy. -1.1.4 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) +1.1.3 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) This interface function unregisters the "thermal-cpufreq-%x" cooling device. diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index 3d5ed4ef3927..c56b57dcfda5 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c @@ -532,7 +532,7 @@ static void bL_cpufreq_ready(struct cpufreq_policy *policy) if (cur_cluster >= MAX_CLUSTERS) return; - cdev[cur_cluster] = of_cpufreq_power_cooling_register(policy); + cdev[cur_cluster] = of_cpufreq_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 1e7bec7694ab..de3d104c25d7 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -320,7 +320,7 @@ static void cpufreq_ready(struct cpufreq_policy *policy) { struct private_data *priv = policy->driver_data; - priv->cdev = of_cpufreq_power_cooling_register(policy); + priv->cdev = of_cpufreq_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 6ff783e1b18a..f95975b76d98 100644 --- a/drivers/cpufreq/mediatek-cpufreq.c +++ b/drivers/cpufreq/mediatek-cpufreq.c @@ -311,7 +311,7 @@ static void mtk_cpufreq_ready(struct cpufreq_policy *policy) { struct mtk_cpu_dvfs_info *info = policy->driver_data; - info->cdev = of_cpufreq_power_cooling_register(policy); + info->cdev = of_cpufreq_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 3a665c18e14e..0562761a3dec 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -276,7 +276,7 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) { struct cpu_data *cpud = policy->driver_data; - cpud->cdev = of_cpufreq_power_cooling_register(policy); + cpud->cdev = of_cpufreq_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 10199f7e1196..3371caf3095c 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -819,7 +819,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register); /** * of_cpufreq_cooling_register - function to create cpufreq cooling device. - * @np: a valid struct device_node to the cooling device device tree node * @policy: cpufreq policy * * This interface function registers the cpufreq cooling device with the name @@ -827,29 +826,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register); * cooling devices. Using this API, the cpufreq cooling device will be * linked to the device tree node provided. * - * Return: a valid struct thermal_cooling_device pointer on success, - * on failure, it returns a corresponding ERR_PTR(). - */ -struct thermal_cooling_device * -of_cpufreq_cooling_register(struct device_node *np, - struct cpufreq_policy *policy) -{ - if (!np) - return ERR_PTR(-EINVAL); - - return __cpufreq_cooling_register(np, policy, 0, NULL); -} -EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); - -/** - * of_cpufreq_power_cooling_register() - create cpufreq cooling device with power extensions - * @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 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. @@ -861,7 +837,7 @@ EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); * and NULL on failure. */ struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) +of_cpufreq_cooling_register(struct cpufreq_policy *policy) { struct device_node *np = of_get_cpu_node(policy->cpu, NULL); struct thermal_cooling_device *cdev = NULL; @@ -889,7 +865,7 @@ of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) of_node_put(np); return cdev; } -EXPORT_SYMBOL(of_cpufreq_power_cooling_register); +EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); /** * cpufreq_cooling_unregister - function to remove cpufreq cooling device. diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index c35778960a9c..fd0ea8ddca93 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -42,33 +42,6 @@ struct thermal_cooling_device * cpufreq_cooling_register(struct cpufreq_policy *policy); /** - * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. - * @np: a valid struct device_node to the cooling device device tree node. - * @policy: cpufreq policy. - */ -#ifdef CONFIG_THERMAL_OF -struct thermal_cooling_device * -of_cpufreq_cooling_register(struct device_node *np, - struct cpufreq_policy *policy); - -struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct cpufreq_policy *policy); -#else -static inline struct thermal_cooling_device * -of_cpufreq_cooling_register(struct device_node *np, - struct cpufreq_policy *policy) -{ - return ERR_PTR(-ENOSYS); -} - -static inline struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) -{ - return NULL; -} -#endif - -/** * cpufreq_cooling_unregister - function to remove cpufreq cooling device. * @cdev: thermal cooling device pointer. */ @@ -81,24 +54,26 @@ cpufreq_cooling_register(struct cpufreq_policy *policy) return ERR_PTR(-ENOSYS); } -static inline struct thermal_cooling_device * -of_cpufreq_cooling_register(struct device_node *np, - struct cpufreq_policy *policy) +static inline +void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { - return ERR_PTR(-ENOSYS); + return; } +#endif /* CONFIG_CPU_THERMAL */ +#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) +/** + * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. + * @policy: cpufreq policy. + */ +struct thermal_cooling_device * +of_cpufreq_cooling_register(struct cpufreq_policy *policy); +#else static inline struct thermal_cooling_device * -of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) +of_cpufreq_cooling_register(struct cpufreq_policy *policy) { return NULL; } - -static inline -void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) -{ - return; -} -#endif /* CONFIG_CPU_THERMAL */ +#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */ #endif /* __CPU_COOLING_H__ */