Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 37 lines 825 B view raw
1--- a/msi-ec.c 2+++ b/msi-ec.c 3@@ -38,7 +38,12 @@ 4 #include <linux/slab.h> 5 #include <linux/version.h> 6 #include <linux/rtc.h> 7-#include <linux/string_choices.h> 8+ 9+#include <linux/version.h> 10+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,6,0) 11+#include <linux/string_choices.h> 12+#endif 13+ 14 15 static DEFINE_MUTEX(ec_set_by_mask_mutex); 16 static DEFINE_MUTEX(ec_unset_by_mask_mutex); 17@@ -1141,6 +1146,20 @@ static struct msi_ec_conf CONF52 __initdata = { 18 }, 19 }; 20 21+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0) 22+/* Define our own string choice helpers for older kernels */ 23+static inline const char *str_on_off(bool v) 24+{ 25+ return v ? "on" : "off"; 26+} 27+ 28+static inline const char *str_yes_no(bool v) 29+{ 30+ return v ? "yes" : "no"; 31+} 32+#endif 33+ 34+ 35 static struct msi_ec_conf *CONFIGURATIONS[] __initdata = { 36 &CONF0, 37 &CONF1,