Skip to contentSkip to conversation

net: chelsio: cxgb4: Use str_plural() in mem_intr_handler()

PATCH Applied Thorsten Blum 3 participants 3 messages Jul 4 – Jul 10

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

PATCH 1/1 net: chelsio: cxgb4: Use str_plural() in mem_intr_handler()

Replace the manual ternary "s" pluralization with str_plural() to simplify the code.

---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +2 -1
index 6871127427fa..29d7b786e51e 100644
@@ -33,6 +33,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/string_choices.h>
 #include "cxgb4.h"
 #include "t4_regs.h"
 #include "t4_values.h"
@@ -4867,7 +4868,7 @@ static void mem_intr_handler(struct adapter *adapter, int idx)
 		if (printk_ratelimit())
 			dev_warn(adapter->pdev_dev,
 				 "%u %s correctable ECC data error%s\n",
-				 cnt, name[idx], cnt > 1 ? "s" : "");
+				 cnt, name[idx], str_plural(cnt));
 	}
 	if (v & ECC_UE_INT_CAUSE_F)
 		dev_alert(adapter->pdev_dev,
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Thorsten Blum

Replace the manual ternary "s" pluralization with str_plural() to simplify the code.

---

Thank you.

Quoted 24 lines
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +2 -1
index 6871127427fa..29d7b786e51e 100644
@@ -33,6 +33,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/string_choices.h>
 #include "cxgb4.h"
 #include "t4_regs.h"
 #include "t4_values.h"
@@ -4867,7 +4868,7 @@ static void mem_intr_handler(struct adapter *adapter, int idx)
 		if (printk_ratelimit())
 			dev_warn(adapter->pdev_dev,
 				 "%u %s correctable ECC data error%s\n",
-				 cnt, name[idx], cnt > 1 ? "s" : "");
+				 cnt, name[idx], str_plural(cnt));
 	}
 	if (v & ECC_UE_INT_CAUSE_F)
 		dev_alert(adapter->pdev_dev,
#2 lore raw
In reply to Thorsten Blum
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 7 lines · On Sat, 4 Jul 2026 14:10:11 +0200 you wrote:

Replace the manual ternary "s" pluralization with str_plural() to simplify the code.

---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
- [net-next] net: chelsio: cxgb4: Use str_plural() in mem_intr_handler()

    https://git.kernel.org/netdev/net-next/c/d5d7554052f3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html