Skip to contentSkip to conversation

thermal: fix off-by-1 error in trip point trigger condition

PATCH Applied Vladimir Zajac 4 participants 6 messages May 6, 2009 – Jun 9, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: fix off-by-1 error in trip point trigger condition

This patch fixes a regression caused by commit b1569e99c795bf83b4ddf41c4f1c42761ab7f75e
"ACPI: move thermal trip handling to generic thermal layer" which accidentally changed trip point trigger condition to
temp > trip_temp

This patch changes the trigger condition back to
temp >= trip_temp

---

 thermal_sys.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/thermal_sys.c +4 -4
@@ -961,7 +961,7 @@ void thermal_zone_device_update(struct t
 
 		switch (trip_type) {
 		case THERMAL_TRIP_CRITICAL:
-			if (temp > trip_temp) {
+			if (temp >= trip_temp) {
 				if (tz->ops->notify)
 					ret = tz->ops->notify(tz, count,
 							      trip_type);
@@ -974,7 +974,7 @@ void thermal_zone_device_update(struct t
 			}
 			break;
 		case THERMAL_TRIP_HOT:
-			if (temp > trip_temp)
+			if (temp >= trip_temp)
 				if (tz->ops->notify)
 					tz->ops->notify(tz, count, trip_type);
 			break;
@@ -986,14 +986,14 @@ void thermal_zone_device_update(struct t
 
 				cdev = instance->cdev;
 
-				if (temp > trip_temp)
+				if (temp >= trip_temp)
 					cdev->ops->set_cur_state(cdev, 1);
 				else
 					cdev->ops->set_cur_state(cdev, 0);
 			}
 			break;
 		case THERMAL_TRIP_PASSIVE:
-			if (temp > trip_temp || tz->passive)
+			if (temp >= trip_temp || tz->passive)
 				thermal_zone_device_passive(tz, temp,
 							    trip_temp, count);
 			break;
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Vladimir Zajac

This patch fixes a regression caused by commit b1569e99c795bf83b4ddf41c4f1c42761ab7f75e
"ACPI: move thermal trip handling to generic thermal layer" which accidentally changed trip point trigger condition to
temp > trip_temp

This patch changes the trigger condition back to
temp >= trip_temp

Quoted 42 lines

---

 thermal_sys.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/thermal_sys.c +4 -4
@@ -961,7 +961,7 @@ void thermal_zone_device_update(struct t
 
 		switch (trip_type) {
 		case THERMAL_TRIP_CRITICAL:
-			if (temp > trip_temp) {
+			if (temp >= trip_temp) {
 				if (tz->ops->notify)
 					ret = tz->ops->notify(tz, count,
 							      trip_type);
@@ -974,7 +974,7 @@ void thermal_zone_device_update(struct t
 			}
 			break;
 		case THERMAL_TRIP_HOT:
-			if (temp > trip_temp)
+			if (temp >= trip_temp)
 				if (tz->ops->notify)
 					tz->ops->notify(tz, count, trip_type);
 			break;
@@ -986,14 +986,14 @@ void thermal_zone_device_update(struct t
 
 				cdev = instance->cdev;
 
-				if (temp > trip_temp)
+				if (temp >= trip_temp)
 					cdev->ops->set_cur_state(cdev, 1);
 				else
 					cdev->ops->set_cur_state(cdev, 0);
 			}
 			break;
 		case THERMAL_TRIP_PASSIVE:
-			if (temp > trip_temp || tz->passive)
+			if (temp >= trip_temp || tz->passive)
 				thermal_zone_device_passive(tz, temp,
 							    trip_temp, count);
 			break;
author Acked-by Matthew Garrett
#2 lore raw
Quoted 7 lines · On Thursday 07 May 2009 02:48:00 Zhang Rui wrote:
Quoted 6 lines · Vladimir Zajac

This patch fixes a regression caused by commit b1569e99c795bf83b4ddf41c4f1c42761ab7f75e
"ACPI: move thermal trip handling to generic thermal layer" which accidentally changed trip point trigger condition to
temp > trip_temp

Quoted 6 lines
Quoted 4 lines

This patch changes the trigger condition back to
temp >= trip_temp

Quoted 29 lines
Quoted 29 lines

---

 thermal_sys.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/thermal_sys.c +2 -2
@@ -961,7 +961,7 @@ void thermal_zone_device_update(struct t
 
 		switch (trip_type) {
 		case THERMAL_TRIP_CRITICAL:
-			if (temp > trip_temp) {
+			if (temp >= trip_temp) {
 				if (tz->ops->notify)
 					ret = tz->ops->notify(tz, count,
 							      trip_type);
@@ -974,7 +974,7 @@ void thermal_zone_device_update(struct t
 			}
 			break;
 		case THERMAL_TRIP_HOT:
-			if (temp > trip_temp)
+			if (temp >= trip_temp)
 				if (tz->ops->notify)
 					tz->ops->notify(tz, count, trip_type);
 			break;
@@ -986,14 +986,14 @@ void thermal_zone_device_update(struct t
 
 				cdev = instance->cdev;
 
Quoted 13 lines

drivers/thermal/thermal_sys.c void thermal_zone_device_update(struct t · line 999

Quoted 13 lines
drivers/thermal/thermal_sys.c +2 -2
-				if (temp > trip_temp)
+				if (temp >= trip_temp)
 					cdev->ops->set_cur_state(cdev, 1);
 				else
 					cdev->ops->set_cur_state(cdev, 0);
 			}
 			break;
 		case THERMAL_TRIP_PASSIVE:
-			if (temp > trip_temp || tz->passive)
+			if (temp >= trip_temp || tz->passive)
 				thermal_zone_device_passive(tz, temp,
 							    trip_temp, count);
 			break;

Forwarding Matthew Garrett's reply from another thread:

Quoted 5 lines

Looks good. You probably need to resend it with a Signed-off-by: line, but feel free to add

#4 lore raw
In reply to Vladimir Zajac
Quoted 10 lines · On Wednesday 06 May 2009 19:34:21 Vladimir Zajac wrote:

This patch fixes a regression caused by commit b1569e99c795bf83b4ddf41c4f1c42761ab7f75e
"ACPI: move thermal trip handling to generic thermal layer" which accidentally changed trip point trigger condition to
temp > trip_temp

This patch changes the trigger condition back to
temp >= trip_temp

This one should have
CC: [email protected]
added.
Vladimir, do you mind submitting this one for stable inclusion if not done already.

Thanks,

Thomas

Quoted 6 lines

---

 thermal_sys.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- linux-2.6.30-rc4/drivers/thermal/thermal_sys.c 2009-04-30

23:52:59.000000000 +0200

Quoted 1 line

+++ linux-2.6.30-rc4-p1/drivers/thermal/thermal_sys.c 2009-05-04

19:58:30.000000000 +0200

Quoted 36 lines
drivers/thermal/thermal_sys.c +4 -5
@@ -961,7 +961,7 @@ void thermal_zone_device_update(struct t
 
 		switch (trip_type) {
 		case THERMAL_TRIP_CRITICAL:
-			if (temp > trip_temp) {
+			if (temp >= trip_temp) {
 				if (tz->ops->notify)
 					ret = tz->ops->notify(tz, count,
 							      trip_type);
@@ -974,7 +974,7 @@ void thermal_zone_device_update(struct t
 			}
 			break;
 		case THERMAL_TRIP_HOT:
-			if (temp > trip_temp)
+			if (temp >= trip_temp)
 				if (tz->ops->notify)
 					tz->ops->notify(tz, count, trip_type);
 			break;
@@ -986,14 +986,14 @@ void thermal_zone_device_update(struct t
 
 				cdev = instance->cdev;
 
-				if (temp > trip_temp)
+				if (temp >= trip_temp)
 					cdev->ops->set_cur_state(cdev, 1);
 				else
 					cdev->ops->set_cur_state(cdev, 0);
 			}
 			break;
 		case THERMAL_TRIP_PASSIVE:
-			if (temp > trip_temp || tz->passive)
+			if (temp >= trip_temp || tz->passive)
 				thermal_zone_device_passive(tz, temp,
 							    trip_temp, count);
 			break;
--
Quoted 1 line

To unsubscribe from this list: send the line "unsubscribe linux-

acpi" in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 6 lines · On Tuesday 09 June 2009 15:10:10 Thomas Renninger wrote:

This one should have
CC: [email protected]
added.
Vladimir, do you mind submitting this one for stable inclusion if not done already.

Inclusion into stable is not needed.
The bug was introduced in 2.6.30-rc1, stable release is not affected.

Vladimir