Skip to content

Commit

Permalink
Fix module building failed after Linux 6.4 (#13)
Browse files Browse the repository at this point in the history
* Fix module building failed after Linux 6.4

* Fix consistency of version comparison
  • Loading branch information
25077667 authored Sep 26, 2023
1 parent beb7996 commit 5ce76d4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fibdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/version.h>

MODULE_LICENSE("Dual MIT/GPL");
MODULE_AUTHOR("National Cheng Kung University, Taiwan");
Expand Down Expand Up @@ -118,9 +119,11 @@ static int __init init_fib_dev(void)
goto failed_cdev;
}
fib_dev = MKDEV(major, minor);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
fib_class = class_create(DEV_FIBONACCI_NAME);
#else
fib_class = class_create(THIS_MODULE, DEV_FIBONACCI_NAME);

#endif
if (!fib_class) {
printk(KERN_ALERT "Failed to create device class\n");
rc = -3;
Expand Down

0 comments on commit 5ce76d4

Please sign in to comment.