From: YueHaibing <yuehaibing@huawei.com> To: Ralf Baechle <ralf@linux-mips.org>, Paul Burton <paul.burton@mips.com>, James Hogan <jhogan@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: YueHaibing <yuehaibing@huawei.com>, linux-mips@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH -next] MIPS: fix debugfs_simple_attr.cocci warnings Date: Fri, 25 Jan 2019 02:42:17 +0000 [thread overview] Message-ID: <1548384137-171488-1-git-send-email-yuehaibing@huawei.com> (raw) 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/mips/kernel/spinlock_test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c index ab4e3e1..509de1e 100644 --- a/arch/mips/kernel/spinlock_test.c +++ b/arch/mips/kernel/spinlock_test.c @@ -35,7 +35,7 @@ static int ss_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n"); @@ -114,14 +114,14 @@ static int multi_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); static int __init spinlock_test(void) { - debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL, - &fops_ss); - debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL, - &fops_multi); + debugfs_create_file_unsafe("spin_single", 0444, mips_debugfs_dir, + NULL, &fops_ss); + debugfs_create_file_unsafe("spin_multi", 0444, mips_debugfs_dir, + NULL, &fops_multi); return 0; } device_initcall(spinlock_test);
WARNING: multiple messages have this Message-ID (diff)
From: YueHaibing <yuehaibing@huawei.com> To: Ralf Baechle <ralf@linux-mips.org>, Paul Burton <paul.burton@mips.com>, James Hogan <jhogan@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: YueHaibing <yuehaibing@huawei.com>, <linux-mips@vger.kernel.org>, <kernel-janitors@vger.kernel.org> Subject: [PATCH -next] MIPS: fix debugfs_simple_attr.cocci warnings Date: Fri, 25 Jan 2019 02:42:17 +0000 [thread overview] Message-ID: <1548384137-171488-1-git-send-email-yuehaibing@huawei.com> (raw) 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/mips/kernel/spinlock_test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c index ab4e3e1..509de1e 100644 --- a/arch/mips/kernel/spinlock_test.c +++ b/arch/mips/kernel/spinlock_test.c @@ -35,7 +35,7 @@ static int ss_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n"); @@ -114,14 +114,14 @@ static int multi_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); static int __init spinlock_test(void) { - debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL, - &fops_ss); - debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL, - &fops_multi); + debugfs_create_file_unsafe("spin_single", 0444, mips_debugfs_dir, + NULL, &fops_ss); + debugfs_create_file_unsafe("spin_multi", 0444, mips_debugfs_dir, + NULL, &fops_multi); return 0; } device_initcall(spinlock_test);
next reply other threads:[~2019-01-25 2:42 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-25 2:42 YueHaibing [this message] 2019-01-25 2:42 ` [PATCH -next] MIPS: fix debugfs_simple_attr.cocci warnings YueHaibing 2019-01-25 7:11 ` Greg Kroah-Hartman 2019-01-25 7:11 ` Greg Kroah-Hartman 2019-01-25 7:43 ` YueHaibing 2019-01-25 7:43 ` YueHaibing 2019-01-25 7:54 ` Greg Kroah-Hartman 2019-01-25 7:54 ` Greg Kroah-Hartman
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=1548384137-171488-1-git-send-email-yuehaibing@huawei.com \ --to=yuehaibing@huawei.com \ --cc=gregkh@linuxfoundation.org \ --cc=jhogan@kernel.org \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-mips@vger.kernel.org \ --cc=paul.burton@mips.com \ --cc=ralf@linux-mips.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.