[PATCH 11/20] headers: add thermal_zone_device_priv() backport for kernels < 6.4

Yi Cong <[email protected]> Wed, 24 Jun 2026 15:38:35 +0800
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
From: Yi Cong <[email protected]>

thermal_zone_device_priv() was introduced in v6.4 to replace direct
access to tz->devdata. Provide an inline wrapper for older kernels.

Signed-off-by: Yi Cong <[email protected]>
---
 backport/backport-include/linux/thermal.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/backport/backport-include/linux/thermal.h b/backport/backport-include/linux/thermal.h
index af3c114f..ea6568d0 100644
--- a/backport/backport-include/linux/thermal.h
+++ b/backport/backport-include/linux/thermal.h
@@ -43,4 +43,11 @@ thermal_zone_device_register_with_trips(const char *type,
 }
 #endif /* < 6.0 */
 
+#if LINUX_VERSION_IS_LESS(6,4,0)
+static inline void *thermal_zone_device_priv(struct thermal_zone_device *tz)
+{
+	return tz->devdata;
+}
+#endif /* < 6.4 */
+
 #endif /* __BACKPORT_LINUX_THERMAL_H */
-- 
2.43.0