linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings
@ 2018-10-05 10:50 YueHaibing
  2018-10-08  8:27 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-10-05 10:50 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	David Hildenbrand, Michael Neuling, Balbir Singh, Rashmica Gupta,
	Andrew Morton, Pavel Tatashin, Stephen Rothwell
  Cc: linuxppc-dev, kernel-janitors, YueHaibing, linux-kernel

Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.

Semantic patch information:
Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 arch/powerpc/platforms/powernv/memtrace.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 84d038e..0cb6548 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -311,8 +311,8 @@ static int memtrace_enable_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get,
-					memtrace_enable_set, "0x%016llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get,
+			 memtrace_enable_set, "0x%016llx\n");
 
 static int memtrace_init(void)
 {
@@ -321,8 +321,8 @@ static int memtrace_init(void)
 	if (!memtrace_debugfs_dir)
 		return -1;
 
-	debugfs_create_file("enable", 0600, memtrace_debugfs_dir,
-			    NULL, &memtrace_init_fops);
+	debugfs_create_file_unsafe("enable", 0600, memtrace_debugfs_dir, NULL,
+				   &memtrace_init_fops);
 
 	return 0;
 }




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

* Re: [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings
  2018-10-05 10:50 [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings YueHaibing
@ 2018-10-08  8:27 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2018-10-08  8:27 UTC (permalink / raw)
  To: YueHaibing, Benjamin Herrenschmidt, Paul Mackerras,
	David Hildenbrand, Michael Neuling, Balbir Singh, Rashmica Gupta,
	Andrew Morton, Pavel Tatashin, Stephen Rothwell
  Cc: linuxppc-dev, kernel-janitors, YueHaibing, linux-kernel

YueHaibing <yuehaibing@huawei.com> writes:
> Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
> for debugfs files.
>
> Semantic patch information:
> Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
> imposes some significant overhead as compared to
> DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Sorry this isn't detailed enough for me to actually understand the
pros/cons of this patch.

Perhaps I'm expected to know it, but I don't.

I had a look at what each macro produces and it wasn't obvious to me
what the benefit is.

cheers

> Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  arch/powerpc/platforms/powernv/memtrace.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 84d038e..0cb6548 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -311,8 +311,8 @@ static int memtrace_enable_get(void *data, u64 *val)
>  	return 0;
>  }
>  
> -DEFINE_SIMPLE_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get,
> -					memtrace_enable_set, "0x%016llx\n");
> +DEFINE_DEBUGFS_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get,
> +			 memtrace_enable_set, "0x%016llx\n");
>  
>  static int memtrace_init(void)
>  {
> @@ -321,8 +321,8 @@ static int memtrace_init(void)
>  	if (!memtrace_debugfs_dir)
>  		return -1;
>  
> -	debugfs_create_file("enable", 0600, memtrace_debugfs_dir,
> -			    NULL, &memtrace_init_fops);
> +	debugfs_create_file_unsafe("enable", 0600, memtrace_debugfs_dir, NULL,
> +				   &memtrace_init_fops);
>  
>  	return 0;
>  }

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

end of thread, other threads:[~2018-10-08  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05 10:50 [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings YueHaibing
2018-10-08  8:27 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).