File bbswitch-0.8.patch of Package dkms-bbswitch

diff -urN bbswitch-0.8.orig/bbswitch.c bbswitch-0.8/bbswitch.c
--- bbswitch-0.8.orig/bbswitch.c	2013-12-05 00:22:06.000000000 +0100
+++ bbswitch-0.8/bbswitch.c	2023-06-09 17:20:53.466413978 +0200
@@ -35,6 +35,12 @@
 #include <linux/suspend.h>
 #include <linux/seq_file.h>
 #include <linux/pm_runtime.h>
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+#include <linux/proc_fs.h>
+#endif
+
 
 #define BBSWITCH_VERSION "0.8"
 
@@ -375,13 +381,27 @@
     return 0;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+
+static struct proc_ops bbswitch_ops = {
+    .proc_open = bbswitch_proc_open,
+    .proc_read = seq_read,
+    .proc_write = bbswitch_proc_write,
+    .proc_lseek = seq_lseek,
+    .proc_release = single_release,
+};
+
+#else
+
 static struct file_operations bbswitch_fops = {
     .open   = bbswitch_proc_open,
     .read   = seq_read,
     .write  = bbswitch_proc_write,
     .llseek = seq_lseek,
     .release= single_release
-};
+
+#endif
+
 
 static struct notifier_block nb = {
     .notifier_call = &bbswitch_pm_handler
@@ -457,7 +477,11 @@
         }
     }
 
-    acpi_entry = proc_create("bbswitch", 0664, acpi_root_dir, &bbswitch_fops);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+    acpi_entry = proc_create("bbswitch", 0664, acpi_root_dir, &bbswitch_ops);
+#else
+    acpi_entry = proc_create("bbswitch", 0664, acpi_root_dir, &bbswitch_fops);    
+#endif
     if (acpi_entry == NULL) {
         pr_err("Couldn't create proc entry\n");
         return -ENOMEM;
openSUSE Build Service is sponsored by