[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <875xztzx3e.fsf@nvidia.com>
Date: Mon, 15 Jan 2024 21:01:22 -0800
From: Rahul Rameshbabu <rrameshbabu@...dia.com>
To: Li Zhijian <lizhijian@...itsu.com>
Cc: linux-kernel@...r.kernel.org, Richard Cochran
<richardcochran@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH 15/42] drivers/ptp: Convert snprintf to sysfs_emit
On Tue, 16 Jan, 2024 12:51:24 +0800 Li Zhijian <lizhijian@...itsu.com> wrote:
> Per filesystems/sysfs.rst, show() should only use sysfs_emit()
> or sysfs_emit_at() when formatting the value to be returned to user space.
>
> coccinelle complains that there are still a couple of functions that use
> snprintf(). Convert them to sysfs_emit().
>
>> ./drivers/ptp/ptp_sysfs.c:27:8-16: WARNING: please use sysfs_emit
>
> No functional change intended
>
> CC: Richard Cochran <richardcochran@...il.com>
> CC: netdev@...r.kernel.org
> Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
> ---
> drivers/ptp/ptp_sysfs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
> index f7a499a1bd39..49737ed6ef5f 100644
> --- a/drivers/ptp/ptp_sysfs.c
> +++ b/drivers/ptp/ptp_sysfs.c
> @@ -24,8 +24,7 @@ static ssize_t max_phase_adjustment_show(struct device *dev,
> {
> struct ptp_clock *ptp = dev_get_drvdata(dev);
>
> - return snprintf(page, PAGE_SIZE - 1, "%d\n",
> - ptp->info->getmaxphase(ptp->info));
> + return sysfs_emit(page, "%d\n", ptp->info->getmaxphase(ptp->info));
> }
> static DEVICE_ATTR_RO(max_phase_adjustment);
I authored the lines that are being changed here, so figured I should
provide my review. Doesn't PTP_SHOW_INT in the same file also use
snprintf in the same manner and should be changed to sysfs_emit?
--
Thanks,
Rahul Rameshbabu
Powered by blists - more mailing lists