From 262afa2f9cc94d1530d0df257c6be8652fb34f33 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 126014c9..cf74eca2 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 0ea51077..24fe036f 100644 --- a/master/module.c +++ b/master/module.c @@ -112,7 +112,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);