fix build (yet again) for < 6.4 kernels

I hope Linus realizes the mess he has built
This commit is contained in:
anna 2023-07-26 17:54:24 +02:00
parent b6139870fa
commit 23d2512131
Signed by: fef
GPG key ID: 2585C2DC6D79B485

View file

@ -27,6 +27,7 @@ static struct device *keymash_device;
#define KEYMASH_MINOR_COUNT 1 #define KEYMASH_MINOR_COUNT 1
#define KEYMASH_DEVICE_NAME "keymash" #define KEYMASH_DEVICE_NAME "keymash"
#define KEYMASH_CLASS_NAME "kmsh"
static const char keymash_chrs[] = "asdfghjkl;"; static const char keymash_chrs[] = "asdfghjkl;";
#define KEYMASH_CHRS_LEN (ARRAY_SIZE(keymash_chrs) - 1) /* minus NUL */ #define KEYMASH_CHRS_LEN (ARRAY_SIZE(keymash_chrs) - 1) /* minus NUL */
@ -98,7 +99,11 @@ static int keymash_init(void)
goto err_cdev_add; 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)) { if (IS_ERR(keymash_class)) {
err = PTR_ERR(keymash_class); err = PTR_ERR(keymash_class);
keymash_err("class_create() returned %d\n", err); keymash_err("class_create() returned %d\n", err);