Skip to contentSkip to conversation

seq_file-add-helper-macro-to-define-attribute-for-rw-file.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Oct 4, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: seq_file: add helper macro to define attribute for rw file
has been removed from the -mm tree. Its filename was
seq_file-add-helper-macro-to-define-attribute-for-rw-file.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Xingui Yang <[email protected]>
Subject: seq_file: add helper macro to define attribute for rw file
Date: Tue, 5 Sep 2023 02:48:33 +0000

Patch series "Add helper macro DEFINE_SHOW_STORE_ATTRIBUTE() at seq_file.c", v6.

We already own DEFINE_SHOW_ATTRIBUTE() helper macro for defining attribute for read-only file, but we found many of drivers also want a helper macro for read-write file too.

So we add this helper macro to reduce duplicated code.

This patch (of 3):

We already own DEFINE_SHOW_ATTRIBUTE() helper macro for defining attribute for read-only file, but many of drivers want a helper macro for read-write file too.

So we add DEFINE_SHOW_STORE_ATTRIBUTE() helper to reduce duplicated code.

---

 include/linux/seq_file.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
include/linux/seq_file.h renamed from include/linux/seq_file.h~seq_file-add-helper-macro-to-define-attribute-for-rw-file +15 -0
@@ -207,6 +207,21 @@ static const struct file_operations __na
 	.release	= single_release,				\
 }
 
+#define DEFINE_SHOW_STORE_ATTRIBUTE(__name)				\
+static int __name ## _open(struct inode *inode, struct file *file)	\
+{									\
+	return single_open(file, __name ## _show, inode->i_private);	\
+}									\
+									\
+static const struct file_operations __name ## _fops = {			\
+	.owner		= THIS_MODULE,					\
+	.open		= __name ## _open,				\
+	.read		= seq_read,					\
+	.write		= __name ## _write,				\
+	.llseek		= seq_lseek,					\
+	.release	= single_release,				\
+}
+
 #define DEFINE_PROC_SHOW_ATTRIBUTE(__name)				\
 static int __name ## _open(struct inode *inode, struct file *file)	\
 {									\

_

Patches currently in -mm which might be from [email protected] are