Skip to content

Commit 5ce76d4

Browse files
authored
Fix module building failed after Linux 6.4 (#13)
* Fix module building failed after Linux 6.4 * Fix consistency of version comparison
1 parent beb7996 commit 5ce76d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fibdrv.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/kernel.h>
77
#include <linux/module.h>
88
#include <linux/mutex.h>
9+
#include <linux/version.h>
910

1011
MODULE_LICENSE("Dual MIT/GPL");
1112
MODULE_AUTHOR("National Cheng Kung University, Taiwan");
@@ -118,9 +119,11 @@ static int __init init_fib_dev(void)
118119
goto failed_cdev;
119120
}
120121
fib_dev = MKDEV(major, minor);
121-
122+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
123+
fib_class = class_create(DEV_FIBONACCI_NAME);
124+
#else
122125
fib_class = class_create(THIS_MODULE, DEV_FIBONACCI_NAME);
123-
126+
#endif
124127
if (!fib_class) {
125128
printk(KERN_ALERT "Failed to create device class\n");
126129
rc = -3;

0 commit comments

Comments
 (0)