thermal: core: Initialize thermal zones before registering them
[ Upstream commit 662f920f7e390db5d1a6792a2b0ffa59b6c962fc ]
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: d0df264fbd ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
24d1a41256
commit
d01d9005fb
@@ -1465,6 +1465,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;
|
||||
@@ -1503,7 +1504,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);
|
||||
|
||||
Reference in New Issue
Block a user