Re: [PATCH v2] gpio: Use str_enable_disable-like helpers

From: Doug Berger
Date: Tue Jan 14 2025 - 18:19:23 EST


On 1/14/2025 11:14 AM, Krzysztof Kozlowski wrote:
Replace ternary (condition ? "enable" : "disable") syntax with helpers
from string_choices.h because:
1. Simple function call with one argument is easier to read. Ternary
operator has three arguments and with wrapping might lead to quite
long code.
2. Is slightly shorter thus also easier to read.
3. It brings uniformity in the text - same string.
4. Allows deduping by the linker, which results in a smaller binary
file.

Reviewed-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
---

Changes in v2:
1. Many more files changed.
---
drivers/gpio/gpio-brcmstb.c | 3 ++-
drivers/gpio/gpio-crystalcove.c | 3 ++-
drivers/gpio/gpio-grgpio.c | 3 ++-
drivers/gpio/gpio-mvebu.c | 7 ++++---
drivers/gpio/gpio-nomadik.c | 3 ++-
drivers/gpio/gpio-stmpe.c | 6 +++---
drivers/gpio/gpio-wcove.c | 3 ++-
drivers/gpio/gpio-wm831x.c | 3 ++-
drivers/gpio/gpio-xra1403.c | 3 ++-
drivers/gpio/gpiolib.c | 3 ++-
10 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 491b529d25f8..ca3472977431 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -9,6 +9,7 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
+#include <linux/string_choices.h>
enum gio_reg_index {
GIO_REG_ODEN = 0,
@@ -224,7 +225,7 @@ static int brcmstb_gpio_priv_set_wake(struct brcmstb_gpio_priv *priv,
ret = disable_irq_wake(priv->parent_wake_irq);
if (ret)
dev_err(&priv->pdev->dev, "failed to %s wake-up interrupt\n",
- enable ? "enable" : "disable");
+ str_enable_disable(enable));
return ret;
}
For gpio-brcmstb:
Acked-by: Doug Berger <opendmb@xxxxxxxxx>