Skip to content

Commit e6ec64f

Browse files
jhovoldDaniel Lezcano
authored andcommitted
thermal/drivers/qcom: Fix set_trip_temp() deadlock
The set_trip_temp() callback is used when changing the trip temperature through sysfs. As it is called with the thermal-zone-device lock held it must not use thermal_zone_get_trip() directly or it will deadlock. Fixes: 78c3e24 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function") Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 44a29a4 commit e6ec64f

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

drivers/thermal/qcom/qcom-spmi-temp-alarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, in
270270
struct thermal_trip trip;
271271
int ret;
272272

273-
ret = thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
273+
ret = __thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
274274
if (ret)
275275
return ret;
276276

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,7 @@ int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
12141214

12151215
return tz->ops->get_trip_type(tz, trip_id, &trip->type);
12161216
}
1217+
EXPORT_SYMBOL_GPL(__thermal_zone_get_trip);
12171218

12181219
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
12191220
struct thermal_trip *trip)

include/linux/thermal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ static inline void devm_thermal_of_zone_unregister(struct device *dev,
334334
}
335335
#endif
336336

337+
int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
338+
struct thermal_trip *trip);
337339
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
338340
struct thermal_trip *trip);
339341

0 commit comments

Comments
 (0)