All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2020-07-16  8:47 Qinglang Miao
  2020-07-17 20:26 ` Thomas Gleixner
  2020-07-17 21:29 ` [tip: core/debugobjects] " tip-bot2 for Qinglang Miao
  0 siblings, 2 replies; 4+ messages in thread
From: Qinglang Miao @ 2020-07-16  8:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thomas Gleixner, Marco Elver, Qian Cai; +Cc: linux-kernel

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 lib/debugobjects.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 5d2bbfc55..916a5c492 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -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)
 {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-07-16  8:47 [PATCH -next] debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
@ 2020-07-17 20:26 ` Thomas Gleixner
  2020-07-20  2:18   ` miaoqinglang
  2020-07-17 21:29 ` [tip: core/debugobjects] " tip-bot2 for Qinglang Miao
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2020-07-17 20:26 UTC (permalink / raw)
  To: Qinglang Miao, Greg Kroah-Hartman, Marco Elver, Qian Cai
  Cc: linux-kernel, Christoph Hellwig

Qinglang Miao <miaoqinglang@huawei.com> writes:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>  lib/debugobjects.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
> index 5d2bbfc55..916a5c492 100644
> --- a/lib/debugobjects.c
> +++ b/lib/debugobjects.c
> @@ -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,

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

> +DEFINE_SHOW_ATTRIBUTE(debug_stats);

and fixing it at the generic level.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: core/debugobjects] debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-07-16  8:47 [PATCH -next] debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
  2020-07-17 20:26 ` Thomas Gleixner
@ 2020-07-17 21:29 ` tip-bot2 for Qinglang Miao
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Qinglang Miao @ 2020-07-17 21:29 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Qinglang Miao, Thomas Gleixner, hch, x86, LKML

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 <miaoqinglang@huawei.com>
AuthorDate:    Thu, 16 Jul 2020 16:47:47 +08:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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 ]

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: hch@lst.de
Link: https://lkml.kernel.org/r/20200716084747.8034-1-miaoqinglang@huawei.com

---
 lib/debugobjects.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 48054db..fe45579 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -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)
 {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-07-17 20:26 ` Thomas Gleixner
@ 2020-07-20  2:18   ` miaoqinglang
  0 siblings, 0 replies; 4+ messages in thread
From: miaoqinglang @ 2020-07-20  2:18 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Greg Kroah-Hartman, Marco Elver, Qian Cai, linux-kernel,
	Christoph Hellwig



在 2020/7/18 4:26, Thomas Gleixner 写道:
> Qinglang Miao <miaoqinglang@huawei.com> writes:
>> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>>
>> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
>> ---
>>   lib/debugobjects.c | 12 +-----------
>>   1 file changed, 1 insertion(+), 11 deletions(-)
>>
>> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
>> index 5d2bbfc55..916a5c492 100644
>> --- a/lib/debugobjects.c
>> +++ b/lib/debugobjects.c
>> @@ -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,
> 
> 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
> 
>> +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

.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-20  2:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  8:47 [PATCH -next] debugobjects: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-07-17 20:26 ` Thomas Gleixner
2020-07-20  2:18   ` miaoqinglang
2020-07-17 21:29 ` [tip: core/debugobjects] " tip-bot2 for Qinglang Miao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.