* [PATCH 2/6] coccinelle: add rules to match recently introduced choice helpers
2026-08-20 6:11 [PATCH 1/6] lib/string_choices: add few more convenient choice helpers Dmitry Antipov
@ 2026-08-20 6:11 ` Dmitry Antipov
2026-08-20 6:11 ` [PATCH 3/6] ASoC: cs48l32: use str_lock_unlock() helper Dmitry Antipov
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Dmitry Antipov @ 2026-08-20 6:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Kees Cook, Julia Lawall, Nicolas Palix, David Rhodes,
Richard Fitzgerald, Tony Nguyen, Przemek Kitszel, Adrian Hunter,
Ulf Hansson, Edward Cree, linux-kernel, Dmitry Antipov
Add rules to match 'str_lock{ed}_unlock{ed}' and 'str_pass{ed}_fail{ed}'
string choice helpers.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
scripts/coccinelle/api/string_choices.cocci | 76 +++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts/coccinelle/api/string_choices.cocci
index 375045086912..77334a84e992 100644
--- a/scripts/coccinelle/api/string_choices.cocci
+++ b/scripts/coccinelle/api/string_choices.cocci
@@ -300,3 +300,79 @@ e << str_yes_no_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_yes_no(%s)" % e)
+
+@str_lock_unlock depends on patch@
+expression E;
+@@
+- ((E) ? "lock" : "unlock")
++ str_lock_unlock(E)
+
+@str_lock_unlock_r depends on !patch@
+expression E;
+position P;
+@@
+* E@P ? "lock" : "unlock"
+
+@script:python depends on report@
+p << str_lock_unlock_r.P;
+e << str_lock_unlock_r.E;
+@@
+
+coccilib.report.print_report(p[0], "opportunity for str_lock_unlock(%s)" % e)
+
+@str_locked_unlocked depends on patch@
+expression E;
+@@
+- ((E) ? "locked" : "unlocked")
++ str_locked_unlocked(E)
+
+@str_locked_unlocked_r depends on !patch@
+expression E;
+position P;
+@@
+* E@P ? "locked" : "unlocked"
+
+@script:python depends on report@
+p << str_locked_unlocked_r.P;
+e << str_locked_unlocked_r.E;
+@@
+
+coccilib.report.print_report(p[0], "opportunity for str_locked_unlocked(%s)" % e)
+
+@str_pass_fail depends on patch@
+expression E;
+@@
+- ((E) ? "pass" : "fail")
++ str_pass_fail(E)
+
+@str_pass_fail_r depends on !patch@
+expression E;
+position P;
+@@
+* E@P ? "pass" : "fail"
+
+@script:python depends on report@
+p << str_pass_fail_r.P;
+e << str_pass_fail_r.E;
+@@
+
+coccilib.report.print_report(p[0], "opportunity for str_pass_fail(%s)" % e)
+
+@str_passed_failed depends on patch@
+expression E;
+@@
+- ((E) ? "passed" : "failed")
++ str_passed_failed(E)
+
+@str_passed_failed_r depends on !patch@
+expression E;
+position P;
+@@
+* E@P ? "passed" : "failed"
+
+@script:python depends on report@
+p << str_passed_failed_r.P;
+e << str_passed_failed_r.E;
+@@
+
+coccilib.report.print_report(p[0], "opportunity for str_passed_failed(%s)" % e)
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 3/6] ASoC: cs48l32: use str_lock_unlock() helper
2026-08-20 6:11 [PATCH 1/6] lib/string_choices: add few more convenient choice helpers Dmitry Antipov
2026-08-20 6:11 ` [PATCH 2/6] coccinelle: add rules to match recently introduced " Dmitry Antipov
@ 2026-08-20 6:11 ` Dmitry Antipov
2026-08-20 6:39 ` Andy Shevchenko
2026-08-20 6:11 ` [PATCH 4/6] ice: use string choice helpers Dmitry Antipov
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Dmitry Antipov @ 2026-08-20 6:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Kees Cook, Julia Lawall, Nicolas Palix, David Rhodes,
Richard Fitzgerald, Tony Nguyen, Przemek Kitszel, Adrian Hunter,
Ulf Hansson, Edward Cree, linux-kernel, Dmitry Antipov
In 'cs48l32_wait_for_fll()', prefer 'str_lock_unlock()' choice
helper over hardcoded strings.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
sound/soc/codecs/cs48l32.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/cs48l32.c b/sound/soc/codecs/cs48l32.c
index a9967771124e..47093320e8eb 100644
--- a/sound/soc/codecs/cs48l32.c
+++ b/sound/soc/codecs/cs48l32.c
@@ -22,6 +22,7 @@
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
+#include <linux/string_choices.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <linux/string_choices.h>
@@ -1541,7 +1542,8 @@ static int cs48l32_wait_for_fll(struct cs48l32_fll *fll, bool requested)
}
}
- cs48l32_fll_warn(fll, "Timed out waiting for %s\n", requested ? "lock" : "unlock");
+ cs48l32_fll_warn(fll, "Timed out waiting for %s\n",
+ str_lock_unlock(requested));
return -ETIMEDOUT;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 3/6] ASoC: cs48l32: use str_lock_unlock() helper
2026-08-20 6:11 ` [PATCH 3/6] ASoC: cs48l32: use str_lock_unlock() helper Dmitry Antipov
@ 2026-08-20 6:39 ` Andy Shevchenko
0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2026-08-20 6:39 UTC (permalink / raw)
To: Dmitry Antipov
Cc: Andy Shevchenko, Kees Cook, Julia Lawall, Nicolas Palix,
David Rhodes, Richard Fitzgerald, Tony Nguyen, Przemek Kitszel,
Adrian Hunter, Ulf Hansson, Edward Cree, linux-kernel
On Thu, Aug 20, 2026 at 09:11:10AM +0300, Dmitry Antipov wrote:
> In 'cs48l32_wait_for_fll()', prefer 'str_lock_unlock()' choice
> helper over hardcoded strings.
...
> #include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/string_choices.h>
> #include <linux/slab.h>
> #include <linux/spi/spi.h>
> #include <linux/string_choices.h>
If you keep in order you will see that this is already there :-)
...
> - cs48l32_fll_warn(fll, "Timed out waiting for %s\n", requested ? "lock" : "unlock");
> + cs48l32_fll_warn(fll, "Timed out waiting for %s\n",
> + str_lock_unlock(requested));
I would leave it on the single line, it will be shorter anyway than
the original code.
...
You need a cover letter and explain there how to merge. I believe the idea is
to merge it via Kees' string/hardening tree.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/6] ice: use string choice helpers
2026-08-20 6:11 [PATCH 1/6] lib/string_choices: add few more convenient choice helpers Dmitry Antipov
2026-08-20 6:11 ` [PATCH 2/6] coccinelle: add rules to match recently introduced " Dmitry Antipov
2026-08-20 6:11 ` [PATCH 3/6] ASoC: cs48l32: use str_lock_unlock() helper Dmitry Antipov
@ 2026-08-20 6:11 ` Dmitry Antipov
2026-08-20 6:43 ` Andy Shevchenko
2026-08-20 9:30 ` Przemek Kitszel
2026-08-20 6:11 ` [PATCH 5/6] mmc: sdhci-of-k1: use str_fail_pass() helper Dmitry Antipov
` (2 subsequent siblings)
5 siblings, 2 replies; 12+ messages in thread
From: Dmitry Antipov @ 2026-08-20 6:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Kees Cook, Julia Lawall, Nicolas Palix, David Rhodes,
Richard Fitzgerald, Tony Nguyen, Przemek Kitszel, Adrian Hunter,
Ulf Hansson, Edward Cree, linux-kernel, Dmitry Antipov
Prefer 'str_locked_unlocked()', 'str_on_off()' and 'str_true_false()'
string choice helpers over hardcoded strings where appropriate.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
drivers/net/ethernet/intel/ice/ice.h | 1 +
drivers/net/ethernet/intel/ice/ice_sriov.c | 6 ++----
drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
drivers/net/ethernet/intel/ice/ice_tspll.c | 2 +-
drivers/net/ethernet/intel/ice/ice_vlan_mode.c | 2 +-
5 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index fc91b6665f90..fde1a9d30ad0 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -35,6 +35,7 @@
#include <linux/linkmode.h>
#include <linux/bpf.h>
#include <linux/btf.h>
+#include <linux/string_choices.h>
#include <linux/auxiliary_bus.h>
#include <linux/avf/virtchnl.h>
#include <linux/cpu_rmap.h>
diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
index e04de0215596..068c1af16514 100644
--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
@@ -1750,8 +1750,7 @@ void ice_print_vf_rx_mdd_event(struct ice_vf *vf)
dev_info(dev, "%d Rx Malicious Driver Detection events detected on PF %d VF %d MAC %pM. mdd-auto-reset-vfs=%s\n",
vf->mdd_rx_events.count, pf->hw.pf_id, vf->vf_id,
vf->dev_lan_addr,
- test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)
- ? "on" : "off");
+ str_on_off(test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)));
}
/**
@@ -1768,8 +1767,7 @@ void ice_print_vf_tx_mdd_event(struct ice_vf *vf)
dev_info(dev, "%d Tx Malicious Driver Detection events detected on PF %d VF %d MAC %pM. mdd-auto-reset-vfs=%s\n",
vf->mdd_tx_events.count, pf->hw.pf_id, vf->vf_id,
vf->dev_lan_addr,
- test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)
- ? "on" : "off");
+ str_on_off(test_bit(ICE_FLAG_MDD_AUTO_RESET_VF, pf->flags)));
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 6a5875bd9c6b..8447fdec3b7c 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -2098,7 +2098,7 @@ ice_update_recipe_lkup_idx(struct ice_hw *hw,
if (status)
ice_debug(hw, ICE_DBG_SW, "Failed to update recipe %d lkup_idx %d fv_idx %d mask %d mask_valid %s, status %d\n",
params->rid, params->lkup_idx, params->fv_idx,
- params->mask, params->mask_valid ? "true" : "false",
+ params->mask, str_true_false(params->mask_valid),
status);
error_out:
diff --git a/drivers/net/ethernet/intel/ice/ice_tspll.c b/drivers/net/ethernet/intel/ice/ice_tspll.c
index fd4b58eb9bc0..8270960eed1c 100644
--- a/drivers/net/ethernet/intel/ice/ice_tspll.c
+++ b/drivers/net/ethernet/intel/ice/ice_tspll.c
@@ -158,7 +158,7 @@ static void ice_tspll_log_cfg(struct ice_hw *hw, bool enable, u8 clk_src,
new_cfg ? "New" : "Current", str_enabled_disabled(enable),
ice_tspll_clk_src_str((enum ice_clk_src)clk_src),
ice_tspll_clk_freq_str((enum ice_tspll_freq)tspll_freq),
- lock ? "locked" : "unlocked");
+ str_locked_unlocked(lock));
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
index fb526cb84776..5f4c60eefc10 100644
--- a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
+++ b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
@@ -254,7 +254,7 @@ static int ice_dvm_update_dflt_recipes(struct ice_hw *hw)
if (status) {
ice_debug(hw, ICE_DBG_INIT, "Failed to update RID %d lkup_idx %d fv_idx %d mask_valid %s mask 0x%04x\n",
params->rid, params->lkup_idx, params->fv_idx,
- params->mask_valid ? "true" : "false",
+ str_true_false(params->mask_valid),
params->mask);
return status;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 4/6] ice: use string choice helpers
2026-08-20 6:11 ` [PATCH 4/6] ice: use string choice helpers Dmitry Antipov
@ 2026-08-20 6:43 ` Andy Shevchenko
2026-08-20 9:30 ` Przemek Kitszel
1 sibling, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2026-08-20 6:43 UTC (permalink / raw)
To: Dmitry Antipov
Cc: Andy Shevchenko, Kees Cook, Julia Lawall, Nicolas Palix,
David Rhodes, Richard Fitzgerald, Tony Nguyen, Przemek Kitszel,
Adrian Hunter, Ulf Hansson, Edward Cree, linux-kernel
On Thu, Aug 20, 2026 at 09:11:11AM +0300, Dmitry Antipov wrote:
> Prefer 'str_locked_unlocked()', 'str_on_off()' and 'str_true_false()'
> string choice helpers over hardcoded strings where appropriate.
...
> +++ b/drivers/net/ethernet/intel/ice/ice.h
> @@ -35,6 +35,7 @@
> #include <linux/linkmode.h>
> #include <linux/bpf.h>
> #include <linux/btf.h>
> +#include <linux/string_choices.h>
> #include <linux/auxiliary_bus.h>
> #include <linux/avf/virtchnl.h>
> #include <linux/cpu_rmap.h>
This is a mess. I think they have to think (start thinking) about IWYU
principle. So, please add this include to the each file you touch with
this patch. Left the rest to the ICE developers to amend.
With that being done,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/6] ice: use string choice helpers
2026-08-20 6:11 ` [PATCH 4/6] ice: use string choice helpers Dmitry Antipov
2026-08-20 6:43 ` Andy Shevchenko
@ 2026-08-20 9:30 ` Przemek Kitszel
1 sibling, 0 replies; 12+ messages in thread
From: Przemek Kitszel @ 2026-08-20 9:30 UTC (permalink / raw)
To: Dmitry Antipov, Andy Shevchenko, Tony Nguyen
Cc: Kees Cook, Julia Lawall, Nicolas Palix, David Rhodes,
Richard Fitzgerald, Adrian Hunter, Ulf Hansson, Edward Cree,
linux-kernel
On 8/20/26 08:11, Dmitry Antipov wrote:
> Prefer 'str_locked_unlocked()', 'str_on_off()' and 'str_true_false()'
> string choice helpers over hardcoded strings where appropriate.
>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
> drivers/net/ethernet/intel/ice/ice.h | 1 +
> drivers/net/ethernet/intel/ice/ice_sriov.c | 6 ++----
> drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
> drivers/net/ethernet/intel/ice/ice_tspll.c | 2 +-
> drivers/net/ethernet/intel/ice/ice_vlan_mode.c | 2 +-
> 5 files changed, 6 insertions(+), 7 deletions(-)
for net we prefer to not merge such refactors, given it's not related
to any bigger "net" work
https://docs.kernel.org/process/maintainer-netdev.html#clean-up-patches
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 5/6] mmc: sdhci-of-k1: use str_fail_pass() helper
2026-08-20 6:11 [PATCH 1/6] lib/string_choices: add few more convenient choice helpers Dmitry Antipov
` (2 preceding siblings ...)
2026-08-20 6:11 ` [PATCH 4/6] ice: use string choice helpers Dmitry Antipov
@ 2026-08-20 6:11 ` Dmitry Antipov
2026-08-20 6:44 ` Andy Shevchenko
2026-08-20 6:11 ` [PATCH 6/6] net: sfc: use string choice helpers Dmitry Antipov
2026-08-20 6:39 ` [PATCH 1/6] lib/string_choices: add few more convenient " Andy Shevchenko
5 siblings, 1 reply; 12+ messages in thread
From: Dmitry Antipov @ 2026-08-20 6:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Kees Cook, Julia Lawall, Nicolas Palix, David Rhodes,
Richard Fitzgerald, Tony Nguyen, Przemek Kitszel, Adrian Hunter,
Ulf Hansson, Edward Cree, linux-kernel, Dmitry Antipov
In 'spacemit_sdhci_execute_tuning()', prefer 'str_fail_pass()'
choice helper over hardcoded strings.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
drivers/mmc/host/sdhci-of-k1.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
index 37b0911e7cf2..80986c64eb83 100644
--- a/drivers/mmc/host/sdhci-of-k1.c
+++ b/drivers/mmc/host/sdhci-of-k1.c
@@ -18,6 +18,7 @@
#include <linux/reset.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
+#include <linux/string_choices.h>
#include "sdhci.h"
#include "sdhci-pltfm.h"
@@ -293,7 +294,7 @@ static int spacemit_sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
ret = mmc_send_tuning(host->mmc, opcode, NULL);
dev_dbg(mmc_dev(host->mmc), "RX delay %d: %s\n",
- i, ret == 0 ? "pass" : "fail");
+ i, str_fail_pass(ret));
if (ret == 0) {
/* Test passed - extend current window */
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 5/6] mmc: sdhci-of-k1: use str_fail_pass() helper
2026-08-20 6:11 ` [PATCH 5/6] mmc: sdhci-of-k1: use str_fail_pass() helper Dmitry Antipov
@ 2026-08-20 6:44 ` Andy Shevchenko
0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2026-08-20 6:44 UTC (permalink / raw)
To: Dmitry Antipov
Cc: Andy Shevchenko, Kees Cook, Julia Lawall, Nicolas Palix,
David Rhodes, Richard Fitzgerald, Tony Nguyen, Przemek Kitszel,
Adrian Hunter, Ulf Hansson, Edward Cree, linux-kernel
On Thu, Aug 20, 2026 at 09:11:12AM +0300, Dmitry Antipov wrote:
> In 'spacemit_sdhci_execute_tuning()', prefer 'str_fail_pass()'
> choice helper over hardcoded strings.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/6] net: sfc: use string choice helpers
2026-08-20 6:11 [PATCH 1/6] lib/string_choices: add few more convenient choice helpers Dmitry Antipov
` (3 preceding siblings ...)
2026-08-20 6:11 ` [PATCH 5/6] mmc: sdhci-of-k1: use str_fail_pass() helper Dmitry Antipov
@ 2026-08-20 6:11 ` Dmitry Antipov
2026-08-20 6:47 ` Andy Shevchenko
2026-08-20 6:39 ` [PATCH 1/6] lib/string_choices: add few more convenient " Andy Shevchenko
5 siblings, 1 reply; 12+ messages in thread
From: Dmitry Antipov @ 2026-08-20 6:11 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Kees Cook, Julia Lawall, Nicolas Palix, David Rhodes,
Richard Fitzgerald, Tony Nguyen, Przemek Kitszel, Adrian Hunter,
Ulf Hansson, Edward Cree, linux-kernel, Dmitry Antipov
Prefer 'str_failed_passed()' and 'str_off_on()' choice helpers
over hardcoded strings where appropriate.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
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
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 6/6] net: sfc: use string choice helpers
2026-08-20 6:11 ` [PATCH 6/6] net: sfc: use string choice helpers Dmitry Antipov
@ 2026-08-20 6:47 ` Andy Shevchenko
0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2026-08-20 6:47 UTC (permalink / raw)
To: Dmitry Antipov
Cc: Andy Shevchenko, Kees Cook, Julia Lawall, Nicolas Palix,
David Rhodes, Richard Fitzgerald, Tony Nguyen, Przemek Kitszel,
Adrian Hunter, Ulf Hansson, Edward Cree, linux-kernel
On Thu, Aug 20, 2026 at 09:11:13AM +0300, Dmitry Antipov wrote:
> Prefer 'str_failed_passed()' and 'str_off_on()' choice helpers
> over hardcoded strings where appropriate.
...
> 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));
This should be str_offline_online(). So, either add those, or drop misleading
str_off_on() in this patch.
...
Same for all cases in this patch.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/6] lib/string_choices: add few more convenient choice helpers
2026-08-20 6:11 [PATCH 1/6] lib/string_choices: add few more convenient choice helpers Dmitry Antipov
` (4 preceding siblings ...)
2026-08-20 6:11 ` [PATCH 6/6] net: sfc: use string choice helpers Dmitry Antipov
@ 2026-08-20 6:39 ` Andy Shevchenko
5 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2026-08-20 6:39 UTC (permalink / raw)
To: Dmitry Antipov
Cc: Andy Shevchenko, Kees Cook, Julia Lawall, Nicolas Palix,
David Rhodes, Richard Fitzgerald, Tony Nguyen, Przemek Kitszel,
Adrian Hunter, Ulf Hansson, Edward Cree, linux-kernel
On Thu, Aug 20, 2026 at 09:11:08AM +0300, Dmitry Antipov wrote:
> Looking over a few kernel subsystems I'm currently working
> on, I suppose that 'str_pass_fail()', 'str_passed_failed()',
> 'str_lock_unlock()' and 'str_locked_unlocked()' with their
> opposite counterpart macros may be useful as well.
Fine by me as long as we have users.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 12+ messages in thread