[PATCH 6/6] net: sfc: use string choice helpers
From: Dmitry Antipov
Date: Thu Aug 20 2026 - 02:19:43 EST
Prefer 'str_failed_passed()' and 'str_off_on()' choice helpers
over hardcoded strings where appropriate.
Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
---
drivers/net/ethernet/sfc/ethtool_common.c | 5 +++--
drivers/net/ethernet/sfc/falcon/ethtool.c | 5 +++--
drivers/net/ethernet/sfc/siena/ethtool_common.c | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ethtool_common.c b/drivers/net/ethernet/sfc/ethtool_common.c
index 54f8e4626568..30d9babcdbd9 100644
--- a/drivers/net/ethernet/sfc/ethtool_common.c
+++ b/drivers/net/ethernet/sfc/ethtool_common.c
@@ -9,6 +9,7 @@
*/
#include <linux/module.h>
#include <linux/netdevice.h>
+#include <linux/string_choices.h>
#include "net_driver.h"
#include "mcdi.h"
#include "nic.h"
@@ -162,8 +163,8 @@ void efx_ethtool_self_test(struct net_device *net_dev,
dev_close(efx->net_dev);
netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n",
- rc == 0 ? "passed" : "failed",
- (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
+ str_failed_passed(rc),
+ str_off_on(test->flags & ETH_TEST_FL_OFFLINE));
out:
efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data);
diff --git a/drivers/net/ethernet/sfc/falcon/ethtool.c b/drivers/net/ethernet/sfc/falcon/ethtool.c
index 3d81b3ca61e9..f2728023de55 100644
--- a/drivers/net/ethernet/sfc/falcon/ethtool.c
+++ b/drivers/net/ethernet/sfc/falcon/ethtool.c
@@ -9,6 +9,7 @@
#include <linux/ethtool.h>
#include <linux/rtnetlink.h>
#include <linux/in.h>
+#include <linux/string_choices.h>
#include "net_driver.h"
#include "workarounds.h"
#include "selftest.h"
@@ -522,8 +523,8 @@ static void ef4_ethtool_self_test(struct net_device *net_dev,
dev_close(efx->net_dev);
netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n",
- rc == 0 ? "passed" : "failed",
- (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
+ str_failed_passed(rc),
+ str_off_on(test->flags & ETH_TEST_FL_OFFLINE));
out:
ef4_ethtool_fill_self_tests(efx, ef4_tests, NULL, data);
diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.c b/drivers/net/ethernet/sfc/siena/ethtool_common.c
index 76cbce2b9592..0fa6b56b3861 100644
--- a/drivers/net/ethernet/sfc/siena/ethtool_common.c
+++ b/drivers/net/ethernet/sfc/siena/ethtool_common.c
@@ -9,6 +9,7 @@
*/
#include <linux/module.h>
#include <linux/netdevice.h>
+#include <linux/string_choices.h>
#include "net_driver.h"
#include "mcdi.h"
#include "nic.h"
@@ -384,8 +385,8 @@ void efx_siena_ethtool_self_test(struct net_device *net_dev,
dev_close(efx->net_dev);
netif_info(efx, drv, efx->net_dev, "%s %sline self-tests\n",
- rc == 0 ? "passed" : "failed",
- (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
+ str_failed_passed(rc),
+ str_off_on(test->flags & ETH_TEST_FL_OFFLINE));
out:
efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data);
--
2.55.0