[PATCH 2/7] backports: Add DEFINE_SHOW_ATTRIBUTE macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This was introduced in Linux commit a08f06bb7a07 ("seq_file: Introduce
DEFINE_SHOW_ATTRIBUTE() helper macro" and is used by the cw1200 and the
wil6210 driver.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/seq_file.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/backport/backport-include/linux/seq_file.h b/backport/backport-include/linux/seq_file.h
index ad1bded5..5b88f6f8 100644
--- a/backport/backport-include/linux/seq_file.h
+++ b/backport/backport-include/linux/seq_file.h
@@ -48,4 +48,20 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
 		  bool ascii);
 #endif
 
+#ifndef DEFINE_SHOW_ATTRIBUTE
+#define DEFINE_SHOW_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,					\
+	.llseek		= seq_lseek,					\
+	.release	= single_release,				\
+}
+#endif /* DEFINE_SHOW_ATTRIBUTE */
+
 #endif /* __BACKPORT_SEQ_FILE_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux