Ensure Linux v6.5 compatibility

This commit is contained in:
Jim Huang 2024-04-16 06:24:06 +08:00
parent 1c31bac22c
commit e1b44579b0

View File

@ -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);