diff options
author | wuchi <wuchi.zero@gmail.com> | 2022-06-12 07:20:15 +0200 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-06-17 04:58:23 +0200 |
commit | 00c9d5632277b21ba8802e26c27254cd9d0dfa13 (patch) | |
tree | c894529981ac08390daa22e017502ddfd2da9431 /lib/error-inject.c | |
parent | checkpatch: fix incorrect camelcase detection on numeric constant (diff) | |
download | linux-00c9d5632277b21ba8802e26c27254cd9d0dfa13.tar.xz linux-00c9d5632277b21ba8802e26c27254cd9d0dfa13.zip |
lib/error-inject: convert to DEFINE_SEQ_ATTRIBUTE
Use DEFINE_SEQ_ATTRIBUTE helper macro to simplify the code.
Link: https://lkml.kernel.org/r/20220612052015.23283-1-wuchi.zero@gmail.com
Signed-off-by: wuchi <wuchi.zero@gmail.com>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/error-inject.c')
-rw-r--r-- | lib/error-inject.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/error-inject.c b/lib/error-inject.c index 2ff5ef689d72..4a4f1278c419 100644 --- a/lib/error-inject.c +++ b/lib/error-inject.c @@ -197,24 +197,14 @@ static int ei_seq_show(struct seq_file *m, void *v) return 0; } -static const struct seq_operations ei_seq_ops = { +static const struct seq_operations ei_sops = { .start = ei_seq_start, .next = ei_seq_next, .stop = ei_seq_stop, .show = ei_seq_show, }; -static int ei_open(struct inode *inode, struct file *filp) -{ - return seq_open(filp, &ei_seq_ops); -} - -static const struct file_operations debugfs_ei_ops = { - .open = ei_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; +DEFINE_SEQ_ATTRIBUTE(ei); static int __init ei_debugfs_init(void) { @@ -224,7 +214,7 @@ static int __init ei_debugfs_init(void) if (!dir) return -ENOMEM; - file = debugfs_create_file("list", 0444, dir, NULL, &debugfs_ei_ops); + file = debugfs_create_file("list", 0444, dir, NULL, &ei_fops); if (!file) { debugfs_remove(dir); return -ENOMEM; |