Browse Source

Ensure Linux v6.5 compatibility

Jim Huang 1 year ago
parent
commit
e1b44579b0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      examples/static_key.c

+ 4 - 0
examples/static_key.c

@@ -61,7 +61,11 @@ static int __init chardev_init(void)
 
     pr_info("I was assigned major number %d\n", major);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
     cls = class_create(THIS_MODULE, DEVICE_NAME);
+#else
+    cls = class_create(DEVICE_NAME);
+#endif
 
     device_create(cls, NULL, MKDEV(major, 0), NULL, DEVICE_NAME);