Skip to contentSkip to conversation

scsi: libsas: Use str_plural() in _sas_resume_ha()

PATCH In review Jiapeng Chong 2 participants 2 messages Jun 18, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: libsas: Use str_plural() in _sas_resume_ha()

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

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

---
 drivers/scsi/libsas/sas_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/libsas/sas_init.c +2 -2
index 9c8cc723170d..67017c03d4da 100644
@@ -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];
Signature · 1 line
2.20.1.7.g153144c
reviewer
#1 lore raw
Quoted 7 lines · Jiapeng Chong

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

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

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

Quoted 10 lines
---
  drivers/scsi/libsas/sas_init.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/libsas/sas_init.c +0 -0
index 9c8cc723170d..67017c03d4da 100644

drivers/scsi/libsas/sas_init.c static void _sas_resume_ha(struct sas_ha_struct *ha, bool drain) · line 426

Quoted 7 lines
drivers/scsi/libsas/sas_init.c +2 -2
@@ -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);

Quoted 3 lines
drivers/scsi/libsas/sas_init.c +0 -0
  	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];