summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_core.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2022-11-10 18:24:58 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-11-14 21:04:37 +0300
commit05eeee2b51b44c7ba5f1b8e5c41362020513f163 (patch)
treedb5f9529216677a28b1fc3af6f49f2eb9f483891 /drivers/thermal/thermal_core.c
parentea37bec51ff442546e4a57d5cca2de9cc64a9df3 (diff)
downloadlinux-05eeee2b51b44c7ba5f1b8e5c41362020513f163.tar.xz
thermal/core: Protect sysfs accesses to thermal operations with thermal zone mutex
Protect access to thermal operations against thermal zone removal by acquiring the thermal zone device mutex. After acquiring the mutex, check if the thermal zone device is registered and abort the operation if not. With this change, we can call __thermal_zone_device_update() instead of thermal_zone_device_update() from trip_point_temp_store() and from emul_temp_store(). Similar, we can call __thermal_zone_set_trips() instead of thermal_zone_set_trips() from trip_point_hyst_store(). Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal/thermal_core.c')
-rw-r--r--drivers/thermal/thermal_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 0657e4bd4791..173b049dca41 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -403,8 +403,8 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz)
pos->initialized = false;
}
-static void __thermal_zone_device_update(struct thermal_zone_device *tz,
- enum thermal_notify_event event)
+void __thermal_zone_device_update(struct thermal_zone_device *tz,
+ enum thermal_notify_event event)
{
int count;