[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221214131617.2447-2-johan+linaro@kernel.org>
Date: Wed, 14 Dec 2022 14:16:14 +0100
From: Johan Hovold <johan+linaro@...nel.org>
To: Daniel Lezcano <daniel.lezcano@...aro.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Cc: Amit Kucheria <amitk@...nel.org>,
Thara Gopinath <thara.gopinath@...il.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Zhang Rui <rui.zhang@...el.com>,
Bartlomiej Zolnierkiewicz <bzolnier@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
linux-pm@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-tegra@...r.kernel.org,
Johan Hovold <johan+linaro@...nel.org>
Subject: [PATCH 1/4] 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: 78c3e2429be8 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function")
Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
---
drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 2 +-
drivers/thermal/thermal_core.c | 1 +
include/linux/thermal.h | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
index 58055a7abaf6..bfaec74f13b2 100644
--- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
@@ -270,7 +270,7 @@ static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, in
struct thermal_trip trip;
int ret;
- ret = thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
+ ret = __thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
if (ret)
return ret;
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index c24c9efcd175..d9a3d9566d73 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1214,6 +1214,7 @@ int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
return tz->ops->get_trip_type(tz, trip_id, &trip->type);
}
+EXPORT_SYMBOL_GPL(__thermal_zone_get_trip);
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
struct thermal_trip *trip)
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index e2797f314d99..30353e4b1424 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -334,6 +334,8 @@ static inline void devm_thermal_of_zone_unregister(struct device *dev,
}
#endif
+int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
+ struct thermal_trip *trip);
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
struct thermal_trip *trip);
--
2.37.4
Powered by blists - more mailing lists