diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2020-11-08 17:13:06 +0100 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2020-12-05 21:24:57 +0100 |
commit | 433f51a0ce14ad0b4f6b2c0897f5cc8c7f7709ed (patch) | |
tree | 63b0897c31bfecee62f68222c7f486349a2f69c6 | |
parent | 6e8afd0110a04c99c1c5ae6e623e5a7b97815b6f (diff) | |
download | backports-433f51a0ce14ad0b4f6b2c0897f5cc8c7f7709ed.tar.gz |
headers: Add DEFINE_SEQ_ATTRIBUTE
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 <hauke@hauke-m.de>
-rw-r--r-- | backport/backport-include/linux/seq_file.h | 21 |
1 files changed, 21 insertions, 0 deletions
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 */ |