Skip to content

Commit

Permalink
Fix fred test driver build issue
Browse files Browse the repository at this point in the history
Signed-off-by: Shan Kang <[email protected]>
  • Loading branch information
kangshan1157 committed Jun 4, 2024
1 parent ca365c9 commit cdef3a8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion BM/fred/fred_test_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <asm/cpufeatures.h>
#include <asm/msr-index.h>
#include <asm/msr.h>
#include <linux/version.h>

MODULE_AUTHOR("Shan Kang <[email protected]>");
MODULE_VERSION("1.0");
Expand Down Expand Up @@ -255,8 +256,15 @@ static int __init fred_test_driver_init(void)
goto r_class;
}
/* Creating struct class */
//dev_class = class_create(THIS_MODULE, "fred_test_class");

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
// For kernel versions 2.6.26 and later
dev_class = class_create(THIS_MODULE, "fred_test_class");
#else
// For older kernel versions
dev_class = class_create("fred_test_class");
#endif

if (IS_ERR(dev_class)) {
pr_err("Cannot create the struct class\n");
goto r_class;
Expand Down

0 comments on commit cdef3a8

Please sign in to comment.