From 3c74cbb8d0013f6ec7cdee0812247dae35edd757 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 24 Apr 2019 22:56:09 +0200 Subject: thermal/drivers/cpu_cooling: Remove pointless test in power2state() When the static power computation was removed, the test with the power being negative was not removed. However, the substraction which was responsible of the negative value was removed and the variable is now an u32. A double reason to remove the test which does not make sense. Fixes: 84fe2cab48590 ("cpu_cooling: Drop static-power related stuff") Cc: Viresh Kumar Signed-off-by: Daniel Lezcano Acked-by: Viresh Kumar Signed-off-by: Eduardo Valentin --- drivers/thermal/cpu_cooling.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/thermal/cpu_cooling.c') diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index f7c1f49ec87f..ee8419a6390c 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -541,7 +541,6 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev, struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; struct cpufreq_policy *policy = cpufreq_cdev->policy; - power = power > 0 ? power : 0; last_load = cpufreq_cdev->last_load ?: 1; normalised_power = (power * 100) / last_load; target_freq = cpu_power_to_freq(cpufreq_cdev, normalised_power); -- cgit v1.2.3-70-g09d2 From 42cd9b049829d7facbd45ab503d763a86251e81b Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Sun, 28 Apr 2019 11:51:03 +0200 Subject: thermal/drivers/cpu_cooling: Fixup the header and copyright The copyright format does not conform to the format requested by Linaro: https://wiki.linaro.org/Copyright Fix it. Signed-off-by: Daniel Lezcano Acked-by: Viresh Kumar Signed-off-by: Eduardo Valentin --- drivers/thermal/cpu_cooling.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/thermal/cpu_cooling.c') diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index ee8419a6390c..42aeb9087cab 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -2,9 +2,11 @@ * linux/drivers/thermal/cpu_cooling.c * * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) - * Copyright (C) 2012 Amit Daniel * - * Copyright (C) 2014 Viresh Kumar + * Copyright (C) 2012-2018 Linaro Limited. + * + * Authors: Amit Daniel + * Viresh Kumar * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * This program is free software; you can redistribute it and/or modify -- cgit v1.2.3-70-g09d2 From 0fac9e2f1452ffb6f43926609a569372204262eb Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Sun, 28 Apr 2019 11:51:04 +0200 Subject: thermal/drivers/cpu_cooling: Add Software Package Data Exchange (SPDX) For license auditing purpose, let's add the SPDX tag. Signed-off-by: Daniel Lezcano Acked-by: Viresh Kumar Acked-by: Philippe Ombredanne Signed-off-by: Eduardo Valentin --- drivers/thermal/cpu_cooling.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'drivers/thermal/cpu_cooling.c') diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 42aeb9087cab..b9d152a5f7ba 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/drivers/thermal/cpu_cooling.c * @@ -8,21 +9,6 @@ * Authors: Amit Daniel * Viresh Kumar * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #include #include -- cgit v1.2.3-70-g09d2 From 72554a7509aeb3fe94d9cf6746c9cb056622784f Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Sun, 28 Apr 2019 11:51:05 +0200 Subject: thermal/drivers/cpu_cooling: Remove pointless field The structure cpufreq_cooling_device provides a backpointer to the thermal device but this one is used for a trace and to unregister. For the trace, we don't really need this field and the unregister function as the same pointer passed as parameter. Remove it. Acked-by: Viresh Kumar Signed-off-by: Daniel Lezcano Signed-off-by: Eduardo Valentin --- drivers/thermal/cpu_cooling.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/thermal/cpu_cooling.c') diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index b9d152a5f7ba..9b014d0e8e70 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -87,7 +87,6 @@ struct cpufreq_cooling_device { unsigned int clipped_freq; unsigned int max_level; struct freq_table *freq_table; /* In descending order */ - struct thermal_cooling_device *cdev; struct cpufreq_policy *policy; struct list_head node; struct time_in_idle *idle_time; @@ -195,8 +194,7 @@ static int update_freq_table(struct cpufreq_cooling_device *cpufreq_cdev, dev = get_cpu_device(cpu); if (unlikely(!dev)) { - dev_warn(&cpufreq_cdev->cdev->device, - "No cpu device for cpu %d\n", cpu); + pr_warn("No cpu device for cpu %d\n", cpu); return -ENODEV; } @@ -679,7 +677,6 @@ __cpufreq_cooling_register(struct device_node *np, goto remove_ida; cpufreq_cdev->clipped_freq = cpufreq_cdev->freq_table[0].frequency; - cpufreq_cdev->cdev = cdev; mutex_lock(&cooling_list_lock); /* Register the notifier for first cpufreq cooling device */ @@ -797,7 +794,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, CPUFREQ_POLICY_NOTIFIER); - thermal_cooling_device_unregister(cpufreq_cdev->cdev); + thermal_cooling_device_unregister(cdev); ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); kfree(cpufreq_cdev->idle_time); kfree(cpufreq_cdev->freq_table); -- cgit v1.2.3-70-g09d2 From bf45ac18b78038e43af3c1a273cae4ab5704d2ce Mon Sep 17 00:00:00 2001 From: Matthias Kaehlcke Date: Thu, 2 May 2019 11:32:38 -0700 Subject: thermal: cpu_cooling: Actually trace CPU load in thermal_power_cpu_get_power The CPU load values passed to the thermal_power_cpu_get_power tracepoint are zero for all CPUs, unless, unless the thermal_power_cpu_limit tracepoint is enabled too: irq/41-rockchip-98 [000] .... 290.972410: thermal_power_cpu_get_power: cpus=0000000f freq=1800000 load={{0x0,0x0,0x0,0x0}} dynamic_power=4815 vs irq/41-rockchip-96 [000] .... 95.773585: thermal_power_cpu_get_power: cpus=0000000f freq=1800000 load={{0x56,0x64,0x64,0x5e}} dynamic_power=4959 irq/41-rockchip-96 [000] .... 95.773596: thermal_power_cpu_limit: cpus=0000000f freq=408000 cdev_state=10 power=416 There seems to be no good reason for omitting the CPU load information depending on another tracepoint. My guess is that the intention was to check whether thermal_power_cpu_get_power is (still) enabled, however 'load_cpu != NULL' already indicates that it was at least enabled when cpufreq_get_requested_power() was entered, there seems little gain from omitting the assignment if the tracepoint was just disabled, so just remove the check. Fixes: 6828a4711f99 ("thermal: add trace events to the power allocator governor") Signed-off-by: Matthias Kaehlcke Reviewed-by: Daniel Lezcano Acked-by: Javi Merino Acked-by: Viresh Kumar Signed-off-by: Eduardo Valentin --- drivers/thermal/cpu_cooling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/thermal/cpu_cooling.c') diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 9b014d0e8e70..4c5db59a619b 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -444,7 +444,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, load = 0; total_load += load; - if (trace_thermal_power_cpu_limit_enabled() && load_cpu) + if (load_cpu) load_cpu[i] = load; i++; -- cgit v1.2.3-70-g09d2