[PATCH 39/74] backports: handle thermal_zone_device_priv() for kernels < 6.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Gregory Greenman <gregory.greenman@xxxxxxxxx>

This function was added in v6.4-rc1.

Signed-off-by: Gregory Greenman <gregory.greenman@xxxxxxxxx>
Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
---
 backport/backport-include/linux/thermal.h | 12 ++++++++++++
 backport/compat/backport-6.4.c            |  9 +++++++++
 2 files changed, 21 insertions(+)

diff --git a/backport/backport-include/linux/thermal.h b/backport/backport-include/linux/thermal.h
index 76d4f231aa5a..2e0fcb6b3d28 100644
--- a/backport/backport-include/linux/thermal.h
+++ b/backport/backport-include/linux/thermal.h
@@ -13,6 +13,10 @@ static inline int thermal_zone_device_enable(struct thermal_zone_device *tz)
 static inline int thermal_zone_device_disable(struct thermal_zone_device *tz)
 { return 0; }
 #endif /* < 5.9 */
+
+#if LINUX_VERSION_IS_LESS(6,4,0)
+void *thermal_zone_device_priv(struct thermal_zone_device *tzd);
+#endif /* < 6.4.0 */
 #else /* CONFIG_THERMAL */
 #if LINUX_VERSION_IS_LESS(5,9,0)
 #define thermal_zone_device_enable LINUX_BACKPORT(thermal_zone_device_enable)
@@ -23,6 +27,14 @@ static inline int thermal_zone_device_enable(struct thermal_zone_device *tz)
 static inline int thermal_zone_device_disable(struct thermal_zone_device *tz)
 { return -ENODEV; }
 #endif /* < 5.9 */
+
+#if LINUX_VERSION_IS_LESS(6,4,0)
+#define thermal_zone_device_priv LINUX_BACKPORT(thermal_zone_device_priv)
+static inline void *thermal_zone_device_priv(struct thermal_zone_device *tzd)
+{
+	return NULL;
+}
+#endif /* < 6.4.0 */
 #endif /* CONFIG_THERMAL */
 
 #endif /* __BACKPORT_LINUX_THERMAL_H */
diff --git a/backport/compat/backport-6.4.c b/backport/compat/backport-6.4.c
index d26f46ebddde..af872e5de04d 100644
--- a/backport/compat/backport-6.4.c
+++ b/backport/compat/backport-6.4.c
@@ -3,6 +3,7 @@
 #include <linux/types.h>
 #include <linux/netdevice.h>
 #include <net/dropreason.h>
+#include <linux/thermal.h>
 
 #if LINUX_VERSION_IS_GEQ(6,2,0) && defined(CONFIG_KUNIT)
 #include <kunit/test.h>
@@ -53,3 +54,11 @@ EXPORT_SYMBOL_GPL(drop_reasons_register_subsys);
 void drop_reasons_unregister_subsys(enum skb_drop_reason_subsys subsys)
 {}
 EXPORT_SYMBOL_GPL(drop_reasons_unregister_subsys);
+
+#ifdef CONFIG_THERMAL
+void *thermal_zone_device_priv(struct thermal_zone_device *tzd)
+{
+	return tzd->devdata;
+}
+EXPORT_SYMBOL_GPL(thermal_zone_device_priv);
+#endif /* CONFIG_THERMAL */
-- 
2.45.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux