void-packages/srcpkgs/bbswitch/patches/0001-Use-proc_ops-structure...

55 lines
1.5 KiB
Diff

# upstream: yes
From b0fdcfd847ecf5cbe6754b50f0db78600380b9f0 Mon Sep 17 00:00:00 2001
From: Mateusz Mandera <mateusz.mandera@protonmail.com>
Date: Tue, 31 Mar 2020 15:11:30 +0200
Subject: [PATCH 1/2] Use proc_ops structure for kernel version >= 5.6.0
Since 5.6.0, proc_create requires a `struct proc_ops *` argument instead
of `struct file_operations *`.
Commit with the migration in the kernel source can be found at
https://github.com/torvalds/linux/commit/d56c0d45f0e27f814e87a1676b6bdccccbc252e9
---
bbswitch.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git bbswitch.c bbswitch.c
index 228d722..4ce9aae 100644
--- bbswitch.c
+++ bbswitch.c
@@ -35,6 +35,7 @@
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <linux/pm_runtime.h>
+#include <linux/version.h>
#define BBSWITCH_VERSION "0.8"
@@ -375,6 +376,15 @@ static int bbswitch_pm_handler(struct notifier_block *nbp,
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+static struct proc_ops bbswitch_fops = {
+ .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,
@@ -382,6 +392,7 @@ static struct file_operations bbswitch_fops = {
.llseek = seq_lseek,
.release= single_release
};
+#endif
static struct notifier_block nb = {
.notifier_call = &bbswitch_pm_handler
--
2.28.0