[PATCH 25/30] headers: Add DEFINE_SEQ_ATTRIBUTE
Hauke Mehrtens <[email protected]>
| Newsgroups | org.kernel.vger.backports |
|---|---|
| Message-ID | <[email protected]> |
Add the DEFINE_SEQ_ATTRIBUTE which was added in commit d2c0e6e91c79
("include/linux/seq_file.h: introduce DEFINE_SEQ_ATTRIBUTE() helper
macro") in kernel 5.8. This is used by ath5k.
Signed-off-by: Hauke Mehrtens <[email protected]>
---
backport/backport-include/linux/seq_file.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/backport/backport-include/linux/seq_file.h b/backport/backport-include/linux/seq_file.h
index 5b88f6f8..1d78bbbd 100644
--- a/backport/backport-include/linux/seq_file.h
+++ b/backport/backport-include/linux/seq_file.h
@@ -64,4 +64,25 @@ static const struct file_operations __name ## _fops = { \
}
#endif /* DEFINE_SHOW_ATTRIBUTE */
+#ifndef DEFINE_SEQ_ATTRIBUTE
+#define DEFINE_SEQ_ATTRIBUTE(__name) \
+static int __name ## _open(struct inode *inode, struct file *file) \
+{ \
+ int ret = seq_open(file, &__name ## _sops); \
+ if (!ret && inode->i_private) { \
+ struct seq_file *seq_f = file->private_data; \
+ seq_f->private = inode->i_private; \
+ } \
+ return ret; \
+} \
+ \
+static const struct file_operations __name ## _fops = { \
+ .owner = THIS_MODULE, \
+ .open = __name ## _open, \
+ .read = seq_read, \
+ .llseek = seq_lseek, \
+ .release = seq_release, \
+}
+#endif /* DEFINE_SEQ_ATTRIBUTE */
+
#endif /* __BACKPORT_SEQ_FILE_H */
--
2.20.1
--
To unsubscribe from this list: send the line "unsubscribe backports" in