diff --git a/examples/ioctl.c b/examples/ioctl.c index eac0785..8af9d28 100644 --- a/examples/ioctl.c +++ b/examples/ioctl.c @@ -8,6 +8,7 @@ #include #include #include +#include struct ioctl_arg { unsigned int val; @@ -139,7 +140,9 @@ static int test_ioctl_open(struct inode *inode, struct file *filp) } static struct file_operations fops = { +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) .owner = THIS_MODULE, +#endif .open = test_ioctl_open, .release = test_ioctl_close, .read = test_ioctl_read, diff --git a/examples/static_key.c b/examples/static_key.c index 9a9b8f9..3e56941 100644 --- a/examples/static_key.c +++ b/examples/static_key.c @@ -11,6 +11,7 @@ #include #include /* for get_user and put_user */ #include /* for static key macros */ +#include #include @@ -41,7 +42,9 @@ static struct class *cls; static DEFINE_STATIC_KEY_FALSE(fkey); static struct file_operations chardev_fops = { +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) .owner = THIS_MODULE, +#endif .open = device_open, .release = device_release, .read = device_read, diff --git a/examples/vinput.c b/examples/vinput.c index 21bd9aa..cf4d8ea 100644 --- a/examples/vinput.c +++ b/examples/vinput.c @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -132,7 +133,9 @@ static ssize_t vinput_write(struct file *file, const char __user *buffer, } static const struct file_operations vinput_fops = { +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) .owner = THIS_MODULE, +#endif .open = vinput_open, .release = vinput_release, .read = vinput_read, @@ -240,7 +243,12 @@ static int vinput_register_vdevice(struct vinput *vinput) return err; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0) +static ssize_t export_store(const struct class *class, + const struct class_attribute *attr, +#else static ssize_t export_store(struct class *class, struct class_attribute *attr, +#endif const char *buf, size_t len) { int err; @@ -281,7 +289,12 @@ fail: /* This macro generates class_attr_export structure and export_store() */ static CLASS_ATTR_WO(export); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0) +static ssize_t unexport_store(const struct class *class, + const struct class_attribute *attr, +#else static ssize_t unexport_store(struct class *class, struct class_attribute *attr, +#endif const char *buf, size_t len) { int err; @@ -322,7 +335,9 @@ ATTRIBUTE_GROUPS(vinput_class); static struct class vinput_class = { .name = "vinput", +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) .owner = THIS_MODULE, +#endif .class_groups = vinput_class_groups, };