From: Gregory Greenman <gregory.greenman@xxxxxxxxx> thermal_trip struct was removed in kernel 5.10 and added back in 6.0; in addition 6.0 got some other changes. Signed-off-by: Gregory Greenman <gregory.greenman@xxxxxxxxx> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- backport/backport-include/linux/thermal.h | 34 +++++++++++++++++++++++ backport/compat/Makefile | 1 + backport/compat/backport-6.0.c | 19 +++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 backport/compat/backport-6.0.c diff --git a/backport/backport-include/linux/thermal.h b/backport/backport-include/linux/thermal.h index 2e0fcb6b3d28..210292509ac3 100644 --- a/backport/backport-include/linux/thermal.h +++ b/backport/backport-include/linux/thermal.h @@ -14,6 +14,25 @@ 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) && LINUX_VERSION_IS_GEQ(5,10,0) +struct thermal_trip { + int temperature; + int hysteresis; + enum thermal_trip_type type; +}; +#endif + +#if LINUX_VERSION_IS_LESS(6,0,0) +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); +#endif /* <6,0,0 */ + #if LINUX_VERSION_IS_LESS(6,4,0) void *thermal_zone_device_priv(struct thermal_zone_device *tzd); #endif /* < 6.4.0 */ @@ -28,6 +47,21 @@ static inline int thermal_zone_device_disable(struct thermal_zone_device *tz) { return -ENODEV; } #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 NULL; +} +#endif + #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) diff --git a/backport/compat/Makefile b/backport/compat/Makefile index 62dfc62f7b46..d55437d70ae7 100644 --- a/backport/compat/Makefile +++ b/backport/compat/Makefile @@ -16,6 +16,7 @@ compat-$(CPTCFG_KERNEL_5_10) += backport-5.10.o compat-$(CPTCFG_KERNEL_5_11) += backport-5.11.o compat-$(CPTCFG_KERNEL_5_13) += backport-5.13.o compat-$(CPTCFG_KERNEL_5_15) += backport-5.15.o +compat-$(CPTCFG_KERNEL_6_0) += backport-6.0.o compat-$(CPTCFG_KERNEL_6_4) += backport-6.4.o compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += verification/verify.o diff --git a/backport/compat/backport-6.0.c b/backport/compat/backport-6.0.c new file mode 100644 index 000000000000..7cb699fc0007 --- /dev/null +++ b/backport/compat/backport-6.0.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/types.h> +#include <linux/thermal.h> + +#ifdef CONFIG_THERMAL +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); +} +EXPORT_SYMBOL_GPL(thermal_zone_device_register_with_trips); +#endif /* CONFIG_THERMAL */ -- 2.45.1