From 76d06390a9adf3ae70aaa87e9243c42d848975a4 Mon Sep 17 00:00:00 2001 From: Huaxin Lu Date: Mon, 18 Sep 2023 20:19:05 +0800 Subject: [PATCH] Add the owner of file operations Fix the concurrent issues with removing module and accessing interfaces. --- src/common/dim_entry.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/dim_entry.h b/src/common/dim_entry.h index 17e6420..acfc3a0 100644 --- a/src/common/dim_entry.h +++ b/src/common/dim_entry.h @@ -49,6 +49,7 @@ static ssize_t sname##_trigger(struct file *file, \ } \ \ static const struct file_operations sname##_ops = { \ + .owner = THIS_MODULE, \ .write = sname##_trigger, \ .llseek = generic_file_llseek, \ }; \ @@ -99,6 +100,7 @@ static int sname##_open(struct inode *inode, struct file *file) \ } \ \ static const struct file_operations sname##_ops = { \ + .owner = THIS_MODULE, \ .open = sname##_open, \ .read = seq_read, \ .llseek = seq_lseek, \ @@ -129,6 +131,7 @@ static ssize_t sname##_read(struct file *file, \ } \ \ static const struct file_operations sname##_ops = { \ + .owner = THIS_MODULE, \ .read = sname##_read, \ .llseek = generic_file_llseek, \ }; \ @@ -173,6 +176,7 @@ static ssize_t sname##_write(struct file *file, \ } \ \ static const struct file_operations sname##_ops = { \ + .owner = THIS_MODULE, \ .read = sname##_read, \ .write = sname##_write, \ .llseek = generic_file_llseek, \ -- 2.27.0