From d05bc7105a1b8f6df6569b7c1a89a2fe466f8688 Mon Sep 17 00:00:00 2001 From: Ni Wade Date: Wed, 6 Nov 2013 14:30:13 +0800 Subject: [PATCH] thermal: Fix binding problem when there is thermal zone params The thermal zone params can be used to set governor to specific thermal governor for thermal zone device. But if the thermal zone params has only governor name without thermal bind params, then the thermal zone device will not be binding to cooling device. Because tz->ops->bind operator is not invoked in bind_tz() and bind_cdev() when there is thermal zone params. Signed-off-by: Wei Ni Signed-off-by: Jinyoung Park Signed-off-by: Zhang Rui (cherry picked from commit a9f2d19ba7be38590c84487359891d45a66b62f4) Signed-off-by: Alex Shi --- drivers/thermal/thermal_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 83cc99bb5aeb..d2b7be523198 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -238,10 +238,11 @@ static void bind_cdev(struct thermal_cooling_device *cdev) if (!pos->tzp && !pos->ops->bind) continue; - if (!pos->tzp && pos->ops->bind) { + if (pos->ops->bind) { ret = pos->ops->bind(pos, cdev); if (ret) print_bind_err_msg(pos, cdev, ret); + continue; } tzp = pos->tzp; @@ -272,8 +273,8 @@ static void bind_tz(struct thermal_zone_device *tz) mutex_lock(&thermal_list_lock); - /* If there is no platform data, try to use ops->bind */ - if (!tzp && tz->ops->bind) { + /* If there is ops->bind, try to use ops->bind */ + if (tz->ops->bind) { list_for_each_entry(pos, &thermal_cdev_list, node) { ret = tz->ops->bind(tz, pos); if (ret) -- 2.34.1