From: YueHaibing <yuehaibing@huawei.com>
To: Yangbo Lu <yangbo.lu@nxp.com>,
Richard Cochran <richardcochran@gmail.com>, <davem@davemloft.net>
Cc: YueHaibing <yuehaibing@huawei.com>, <netdev@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
Subject: [PATCH -next] ptp: fix debugfs_simple_attr.cocci warnings
Date: Fri, 25 Jan 2019 02:28:59 +0000 [thread overview]
Message-ID: <1548383339-159403-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>
---
drivers/ptp/ptp_qoriq_debugfs.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/ptp/ptp_qoriq_debugfs.c b/drivers/ptp/ptp_qoriq_debugfs.c
index d904332..97059502 100644
--- a/drivers/ptp/ptp_qoriq_debugfs.c
+++ b/drivers/ptp/ptp_qoriq_debugfs.c
@@ -33,8 +33,8 @@ static int ptp_qoriq_fiper1_lpbk_set(void *data, u64 val)
return 0;
}
-DEFINE_SIMPLE_ATTRIBUTE(ptp_qoriq_fiper1_fops, ptp_qoriq_fiper1_lpbk_get,
- ptp_qoriq_fiper1_lpbk_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(ptp_qoriq_fiper1_fops, ptp_qoriq_fiper1_lpbk_get,
+ ptp_qoriq_fiper1_lpbk_set, "%llu\n");
static int ptp_qoriq_fiper2_lpbk_get(void *data, u64 *val)
{
@@ -64,8 +64,8 @@ static int ptp_qoriq_fiper2_lpbk_set(void *data, u64 val)
return 0;
}
-DEFINE_SIMPLE_ATTRIBUTE(ptp_qoriq_fiper2_fops, ptp_qoriq_fiper2_lpbk_get,
- ptp_qoriq_fiper2_lpbk_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(ptp_qoriq_fiper2_fops, ptp_qoriq_fiper2_lpbk_get,
+ ptp_qoriq_fiper2_lpbk_set, "%llu\n");
void ptp_qoriq_create_debugfs(struct qoriq_ptp *qoriq_ptp)
{
@@ -79,11 +79,11 @@ void ptp_qoriq_create_debugfs(struct qoriq_ptp *qoriq_ptp)
qoriq_ptp->debugfs_root = root;
- if (!debugfs_create_file("fiper1-loopback", 0600, root, qoriq_ptp,
- &ptp_qoriq_fiper1_fops))
+ if (!debugfs_create_file_unsafe("fiper1-loopback", 0600, root,
+ qoriq_ptp, &ptp_qoriq_fiper1_fops))
goto err_node;
- if (!debugfs_create_file("fiper2-loopback", 0600, root, qoriq_ptp,
- &ptp_qoriq_fiper2_fops))
+ if (!debugfs_create_file_unsafe("fiper2-loopback", 0600, root,
+ qoriq_ptp, &ptp_qoriq_fiper2_fops))
goto err_node;
return;
next reply other threads:[~2019-01-25 2:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 2:28 YueHaibing [this message]
2019-01-25 3:33 ` [PATCH -next] ptp: fix debugfs_simple_attr.cocci warnings Y.b. Lu
2019-01-26 6:05 ` David Miller
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=1548383339-159403-1-git-send-email-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=yangbo.lu@nxp.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