mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: libsas: Use str_plural() in _sas_resume_ha()
@ 2024-06-18  7:44 Jiapeng Chong
  2024-06-18  9:33 ` John Garry
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2024-06-18  7:44 UTC (permalink / raw)
  To: john.g.garry
  Cc: yanaijie, James.Bottomley, martin.petersen, linux-scsi,
	linux-kernel, Jiapeng Chong, Abaci Robot

Use existing str_plural() function rather than duplicating its
implementation.

./drivers/scsi/libsas/sas_init.c:426:7-8: opportunity for str_plural(i).

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9351
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/scsi/libsas/sas_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index 9c8cc723170d..67017c03d4da 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -422,8 +422,8 @@ static void _sas_resume_ha(struct sas_ha_struct *ha, bool drain)
 	 */
 	i = phys_suspended(ha);
 	if (i)
-		dev_info(ha->dev, "waiting up to 25 seconds for %d phy%s to resume\n",
-			 i, i > 1 ? "s" : "");
+		dev_info(ha->dev, "waiting up to 25 seconds for %d phy%s to resume\n", i,
+			 str_plural(i));
 	wait_event_timeout(ha->eh_wait_q, phys_suspended(ha) == 0, tmo);
 	for (i = 0; i < ha->num_phys; i++) {
 		struct asd_sas_phy *phy = ha->sas_phy[i];
-- 
2.20.1.7.g153144c


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: libsas: Use str_plural() in _sas_resume_ha()
  2024-06-18  7:44 [PATCH] scsi: libsas: Use str_plural() in _sas_resume_ha() Jiapeng Chong
@ 2024-06-18  9:33 ` John Garry
  0 siblings, 0 replies; 2+ messages in thread
From: John Garry @ 2024-06-18  9:33 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: yanaijie, James.Bottomley, martin.petersen, linux-scsi,
	linux-kernel, Abaci Robot

On 18/06/2024 08:44, Jiapeng Chong wrote:
> Use existing str_plural() function rather than duplicating its
> implementation.
> 
> ./drivers/scsi/libsas/sas_init.c:426:7-8: opportunity for str_plural(i).
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://urldefense.com/v3/__https://bugzilla.openanolis.cn/show_bug.cgi?id=9351__;!!ACWV5N9M2RV99hQ!Nk42u-g6x28V1UUeWge3hrl1nLg33NAY5X2JMyTeC3VEMsYPh4q3Tr6OYXMtxHEj16ZsS_-eV3fHIvS5qevQliZxzvj9NdOu$

I don't see why the kernel commit history should be polluted with such info.

> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>   drivers/scsi/libsas/sas_init.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
> index 9c8cc723170d..67017c03d4da 100644
> --- a/drivers/scsi/libsas/sas_init.c
> +++ b/drivers/scsi/libsas/sas_init.c
> @@ -422,8 +422,8 @@ static void _sas_resume_ha(struct sas_ha_struct *ha, bool drain)
>   	 */
>   	i = phys_suspended(ha);
>   	if (i)
> -		dev_info(ha->dev, "waiting up to 25 seconds for %d phy%s to resume\n",
> -			 i, i > 1 ? "s" : "");
> +		dev_info(ha->dev, "waiting up to 25 seconds for %d phy%s to resume\n", i,
> +			 str_plural(i));

Is this really better?

I actually think that the following is preferable:
"waiting up to 25 seconds for %d phy(s) to resume\n", i);

>   	wait_event_timeout(ha->eh_wait_q, phys_suspended(ha) == 0, tmo);
>   	for (i = 0; i < ha->num_phys; i++) {
>   		struct asd_sas_phy *phy = ha->sas_phy[i];


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-18  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-18  7:44 [PATCH] scsi: libsas: Use str_plural() in _sas_resume_ha() Jiapeng Chong
2024-06-18  9:33 ` John Garry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®