[PATCH 57/74] backport: don't call thermal_zone_device_register for 6.0+

Johannes Berg <[email protected]> Fri, 24 May 2024 19:08:09 +0200
Newsgroups org.kernel.vger.backports
Message-ID <20240524190907.6300b3433e5a.I8f204514c641d4a58039ec6aa00029c5eca9e13e@changeid>
From: Miri Korenblit <[email protected]>

the backport version ofthermal_zone_device_register_with_trips calls
thermal_zone_device_register, but this was removed in 6.6, and
thermal_zone_device_register_with_trips does exist in 6.0+,
just has one more argument. So for kernels of version 6.0+, the
backported version can call it with 0 as the extra argument.

Signed-off-by: Miri Korenblit <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
---
 backport/compat/backport-6.9.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/backport/compat/backport-6.9.c b/backport/compat/backport-6.9.c
index 6ae485da3975..5a370756b75e 100644
--- a/backport/compat/backport-6.9.c
+++ b/backport/compat/backport-6.9.c
@@ -12,8 +12,21 @@ thermal_zone_device_register_with_trips(const char *type,
 					struct thermal_zone_params *tzp, int passive_delay,
 					int polling_delay)
 {
+#if LINUX_VERSION_IS_LESS(6,0,0)
 	return thermal_zone_device_register(type, num_trips, 0, devdata, ops, tzp,
 					    passive_delay, polling_delay);
+#else
+#undef thermal_trip
+#undef thermal_zone_device_register_with_trips
+	return thermal_zone_device_register_with_trips(type,
+						       (struct thermal_trip *)(void *) trips,
+						       num_trips,
+						       0, devdata,
+						       ops, tzp, passive_delay,
+						       polling_delay);
+#define thermal_trip backport_thermal_trip
+#define thermal_zone_device_register_with_trips LINUX_BACKPORT(thermal_zone_device_register_with_trips)
+#endif /* < 6,6,0 */
 }
 EXPORT_SYMBOL_GPL(thermal_zone_device_register_with_trips);
 #endif /* CONFIG_THERMAL */
-- 
2.45.1