[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0401MB2237D9DD7351E8E8016A7FFAF89B0@VI1PR0401MB2237.eurprd04.prod.outlook.com>
Date: Fri, 25 Jan 2019 03:33:52 +0000
From: "Y.b. Lu" <yangbo.lu@....com>
To: YueHaibing <yuehaibing@...wei.com>,
Richard Cochran <richardcochran@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH -next] ptp: fix debugfs_simple_attr.cocci warnings
> -----Original Message-----
> From: YueHaibing <yuehaibing@...wei.com>
> Sent: Friday, January 25, 2019 10:29 AM
> To: Y.b. Lu <yangbo.lu@....com>; Richard Cochran
> <richardcochran@...il.com>; davem@...emloft.net
> Cc: YueHaibing <yuehaibing@...wei.com>; netdev@...r.kernel.org;
> kernel-janitors@...r.kernel.org
> Subject: [PATCH -next] 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@...wei.com>
[Y.b. Lu] It makes sense to me.
Acked-by: Yangbo Lu <yangbo.lu@....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;
>
>
Powered by blists - more mailing lists