ptp: fix debugfs_simple_attr.cocci warnings

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>
Acked-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
YueHaibing 2019-01-25 02:28:59 +00:00 committed by David S. Miller
parent f515220cc2
commit 84239b4459
1 changed files with 8 additions and 8 deletions

View File

@ -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;