@@ -1834,10 +1834,15 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
mutex_unlock(&thermal_governor_lock);
+ if (thermal_iio_sensor_register(tz))
+ goto unregister;
+
if (!tz->tzp || !tz->tzp->no_hwmon) {
result = thermal_add_hwmon_sysfs(tz);
- if (result)
+ if (result) {
+ thermal_iio_sensor_unregister(tz);
goto unregister;
+ }
}
mutex_lock(&thermal_list_lock);
@@ -1920,7 +1925,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
device_remove_file(&tz->device, &dev_attr_policy);
remove_trip_attrs(tz);
thermal_set_governor(tz, NULL);
-
+ thermal_iio_sensor_unregister(tz);
thermal_remove_hwmon_sysfs(tz);
release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
idr_destroy(&tz->idr);
Register zone temperature sensor as IIO device during zone registration. Also IIO device is removed during zone removal. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> --- drivers/thermal/thermal_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)