[COMMON] thermal: cpu_cooling: discard invalid cooling level
authorEunseok Choi <es10.choi@samsung.com>
Tue, 23 May 2017 08:32:35 +0000 (17:32 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:18:49 +0000 (17:18 +0900)
Resolved migration conflicts from kernel 4.9 to 4.14.
- freq_table and power_table are merged into struct freq_table

Change-Id: If039d12292d1901b08444e162b23ca08bdbb8427
Signed-off-by: Eunseok Choi <es10.choi@samsung.com>
drivers/thermal/cpu_cooling.c

index 59ac5c3f10ab5fc10b1e38147838fc4c576ce8e1..f285b37ca7b26f79f8e88a21fd0f78bce06f3b32 100644 (file)
@@ -581,8 +581,12 @@ static int exynos_cpufreq_cooling_get_level(struct thermal_cooling_device *cdev,
                                 unsigned long value)
 {
        struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
+       int level = get_level(cpufreq_cdev, value);
 
-       return get_level(cpufreq_cdev, value);
+       if (level == THERMAL_CSTATE_INVALID && value > cpufreq_cdev->freq_table[0].frequency)
+               level = 0;
+
+       return level;
 }
 
 /**