Skip to contentSkip to conversation

thermal/drivers/cpu_cooling: Remove pointless test in power2state()

PATCH In review Daniel Lezcano 2 participants 2 messages Apr 24, 2019 – Apr 25, 2019 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
---
 drivers/thermal/cpu_cooling.c | 1 -
 1 file changed, 1 deletion(-)
drivers/thermal/cpu_cooling.c +0 -1
index f7c1f49ec87f..ee8419a6390c 100644
@@ -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);
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Daniel Lezcano

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 <[email protected]>
---
 drivers/thermal/cpu_cooling.c | 1 -
 1 file changed, 1 deletion(-)
drivers/thermal/cpu_cooling.c +0 -0
index f7c1f49ec87f..ee8419a6390c 100644

drivers/thermal/cpu_cooling.c static int cpufreq_power2state(struct thermal_cooling_device *cdev, · line 546

Quoted 7 lines
drivers/thermal/cpu_cooling.c +0 -1
@@ -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);
Signature · 1 line
viresh