]> www.infradead.org Git - users/jedix/linux-maple.git/commit
thermal: core: Consolidate thermal zone locking during initialization
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 4 Oct 2024 19:23:10 +0000 (21:23 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 22 Oct 2024 10:07:15 +0000 (12:07 +0200)
commitd07700b474d38ea4b1130e37d28379fc202054fa
tree4313da14e6a396df98e1d014ac451a37d3e9610f
parentcdf771ab476bd9acb0948f3088a277d5c3cacc6b
thermal: core: Consolidate thermal zone locking during initialization

The part of thermal zone initialization carried out under
thermal_list_lock acquires the thermal zone lock and releases it
multiple times back and forth which is not really necessary.

Instead of doing this, make it acquire the thermal zone lock once after
acquiring thermal_list_lock and release it along with that lock.

For this purpose, move all of the code in question to
thermal_zone_init_complete() introduced previously and provide an
"unlocked" variant of thermal_zone_cdev_bind() to be invoked from
there.

Also notice that a thermal zone does not need to be added to
thermal_tz_list under its own lock, so make the new code acquire
the thermal zone lock after adding it to the list.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/1920382.CQOukoFCf9@rjwysocki.net
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
[ rjw: Rebase on top of recent thermal core changes ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/thermal_core.c