diff --git a/BM/fred/fred_test_driver.c b/BM/fred/fred_test_driver.c index 73056837..c600fece 100644 --- a/BM/fred/fred_test_driver.c +++ b/BM/fred/fred_test_driver.c @@ -11,6 +11,7 @@ #include #include #include +#include MODULE_AUTHOR("Shan Kang "); 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;