From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "yang.yang29@zte.com.cn" <yang.yang29@zte.com.cn>,
"tyreld@linux.ibm.com" <tyreld@linux.ibm.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"npiggin@gmail.com" <npiggin@gmail.com>,
"xu.panda@zte.com.cn" <xu.panda@zte.com.cn>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH linux-next] scsi: ibmvfc: use sysfs_emit() to instead of scnprintf()
Date: Thu, 10 Nov 2022 12:36:36 +0000 [thread overview]
Message-ID: <9717a9dd-45da-0d48-71a2-d2f64df8c7fc@csgroup.eu> (raw)
In-Reply-To: <202211102034017058666@zte.com.cn>
Le 10/11/2022 à 13:34, yang.yang29@zte.com.cn a écrit :
> [Vous ne recevez pas souvent de courriers de yang.yang29@zte.com.cn. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Xu Panda <xu.panda@zte.com.cn>
>
> Replace the open-code with sysfs_emit() to simplify the code.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
> Signed-off-by: Yang Yang <yang.yang29@zte.com>
> ---
> drivers/scsi/ibmvscsi/ibmvfc.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
> index 1a0c0b7289d2..c412752ea140 100644
> --- a/drivers/scsi/ibmvscsi/ibmvfc.c
> +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
> @@ -3411,7 +3411,7 @@ static ssize_t ibmvfc_show_host_partition_name(struct device *dev,
> struct Scsi_Host *shost = class_to_shost(dev);
> struct ibmvfc_host *vhost = shost_priv(shost);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n",
> + return sysfs_emit(buf, "%s\n",
> vhost->login_buf->resp.partition_name);
Could it fit on a single line now ?
> }
>
> @@ -3421,7 +3421,7 @@ static ssize_t ibmvfc_show_host_device_name(struct device *dev,
> struct Scsi_Host *shost = class_to_shost(dev);
> struct ibmvfc_host *vhost = shost_priv(shost);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n",
> + return sysfs_emit(buf, "%s\n",
> vhost->login_buf->resp.device_name);
Could it fit on a single line now ?
> }
>
> @@ -3431,7 +3431,7 @@ static ssize_t ibmvfc_show_host_loc_code(struct device *dev,
> struct Scsi_Host *shost = class_to_shost(dev);
> struct ibmvfc_host *vhost = shost_priv(shost);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n",
> + return sysfs_emit(buf, "%s\n",
> vhost->login_buf->resp.port_loc_code);
Could it fit on a single line now ?
> }
>
> @@ -3441,7 +3441,7 @@ static ssize_t ibmvfc_show_host_drc_name(struct device *dev,
> struct Scsi_Host *shost = class_to_shost(dev);
> struct ibmvfc_host *vhost = shost_priv(shost);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n",
> + return sysfs_emit(buf, "%s\n",
> vhost->login_buf->resp.drc_name);
Could it fit on a single line now ?
> }
>
> @@ -3450,7 +3450,7 @@ static ssize_t ibmvfc_show_host_npiv_version(struct device *dev,
> {
> struct Scsi_Host *shost = class_to_shost(dev);
> struct ibmvfc_host *vhost = shost_priv(shost);
> - return snprintf(buf, PAGE_SIZE, "%d\n", be32_to_cpu(vhost->login_buf->resp.version));
> + return sysfs_emit(buf, "%d\n", be32_to_cpu(vhost->login_buf->resp.version));
> }
>
> static ssize_t ibmvfc_show_host_capabilities(struct device *dev,
> @@ -3458,7 +3458,7 @@ static ssize_t ibmvfc_show_host_capabilities(struct device *dev,
> {
> struct Scsi_Host *shost = class_to_shost(dev);
> struct ibmvfc_host *vhost = shost_priv(shost);
> - return snprintf(buf, PAGE_SIZE, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities));
> + return sysfs_emit(buf, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities));
> }
>
> /**
> @@ -3479,7 +3479,7 @@ static ssize_t ibmvfc_show_log_level(struct device *dev,
> int len;
>
> spin_lock_irqsave(shost->host_lock, flags);
> - len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->log_level);
> + len = sysfs_emit(buf, "%d\n", vhost->log_level);
> spin_unlock_irqrestore(shost->host_lock, flags);
> return len;
> }
> @@ -3517,7 +3517,7 @@ static ssize_t ibmvfc_show_scsi_channels(struct device *dev,
> int len;
>
> spin_lock_irqsave(shost->host_lock, flags);
> - len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->client_scsi_channels);
> + len = sysfs_emit(buf, "%d\n", vhost->client_scsi_channels);
> spin_unlock_irqrestore(shost->host_lock, flags);
> return len;
> }
> --
> 2.15.2
prev parent reply other threads:[~2022-11-10 12:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 12:34 [PATCH linux-next] scsi: ibmvfc: use sysfs_emit() to instead of scnprintf() yang.yang29
2022-11-10 12:36 ` Christophe Leroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9717a9dd-45da-0d48-71a2-d2f64df8c7fc@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.petersen@oracle.com \
--cc=npiggin@gmail.com \
--cc=tyreld@linux.ibm.com \
--cc=xu.panda@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).