From: Michael Ellerman <mpe@ellerman.id.au>
To: YueHaibing <yuehaibing@huawei.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
David Hildenbrand <david@redhat.com>,
Michael Neuling <mikey@neuling.org>,
Balbir Singh <bsingharora@gmail.com>,
Rashmica Gupta <rashmica.g@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Pavel Tatashin <pavel.tatashin@microsoft.com>,
Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org,
YueHaibing <yuehaibing@huawei.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings
Date: Mon, 08 Oct 2018 19:27:17 +1100 [thread overview]
Message-ID: <87va6c268q.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <1538736631-99728-1-git-send-email-yuehaibing@huawei.com>
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;
> }
prev parent reply other threads:[~2018-10-08 8:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-05 10:50 [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings YueHaibing
2018-10-08 8:27 ` Michael Ellerman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87va6c268q.fsf@concordia.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=bsingharora@gmail.com \
--cc=david@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=paulus@samba.org \
--cc=pavel.tatashin@microsoft.com \
--cc=rashmica.g@gmail.com \
--cc=sfr@canb.auug.org.au \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox