From a2b219eeecbfda27f5cd12b98a9cbdbf3a706357 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Mon, 6 Sep 2021 01:08:58 +0200 Subject: [PATCH] Use proc_ops instead of file_operations on Linux >= 5.6 Signed-off-by: Marc 'risson' Schmitt --- nuc_led.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nuc_led.c b/nuc_led.c index c975f22..c488eb5 100644 --- a/nuc_led.c +++ b/nuc_led.c @@ -30,6 +30,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -443,11 +444,18 @@ static ssize_t acpi_proc_read(struct file *filp, char __user *buff, return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) +static struct proc_ops proc_acpi_operations = { + .proc_read = acpi_proc_read, + .proc_write = acpi_proc_write, +}; +#else static struct file_operations proc_acpi_operations = { .owner = THIS_MODULE, .read = acpi_proc_read, .write = acpi_proc_write, }; +#endif /* Init & unload */ static int __init init_nuc_led(void)