mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-11-25 09:41:47 +08:00
Remove module * parameter from class_create() in chardev2.c (#228)
From v6.4, class_create() does not have module *
Same fix as commit 0addb868dc
to chardev.c
This commit is contained in:
parent
514f206da0
commit
d0f86a29f0
|
@ -12,6 +12,7 @@
|
||||||
#include <linux/printk.h>
|
#include <linux/printk.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/uaccess.h> /* for get_user and put_user */
|
#include <linux/uaccess.h> /* for get_user and put_user */
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
#include <asm/errno.h>
|
#include <asm/errno.h>
|
||||||
|
|
||||||
|
@ -205,7 +206,11 @@ static int __init chardev2_init(void)
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||||
|
cls = class_create(DEVICE_FILE_NAME);
|
||||||
|
#else
|
||||||
cls = class_create(THIS_MODULE, DEVICE_FILE_NAME);
|
cls = class_create(THIS_MODULE, DEVICE_FILE_NAME);
|
||||||
|
#endif
|
||||||
device_create(cls, NULL, MKDEV(MAJOR_NUM, 0), NULL, DEVICE_FILE_NAME);
|
device_create(cls, NULL, MKDEV(MAJOR_NUM, 0), NULL, DEVICE_FILE_NAME);
|
||||||
|
|
||||||
pr_info("Device created on /dev/%s\n", DEVICE_FILE_NAME);
|
pr_info("Device created on /dev/%s\n", DEVICE_FILE_NAME);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user