aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/thermal/thermal_sys.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 2ab31e4f02cc..dc4044b682a1 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -1059,6 +1059,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
1059 enum thermal_trip_type trip_type; 1059 enum thermal_trip_type trip_type;
1060 struct thermal_cooling_device_instance *instance; 1060 struct thermal_cooling_device_instance *instance;
1061 struct thermal_cooling_device *cdev; 1061 struct thermal_cooling_device *cdev;
1062 unsigned long cur_state, max_state;
1062 1063
1063 mutex_lock(&tz->lock); 1064 mutex_lock(&tz->lock);
1064 1065
@@ -1098,10 +1099,17 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
1098 1099
1099 cdev = instance->cdev; 1100 cdev = instance->cdev;
1100 1101
1102 cdev->ops->get_cur_state(cdev, &cur_state);
1103 cdev->ops->get_max_state(cdev, &max_state);
1104
1101 if (temp >= trip_temp) 1105 if (temp >= trip_temp)
1102 cdev->ops->set_cur_state(cdev, 1); 1106 cur_state = cur_state < max_state ?
1107 (cur_state + 1) : max_state;
1103 else 1108 else
1104 cdev->ops->set_cur_state(cdev, 0); 1109 cur_state = cur_state > 0 ?
1110 (cur_state - 1) : 0;
1111
1112 cdev->ops->set_cur_state(cdev, cur_state);
1105 } 1113 }
1106 break; 1114 break;
1107 case THERMAL_TRIP_PASSIVE: 1115 case THERMAL_TRIP_PASSIVE: