From 1f2f7cb9a27ac2f47d5ab8880b657eb2ff307e82 Mon Sep 17 00:00:00 2001 From: Huan Biao Date: Thu, 20 Dec 2018 17:42:24 +0800 Subject: [PATCH] thermal: cooldev: fix cpucore cool devices driver issue [1/1] PD#SWPL-3334 Problem: cpucore cool devices upper date type no match cpucore num set error Solution: modify cpucore upper num check Verify: w400 pass Change-Id: I83f829d31cab565d5ca3b892bb58a4a68b8f0f20 Signed-off-by: Huan Biao --- drivers/amlogic/thermal/cpucore_cooling.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/amlogic/thermal/cpucore_cooling.c b/drivers/amlogic/thermal/cpucore_cooling.c index 0c67c32..0b0c7fc 100644 --- a/drivers/amlogic/thermal/cpucore_cooling.c +++ b/drivers/amlogic/thermal/cpucore_cooling.c @@ -197,7 +197,7 @@ static int cpucore_notify_state(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, enum thermal_trip_type type) { - unsigned long ins_upper; + unsigned long ins_upper, target_upper = 0; long cur_state; long upper = -1; int i; @@ -206,8 +206,11 @@ static int cpucore_notify_state(struct thermal_cooling_device *cdev, case THERMAL_TRIP_HOT: for (i = 0; i < tz->trips; i++) { ins_upper = thermal_get_upper(tz, cdev, i); - if (ins_upper > upper) - upper = ins_upper; + if (!IS_ERR_VALUE(ins_upper) + && (ins_upper >= target_upper)) { + target_upper = ins_upper; + upper = target_upper; + } } cur_state = tz->hot_step; /* do not exceed levels */ -- 2.7.4