From 5d8c8990dedce8c8ea8583baae029036583c1252 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Wed, 5 Jul 2023 07:26:12 +0200 Subject: [PATCH] Fix class_create on kernel 6.4 Commit 1aaba11da9aa7d7d6b52a74d45b31cac118295a1 in kernel code removed `module *` argument from `class_create`. --- devices/ccat/module.c | 4 ++++ master/module.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/devices/ccat/module.c b/devices/ccat/module.c index 2c0cdb28..1294480c 100644 --- a/devices/ccat/module.c +++ b/devices/ccat/module.c @@ -71,7 +71,11 @@ static int __init ccat_class_init(struct ccat_class *base) return -1; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) base->class = class_create(THIS_MODULE, base->name); +#else + base->class = class_create(base->name); +#endif if (!base->class) { pr_warn("Create device class '%s' failed\n", base->name); diff --git a/master/module.c b/master/module.c index 2157006b..43a95896 100644 --- a/master/module.c +++ b/master/module.c @@ -115,7 +115,11 @@ int __init ec_init_module(void) } } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) class = class_create(THIS_MODULE, "EtherCAT"); +#else + class = class_create("EtherCAT"); +#endif if (IS_ERR(class)) { EC_ERR("Failed to create device class.\n"); ret = PTR_ERR(class);