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
d56c0d45f0
This commit is contained in:
parent
9dd227019a
commit
b0fdcfd847
11
bbswitch.c
11
bbswitch.c
@ -35,6 +35,7 @@
|
|||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
#define BBSWITCH_VERSION "0.8"
|
#define BBSWITCH_VERSION "0.8"
|
||||||
|
|
||||||
@ -375,6 +376,15 @@ static int bbswitch_pm_handler(struct notifier_block *nbp,
|
|||||||
return 0;
|
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 = {
|
static struct file_operations bbswitch_fops = {
|
||||||
.open = bbswitch_proc_open,
|
.open = bbswitch_proc_open,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
@ -382,6 +392,7 @@ static struct file_operations bbswitch_fops = {
|
|||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release= single_release
|
.release= single_release
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct notifier_block nb = {
|
static struct notifier_block nb = {
|
||||||
.notifier_call = &bbswitch_pm_handler
|
.notifier_call = &bbswitch_pm_handler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user