[PATCH -next] fsi: master-ast-cf: change snprintf() to sysfs_emit()

Eddie James eajames at linux.ibm.com
Thu Sep 5 07:53:48 AEST 2024


On 9/3/24 20:36, Hongbo Li wrote:
> As Documentation/filesystems/sysfs.rst suggested, show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting
> the value to be returned to user space.


Thank you.

Reviewed-by: Eddie James <eajames at linux.ibm.com>


>
> Signed-off-by: Hongbo Li <lihongbo22 at huawei.com>
> ---
>   drivers/fsi/fsi-master-ast-cf.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c
> index a4c37ff8edd6..5486ba39051b 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,


More information about the linux-fsi mailing list