summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2019-01-26 17:15:35 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2019-01-26 20:54:37 +0100
commit75a3d2f7d183ba0dd9edc29002f4f85591fb3e15 (patch)
tree4283beeb91fb871bfcbabef33d119f9e6bd58621
parent221755b9531d8b3395058a7a6f8a4e3b49783561 (diff)
backports: Add DEFINE_SHOW_ATTRIBUTE macro
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@hauke-m.de>
-rw-r--r--backport/backport-include/linux/seq_file.h16
1 files changed, 16 insertions, 0 deletions
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 */