Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fred test driver build issue #255

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading