aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-07 13:29:22 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-10-07 13:29:22 +0200
commitb44444027ce7714f309e96b804b7fb088a40d708 (patch)
tree8f7667c4c2f914b6904c9e30ad112ce99eb27526 /drivers/thermal
parent4963e34ce7b95237021575d208fa576f88697839 (diff)
downloadlinux-b44444027ce7714f309e96b804b7fb088a40d708.tar.gz
thermal: trip: Remove lockdep assertion from for_each_thermal_trip()
The lockdep assertion in for_each_thermal_trip() was added to possibly catch incorrect usage of that function without the thermal zone lock. However, it turns out that the ACPI thermal driver has a legitimate reason to call for_each_thermal_trip() without locking. Namely, it is called by acpi_thermal_bind_unbind_cdev() in the thermal zone registration and unregistration paths. That function cannot acquire the thermal zone lock by itself, because it calls functions that acquire it, thermal_bind_cdev_to_trip() or thermal_unbind_cdev_from_trip(). However, it is invoked when the ACPI notify handler for the thermal zone in question has not been registered yet (in the registration path) or after that handler has been unregistered (in the unregistration path). Therefore, when for_each_thermal_trip() is called by acpi_thermal_bind_unbind_cdev(), thermal trip changes induced by the platform firmware cannot take place and so the thermal zone's trips[] table is effectively immutable. Hence, it is valid to call for_each_thermal_trip() from acpi_thermal_bind_unbind_cdev() without locking and the lockdep assertion in the former is in fact incorrect, so remove it. Fixes: d5ea889246b1 ("ACPI: thermal: Do not use trip indices for cooling device binding") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_trip.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_trip.c b/drivers/thermal/thermal_trip.c
index 8c649a89953757..9f10e2ff924842 100644
--- a/drivers/thermal/thermal_trip.c
+++ b/drivers/thermal/thermal_trip.c
@@ -15,8 +15,6 @@ int for_each_thermal_trip(struct thermal_zone_device *tz,
{
int i, ret;
- lockdep_assert_held(&tz->lock);
-
for (i = 0; i < tz->num_trips; i++) {
ret = cb(&tz->trips[i], data);
if (ret)