[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMGffEmuxMei55xeuHvt+Z06gbbHhfDt+-9hmtE5zS_9OViYXQ@mail.gmail.com>
Date: Tue, 16 Jan 2024 06:52:14 +0100
From: Jinpu Wang <jinpu.wang@...os.com>
To: Li Zhijian <lizhijian@...itsu.com>
Cc: linux-kernel@...r.kernel.org, Jack Wang <jinpu.wang@...ud.ionos.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>, "Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org
Subject: Re: [PATCH 34/42] drivers/scsi/pm8001: Convert snprintf to sysfs_emit
On Tue, Jan 16, 2024 at 5:52 AM 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/scsi/pm8001/pm8001_ctl.c:883:8-16: WARNING: please use sysfs_emit
>
> No functional change intended
>
> CC: Jack Wang <jinpu.wang@...ud.ionos.com>
> CC: "James E.J. Bottomley" <jejb@...ux.ibm.com>
> CC: "Martin K. Petersen" <martin.petersen@...cle.com>
> CC: linux-scsi@...r.kernel.org
> Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
Acked-by: Jack Wang <jinpu.wang@...os.com>
> ---
> drivers/scsi/pm8001/pm8001_ctl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
> index 5c26a13ffbd2..7b27618fd7b2 100644
> --- a/drivers/scsi/pm8001/pm8001_ctl.c
> +++ b/drivers/scsi/pm8001/pm8001_ctl.c
> @@ -880,9 +880,9 @@ static ssize_t pm8001_show_update_fw(struct device *cdev,
> if (pm8001_ha->fw_status != FLASH_IN_PROGRESS)
> pm8001_ha->fw_status = FLASH_OK;
>
> - return snprintf(buf, PAGE_SIZE, "status=%x %s\n",
> - flash_error_table[i].err_code,
> - flash_error_table[i].reason);
> + return sysfs_emit(buf, "status=%x %s\n",
> + flash_error_table[i].err_code,
> + flash_error_table[i].reason);
> }
> static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP,
> pm8001_show_update_fw, pm8001_store_update_fw);
> --
> 2.29.2
>
Powered by blists - more mailing lists