net: stmmac: Use str_enabled_disabled() helper
authorYu-Chun Lin <eleanor15x@gmail.com>
Mon, 17 Feb 2025 15:58:33 +0000 (23:58 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Feb 2025 02:12:12 +0000 (18:12 -0800)
As kernel test robot reported, the following warning occurs:

cocci warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c:582:6-8: opportunity for str_enabled_disabled(on)

Replace ternary (condition ? "enabled" : "disabled") with
str_enabled_disabled() from string_choices.h to improve readability,
maintain uniform string usage, and reduce binary size through linker
deduplication.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
Link: https://patch.msgid.link/20250217155833.3105775-1-eleanor15x@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c

index 7900bf3effa719b675960329786138d6e9affd0f..a8b901cdf5cbb395a0f6b4800ad6f06c6e870077 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/ethtool.h>
 #include <linux/io.h>
+#include <linux/string_choices.h>
 #include "stmmac.h"
 #include "stmmac_pcs.h"
 #include "stmmac_ptp.h"
@@ -625,7 +626,7 @@ int dwmac1000_ptp_enable(struct ptp_clock_info *ptp,
                }
 
                netdev_dbg(priv->dev, "Auxiliary Snapshot %s.\n",
-                          on ? "enabled" : "disabled");
+                          str_enabled_disabled(on));
                writel(tcr_val, ptpaddr + PTP_TCR);
 
                /* wait for auxts fifo clear to finish */