[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9f10bb00-170f-4647-9c7d-8033dae2a4c7@linux.ibm.com>
Date: Wed, 17 Jan 2024 08:19:21 -0600
From: Eddie James <eajames@...ux.ibm.com>
To: Li Zhijian <lizhijian@...itsu.com>, linux-kernel@...r.kernel.org
Cc: Jeremy Kerr <jk@...abs.org>, Joel Stanley <joel@....id.au>,
Alistar Popple <alistair@...ple.id.au>, linux-fsi@...ts.ozlabs.org
Subject: Re: [PATCH 08/42] drivers/fsi: Convert snprintf to sysfs_emit
On 1/15/24 22:51, Li Zhijian 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/fsi/fsi-master-ast-cf.c:1086:8-16: WARNING: please use sysfs_emit
>> ./drivers/fsi/fsi-master-gpio.c:721:8-16: WARNING: please use sysfs_emit
> No functional change intended
Thanks!
Reviewed-by: Eddie James <eajames@...ux.ibm.com>
>
> CC: Jeremy Kerr <jk@...abs.org>
> CC: Joel Stanley <joel@....id.au>
> CC: Alistar Popple <alistair@...ple.id.au>
> CC: Eddie James <eajames@...ux.ibm.com>
> CC: linux-fsi@...ts.ozlabs.org
> Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
> ---
> drivers/fsi/fsi-master-ast-cf.c | 3 +--
> drivers/fsi/fsi-master-gpio.c | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c
> index 812dfa9a9140..5740b2d9dace 100644
> --- a/drivers/fsi/fsi-master-ast-cf.c
> +++ b/drivers/fsi/fsi-master-ast-cf.c
> @@ -1083,8 +1083,7 @@ static ssize_t external_mode_show(struct device *dev,
> {
> struct fsi_master_acf *master = dev_get_drvdata(dev);
>
> - return snprintf(buf, PAGE_SIZE - 1, "%u\n",
> - master->external_mode ? 1 : 0);
> + return sysfs_emit(buf, "%u\n", master->external_mode ? 1 : 0);
> }
>
> static ssize_t external_mode_store(struct device *dev,
> diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
> index ed03da4f2447..286fe1cddf99 100644
> --- a/drivers/fsi/fsi-master-gpio.c
> +++ b/drivers/fsi/fsi-master-gpio.c
> @@ -718,8 +718,7 @@ static ssize_t external_mode_show(struct device *dev,
> {
> struct fsi_master_gpio *master = dev_get_drvdata(dev);
>
> - return snprintf(buf, PAGE_SIZE - 1, "%u\n",
> - master->external_mode ? 1 : 0);
> + return sysfs_emit(buf, "%u\n", master->external_mode ? 1 : 0);
> }
>
> static ssize_t external_mode_store(struct device *dev,
Powered by blists - more mailing lists