[PATCH 06/20] headers: add thermal_zone_device_register_with_trips backport

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

v6.3 mt76 and other drivers use thermal_zone_device_register_with_trips()
which was introduced in v6.0.  Map it to thermal_zone_device_register()
for older kernels, passing 0 as num_trips and NULL as trips.

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

diff --git a/backport/backport-include/linux/thermal.h b/backport/backport-include/linux/thermal.h
index f1663eff..af3c114f 100644
--- a/backport/backport-include/linux/thermal.h
+++ b/backport/backport-include/linux/thermal.h
@@ -25,4 +25,22 @@ static inline int thermal_zone_device_disable(struct thermal_zone_device *tz)
 { return 0; }
 #endif /* < 5.9 */
 
+#if LINUX_VERSION_IS_LESS(6,0,0)
+#define thermal_zone_device_register_with_trips LINUX_BACKPORT(thermal_zone_device_register_with_trips)
+static inline struct thermal_zone_device *
+thermal_zone_device_register_with_trips(const char *type,
+					 struct thermal_trip *trips,
+					 int num_trips, int mask,
+					 void *devdata,
+					 struct thermal_zone_device_ops *ops,
+					 struct thermal_zone_params *tzp,
+					 int passive_delay,
+					 int polling_delay)
+{
+	return thermal_zone_device_register(type, num_trips, mask, devdata,
+					    ops, tzp, passive_delay,
+					    polling_delay);
+}
+#endif /* < 6.0 */
+
 #endif /* __BACKPORT_LINUX_THERMAL_H */
-- 
2.43.0