From 75a3d2f7d183ba0dd9edc29002f4f85591fb3e15 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 26 Jan 2019 17:15:35 +0100 Subject: 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 --- 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 */ -- cgit v1.2.3