summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-04 22:05:49 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-22 13:06:06 +0300
commit662f920f7e390db5d1a6792a2b0ffa59b6c962fc (patch)
treef4afb5373db366c362c1a8b73626084c67c77371
parent85ee9449f76430846132b0248a99a6cfb524f992 (diff)
downloadlinux-662f920f7e390db5d1a6792a2b0ffa59b6c962fc.tar.xz
thermal: core: Initialize thermal zones before registering them
Since user space can start interacting with a new thermal zone as soon as device_register() called by thermal_zone_device_register_with_trips() returns, it is better to initialize the thermal zone before calling device_register() on it. Fixes: d0df264fbd3c ("thermal/core: Remove pointless thermal_zone_device_reset() function") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/3336146.44csPzL39Z@rjwysocki.net Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
-rw-r--r--drivers/thermal/thermal_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 1e87256e86be..03f5ac996a7a 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1467,6 +1467,7 @@ thermal_zone_device_register_with_trips(const char *type,
thermal_zone_destroy_device_groups(tz);
goto remove_id;
}
+ thermal_zone_device_init(tz);
result = device_register(&tz->device);
if (result)
goto release_device;
@@ -1509,7 +1510,6 @@ thermal_zone_device_register_with_trips(const char *type,
mutex_unlock(&thermal_list_lock);
- thermal_zone_device_init(tz);
/* Update the new thermal zone and mark it as already updated. */
if (atomic_cmpxchg(&tz->need_update, 1, 0))
thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);