debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE
Subsystems (2)
PATCH 1/1 debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
--- lib/debugobjects.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
lib/debugobjects.c +1 -11
@@ -1023,17 +1023,7 @@ static int debug_stats_show(struct seq_file *m, void *v)return 0 ; } -static int debug_stats_open (struct inode *inode,struct file *filp) -{ -return single_open (filp, debug_stats_show,NULL ); -} - -static const struct file_operations debug_stats_fops = { - .open = debug_stats_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (debug_stats);static int __init debug_objects_init_debugfs (void ) {
Signature · 1 line
2.17.1
Quoted 13 lines · Qinglang Miao
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Qinglang Miao <[email protected]>--- lib/debugobjects.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)lib/debugobjects.c +0
-0@@ -1023,17 +1023,7 @@ static int debug_stats_show(struct seq_file *m, void *v)return 0 ;
lib/debugobjects.c static int debug_stats_show(struct seq_file *m, void *v) · line 1033
Quoted 10 lines
lib/debugobjects.c +0
-8} -static int debug_stats_open (struct inode *inode,struct file *filp) -{ -return single_open (filp, debug_stats_show,NULL ); -} - -static const struct file_operations debug_stats_fops = { - .open = debug_stats_open, - .read_iter = seq_read_iter,
This does not apply against mainline, so I assume this malformatted thing comes from Christophs seq_read_iter changes in -next.
The seq_read_iter here makes no sense whatsoever if the same thing can be achieved by using
lib/debugobjects.c static int debug_stats_show(struct seq_file *m, void *v) · line 1026
Quoted 1 line
lib/debugobjects.c +1
-0+DEFINE_SHOW_ATTRIBUTE (debug_stats);
and fixing it at the generic level.
Thanks,
tglx
Quoted 31 lines · Thomas Gleixner
Quoted 13 lines · Qinglang Miao
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Qinglang Miao <[email protected]>--- lib/debugobjects.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)lib/debugobjects.c +0
-0@@ -1023,17 +1023,7 @@ static int debug_stats_show(struct seq_file *m, void *v)return 0 ;lib/debugobjects.c static int debug_stats_show(struct seq_file *m, void *v) · line 1033
Quoted 10 lines
lib/debugobjects.c +0
-8} -static int debug_stats_open (struct inode *inode,struct file *filp) -{ -return single_open (filp, debug_stats_show,NULL ); -} - -static const struct file_operations debug_stats_fops = { - .open = debug_stats_open, - .read_iter = seq_read_iter,This does not apply against mainline, so I assume this malformatted thing comes from Christophs
seq_read_iterchanges in -next.The
seq_read_iterhere makes no sense whatsoever if the same thing can be achieved by using
Quoted 9 lines
lib/debugobjects.c static int debug_stats_show(struct seq_file *m, void *v) · line 1026
Quoted 1 line
lib/debugobjects.c +1
-0+DEFINE_SHOW_ATTRIBUTE (debug_stats);and fixing it at the generic level.
Thanks,
tglx
.
Because the swicth from seq_read to seq_read_iter would rather be implemented in macro or coccinelle script as you mentioned in another mail, I can send a new patch against mainline instead if you don't mind.
Thanks.
Qinglang
.
The following commit has been merged into the core/debugobjects branch of tip:
The following commit has been merged into the core/debugobjects branch of tip:
Commit-ID: 0f85c4805184765ff35e0079b3241ee8f25d1b2b Gitweb: https://git.kernel.org/tip/0f85c4805184765ff35e0079b3241ee8f25d1b2b Author: Qinglang Miao <[email protected]> AuthorDate: Thu, 16 Jul 2020 16:47:47 +08:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 17 Jul 2020 23:25:46 +02:00
debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
[ tglx: Distangled it from the mess in -next ]
--- lib/debugobjects.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
lib/debugobjects.c +1 -12
@@ -1022,18 +1022,7 @@ static int debug_stats_show(struct seq_file *m, void *v)seq_printf (m,"objs_freed :%d\n" , debug_objects_freed);return 0 ; } - -static int debug_stats_open (struct inode *inode,struct file *filp) -{ -return single_open (filp, debug_stats_show,NULL ); -} - -static const struct file_operations debug_stats_fops = { - .open = debug_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (debug_stats);static int __init debug_objects_init_debugfs (void ) {