linux/drivers/thermal/qcom
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
..
Kconfig nvmem: prefix all symbols with NVMEM_ 2022-09-24 14:54:38 +02:00
lmh.c thermal/drivers/qcom/lmh: Fix irq handler return value 2022-12-14 15:25:41 +01:00
Makefile thermal/drivers/qcom: Add support for LMh driver 2021-08-18 09:32:25 +02:00
qcom-spmi-adc-tm5.c thermal/drivers/qcom: Demote error log of thermal zone register to debug 2022-12-14 15:25:40 +01:00
qcom-spmi-temp-alarm.c thermal/drivers/qcom: Fix lock inversion 2023-01-06 14:14:48 +01:00
tsens-8960.c thermal/drivers/tsens: Allow configuring min and max trips 2022-12-14 15:25:40 +01:00
tsens-v0_1.c thermal/drivers/tsens: Allow configuring min and max trips 2022-12-14 15:25:40 +01:00
tsens-v1.c thermal/drivers/tsens: Allow configuring min and max trips 2022-12-14 15:25:40 +01:00
tsens-v2.c thermal/drivers/tsens: Add IPQ8074 support 2022-12-14 15:25:40 +01:00
tsens.c thermal/drivers/qcom/tsens: Rework debugfs file structure 2022-12-14 15:25:40 +01:00
tsens.h thermal/drivers/tsens: Add IPQ8074 support 2022-12-14 15:25:40 +01:00