thermal/core: Introduce locked version of thermal_zone_device_update
authorGuenter Roeck <linux@roeck-us.net>
Thu, 10 Nov 2022 15:24:56 +0000 (07:24 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 14 Nov 2022 18:04:37 +0000 (19:04 +0100)
commit1c439dec359caa225c7752334c7a14ef9e3344c7
treebedb8f0bd4a8618abce95337dfe56ee0c6924f4c
parented97d10a8b2c78d1664b01658c5f581e6791ff7d
thermal/core: Introduce locked version of thermal_zone_device_update

In thermal_zone_device_set_mode(), the thermal zone mutex is released only
to be reacquired in the subsequent call to thermal_zone_device_update().

Introduce __thermal_zone_device_update(), which is similar to
thermal_zone_device_update() but has to be called with the thermal device
mutex held. Call the new function from thermal_zone_device_set_mode()
to avoid the extra thermal device mutex release/acquire sequence in that
function.

With the new function in place, re-implement thermal_zone_device_update()
as wrapper around __thermal_zone_device_update() to acquire and release
the thermal device mutex.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/thermal_core.c