gpu: host1x: debug: Convert to DEFINE_SHOW_ATTRIBUTE
PATCH v2 1/1 gpu: host1x: debug: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by Qinglang Miao <[email protected]>
---
v2: based on linux-next(20200917), and can be applied to
mainline cleanly now.
drivers/gpu/host1x/debug.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-)
drivers/gpu/host1x/debug.c +4 -24
@@ -114,7 +114,7 @@ static void show_all(struct host1x *m, struct output *o, bool show_fifo) } } -static int host1x_debug_show_all (struct seq_file *s,void *unused) +static int host1x_debug_all_show (struct seq_file *s,void *unused) {struct output o = { .fn = write_to_seqfile,
@@ -126,6 +126,8 @@ static int host1x_debug_show_all(struct seq_file *s, void *unused)return 0 ; } +DEFINE_SHOW_ATTRIBUTE (host1x_debug_all); +static int host1x_debug_show (struct seq_file *s,void *unused) {struct output o = {
@@ -138,29 +140,7 @@ static int host1x_debug_show(struct seq_file *s, void *unused)return 0 ; } -static int host1x_debug_open_all (struct inode *inode,struct file *file) -{ -return single_open (file, host1x_debug_show_all, inode->i_private); -} - -static const struct file_operations host1x_debug_all_fops = { - .open = host1x_debug_open_all, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static int host1x_debug_open (struct inode *inode,struct file *file) -{ -return single_open (file, host1x_debug_show, inode->i_private); -} - -static const struct file_operations host1x_debug_fops = { - .open = host1x_debug_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (host1x_debug);static void host1x_debugfs_init (struct host1x *host1x) {
Signature · 1 line
2.23.0