Commit e2fa7488 authored by Keerthy's avatar Keerthy Committed by Zhang Rui

thermal: of-thermal: Fix setting of set_emul_temp hook

Currently thermal zone set_emul_temp is set unconditionally
with of_thermal_set_emul_temp function. Set this only if the
set_emul_temp hook is provided for thermal_zone_of_device_ops.

This fixes emul_temp failures on platforms for which set_emul_temp
hook is not populated.

Fixes: "184a4bf6 (thermal: of: Extend current
	of-thermal.c code to allow setting emulated temp)"
Suggested-by: default avatarEduardo Valentin <edubezval@gmail.com>
Signed-off-by: default avatarKeerthy <j-keerthy@ti.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>

Conflicts:
	drivers/thermal/of-thermal.c
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 1f09ba82
...@@ -192,9 +192,6 @@ static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, ...@@ -192,9 +192,6 @@ static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
{ {
struct __thermal_zone *data = tz->devdata; struct __thermal_zone *data = tz->devdata;
if (!data->ops || !data->ops->set_emul_temp)
return -EINVAL;
return data->ops->set_emul_temp(data->sensor_data, temp); return data->ops->set_emul_temp(data->sensor_data, temp);
} }
...@@ -432,7 +429,9 @@ thermal_zone_of_add_sensor(struct device_node *zone, ...@@ -432,7 +429,9 @@ thermal_zone_of_add_sensor(struct device_node *zone,
if (ops->set_trips) if (ops->set_trips)
tzd->ops->set_trips = of_thermal_set_trips; tzd->ops->set_trips = of_thermal_set_trips;
tzd->ops->set_emul_temp = of_thermal_set_emul_temp; if (ops->set_emul_temp)
tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
mutex_unlock(&tzd->lock); mutex_unlock(&tzd->lock);
return tzd; return tzd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment