linux/drivers/thermal
Johan Hovold 59edcd91d8 thermal/drivers/qcom: Fix lock inversion
The thermal-zone-device lock is held by core when setting trip points
and the driver takes its chip lock in the corresponding callback.

Fetching the thermal trip points using thermal_zone_get_trip() also
involves taking the thermal-zone-device lock, which means that the chip
lock can not be held when doing so.

Drop the chip lock temporarily during probe to avoid the lock inversion
that was detected by lockdep:

  ======================================================
  WARNING: possible circular locking dependency detected
  6.1.0-next-20221213 #122 Not tainted
  ------------------------------------------------------
  systemd-udevd/264 is trying to acquire lock:
  ffff741e444a0920 (&chip->lock){+.+.}-{3:3}, at: qpnp_tm_get_temp+0xb4/0x1b0 [qcom_spmi_temp_alarm]

  but task is already holding lock:
  ffff741e44341618 (&tz->lock){+.+.}-{3:3}, at: thermal_zone_device_update+0x2c/0x70

  which lock already depends on the new lock.

Fixes: 78c3e2429be8 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221214131617.2447-5-johan+linaro@kernel.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
2023-01-06 14:14:48 +01:00
..
broadcom thermal/drivers/broadcom: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:48 +01:00
intel thermal/drivers/intel: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:48 +01:00
qcom thermal/drivers/qcom: Fix lock inversion 2023-01-06 14:14:48 +01:00
samsung thermal/drivers/exynos: Fix NULL pointer dereference when getting the critical temp 2023-01-06 14:14:48 +01:00
st thermal/drivers/st: Use generic trip points 2023-01-06 14:14:47 +01:00
tegra thermal/drivers/tegra: Fix set_trip_temp() deadlock 2023-01-06 14:14:48 +01:00
ti-soc-thermal thermal/drivers/ti: Remove unused macros ti_thermal_get_trip_value() / ti_thermal_trip_is_valid() 2023-01-06 14:14:48 +01:00
amlogic_thermal.c thermal/drivers/amlogic: Switch to new of API 2022-08-17 14:09:38 +02:00
armada_thermal.c thermal/drivers/armada: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:47 +01:00
cpufreq_cooling.c Merge branches 'thermal-intel' and 'thermal-drivers' 2022-10-03 20:43:32 +02:00
cpuidle_cooling.c thermal/drivers/cpuidle_cooling: Fix use after error 2021-04-15 13:21:26 +02:00
da9062-thermal.c thermal/drivers/da9062: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:48 +01:00
db8500_thermal.c thermal/drivers/db8500: Switch to new of API 2022-08-17 14:09:38 +02:00
devfreq_cooling.c Thermal control updates for 5.20-rc1 2022-08-02 11:27:53 -07:00
dove_thermal.c thermal: Explicitly enable non-changing thermal zone devices 2020-06-29 20:26:37 +02:00
gov_bang_bang.c thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions 2023-01-06 14:14:47 +01:00
gov_fair_share.c thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions 2023-01-06 14:14:47 +01:00
gov_power_allocator.c thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions 2023-01-06 14:14:47 +01:00
gov_step_wise.c thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions 2023-01-06 14:14:47 +01:00
gov_user_space.c thermal: gov_user_space: Do not lock thermal zone mutex 2022-08-30 20:18:47 +02:00
hisi_thermal.c thermal/drivers/hisi: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:47 +01:00
imx8mm_thermal.c thermal/drivers/imx8mm: Add hwmon support 2022-12-14 15:25:40 +01:00
imx_sc_thermal.c thermal/drivers/imx_sc_thermal: Drop empty platform remove function 2022-12-14 15:27:30 +01:00
imx_thermal.c thermal/drivers/imx: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:48 +01:00
k3_bandgap.c thermal/drivers/banggap: Switch to new of API 2022-08-17 14:09:38 +02:00
k3_j72xx_bandgap.c thermal/drivers/k3_j72xx_bandgap: Map fuse_base only for erratum workaround 2022-12-14 15:25:41 +01:00
Kconfig thermal: Drop obsolete dependency on COMPILE_TEST 2022-08-03 19:15:31 +02:00
khadas_mcu_fan.c thermal/core: Make cooling device state change private 2021-01-19 22:31:10 +01:00
kirkwood_thermal.c thermal: Explicitly enable non-changing thermal zone devices 2020-06-29 20:26:37 +02:00
Makefile thermal/drivers/qcom: Drop false build dependency of all QCOM drivers on QCOM_TSENS 2022-10-04 11:21:11 +02:00
max77620_thermal.c thermal/drivers/maxim: Switch to new of API 2022-08-17 14:09:38 +02:00
mtk_thermal.c thermal/drivers/mtk: Switch to new of API 2022-08-17 14:09:38 +02:00
qoriq_thermal.c thermal/drivers/qoriq: Switch to new of API 2022-08-17 14:09:38 +02:00
rcar_gen3_thermal.c thermal/drivers/rcar_gen3: Use the generic function to get the number of trips 2023-01-06 14:14:47 +01:00
rcar_thermal.c thermal/drivers/rcar: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:48 +01:00
rockchip_thermal.c thermal/drivers/rockchip: Switch to new of API 2022-08-17 14:09:37 +02:00
rzg2l_thermal.c thermal/drivers/rzg2l: Switch to new of API 2022-08-17 14:09:38 +02:00
spear_thermal.c thermal: Explicitly enable non-changing thermal zone devices 2020-06-29 20:26:37 +02:00
sprd_thermal.c thermal/drivers/sprd: Switch to new of API 2022-08-17 14:09:38 +02:00
sun8i_thermal.c thermal/drivers/sun8i: Switch to new of API 2022-08-17 14:09:38 +02:00
thermal_core.c thermal/drivers/qcom: Fix set_trip_temp() deadlock 2023-01-06 14:14:48 +01:00
thermal_core.h thermal/of: Remove of_thermal_is_trip_valid() 2023-01-06 14:14:47 +01:00
thermal_helpers.c thermal/core: Add a generic thermal_zone_get_trip() function 2023-01-06 14:14:47 +01:00
thermal_hwmon.c thermal/core: Protect hwmon accesses to thermal operations with thermal zone mutex 2022-11-14 19:04:37 +01:00
thermal_hwmon.h thermal_hwmon: Add devres wrapper for thermal_add_hwmon_sysfs() 2020-01-27 10:24:32 +01:00
thermal_mmio.c Merge branches 'thermal-intel' and 'thermal-drivers' 2022-10-03 20:43:32 +02:00
thermal_netlink.c thermal/core: Add a generic thermal_zone_get_trip() function 2023-01-06 14:14:47 +01:00
thermal_netlink.h thermal: netlink: Fix parameter type of thermal_genl_cpu_capability_event() stub 2022-02-07 20:45:42 +01:00
thermal_of.c thermal/of: Remove of_thermal_get_crit_temp() 2023-01-06 14:14:47 +01:00
thermal_sysfs.c thermal/core: Add a generic thermal_zone_set_trip() function 2023-01-06 14:14:47 +01:00
thermal-generic-adc.c thermal/drivers/generic-adc: Switch to new of API 2022-08-17 14:09:37 +02:00
uniphier_thermal.c thermal/drivers/uniphier: Use generic thermal_zone_get_trip() function 2023-01-06 14:14:47 +01:00