Fix class_create on kernel 6.4

Commit 1aaba11da9aa7d7d6b52a74d45b31cac118295a1 in kernel code removed
`module *` argument from `class_create`.
This commit is contained in:
Nicola Fontana 2023-07-05 07:26:12 +02:00
parent 589838526a
commit 262afa2f9c
2 changed files with 8 additions and 0 deletions

View File

@ -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);

View File

@ -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);