[2/2] Thermal: Deactive cooling device when unbind it.

Message ID 1348210638-4746-3-git-send-email-hongbo.zhang@linaro.org
State New
Headers show

Commit Message

Hongbo Zhang Sept. 21, 2012, 6:57 a.m.
From: "hongbo.zhang" <hongbo.zhang@linaro.com>

A cooling device should be set to state zero when it is unbound.

Signed-off-by: hongbo.zhang <hongbo.zhang@linaro.com>
---
 drivers/thermal/thermal_sys.c | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 2c28c85..efc5c56 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -885,6 +885,8 @@  int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
 	mutex_lock(&tz->lock);
 	list_for_each_entry_safe(pos, next, &tz->cooling_devices, node) {
 		if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) {
+			if (cdev->ops->set_cur_state)
+				cdev->ops->set_cur_state(cdev, 0);
 			list_del(&pos->node);
 			mutex_unlock(&tz->lock);
 			goto unbind;