-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Shan Kang <[email protected]>
- Loading branch information
1 parent
ca365c9
commit cdef3a8
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"); | ||
|
@@ -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; | ||
|