From 23d25121311f9c9255d3be2cba40831eaf3cb4c4 Mon Sep 17 00:00:00 2001 From: fef Date: Wed, 26 Jul 2023 17:54:24 +0200 Subject: [PATCH] fix build (yet again) for < 6.4 kernels I hope Linus realizes the mess he has built --- src/keymash.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/keymash.c b/src/keymash.c index f9bc937..5eb3e16 100644 --- a/src/keymash.c +++ b/src/keymash.c @@ -27,6 +27,7 @@ static struct device *keymash_device; #define KEYMASH_MINOR_COUNT 1 #define KEYMASH_DEVICE_NAME "keymash" +#define KEYMASH_CLASS_NAME "kmsh" static const char keymash_chrs[] = "asdfghjkl;"; #define KEYMASH_CHRS_LEN (ARRAY_SIZE(keymash_chrs) - 1) /* minus NUL */ @@ -98,7 +99,11 @@ static int keymash_init(void) goto err_cdev_add; } - keymash_class = class_create("kmsh"); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) + keymash_class = class_create(THIS_MODULE, KEYMASH_CLASS_NAME); +#else + keymash_class = class_create(KEYMASH_CLASS_NAME); +#endif if (IS_ERR(keymash_class)) { err = PTR_ERR(keymash_class); keymash_err("class_create() returned %d\n", err);