[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230306195556.55475-13-andriy.shevchenko@linux.intel.com>
Date: Mon, 6 Mar 2023 21:55:52 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Schspa Shi <schspa@...il.com>, Marc Zyngier <maz@...nel.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-pwm@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
patches@...nsource.cirrus.com
Cc: Linus Walleij <linus.walleij@...aro.org>,
Doug Berger <opendmb@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
Andy Shevchenko <andy@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Nandor Han <nandor.han@...com>,
Semi Malinen <semi.malinen@...com>
Subject: [PATCH v1 12/16] gpio: stmpe: Utilize helpers from string_choices.h
There are a few helpers available to convert a boolean variable
to the dedicated string literals depending on the application.
Use them in the driver.
While at, utilize specifier field for padding the strings where
it's required.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/gpio/gpio-stmpe.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 0fa4f0a93378..ca8a98b252c2 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -14,6 +14,7 @@
#include <linux/mfd/stmpe.h>
#include <linux/seq_file.h>
#include <linux/bitops.h>
+#include <linux/string_choices.h>
/*
* These registers are modified under the irq bus lock and cached to avoid
@@ -264,12 +265,12 @@ static void stmpe_dbg_show_one(struct seq_file *s,
ret = stmpe_reg_read(stmpe, dir_reg);
if (ret < 0)
return;
- dir = !!(ret & mask);
+ dir = !!(ret & mask);
+ seq_printf(s, " gpio-%-3d (%-20.20s) %-3.3s %-2.2s ", gpio,
+ label ?: "(none)", str_out_in(dir), str_hi_lo(val));
if (dir) {
- seq_printf(s, " gpio-%-3d (%-20.20s) out %s",
- gpio, label ?: "(none)",
- val ? "hi" : "lo");
+ seq_putc(s, '\n');
} else {
u8 edge_det_reg;
u8 rise_reg;
@@ -336,11 +337,9 @@ static void stmpe_dbg_show_one(struct seq_file *s,
return;
irqen = !!(ret & mask);
- seq_printf(s, " gpio-%-3d (%-20.20s) in %s %13s %13s %25s %25s",
- gpio, label ?: "(none)",
- val ? "hi" : "lo",
+ seq_printf(s, "%13s IRQ-%9s %25s %25s\n",
edge_det_values[edge_det],
- irqen ? "IRQ-enabled" : "IRQ-disabled",
+ str_enabled_disabled(irqen),
rise_values[rise],
fall_values[fall]);
}
@@ -351,10 +350,8 @@ static void stmpe_dbg_show(struct seq_file *s, struct gpio_chip *gc)
unsigned i;
unsigned gpio = gc->base;
- for (i = 0; i < gc->ngpio; i++, gpio++) {
+ for (i = 0; i < gc->ngpio; i++, gpio++)
stmpe_dbg_show_one(s, gc, i, gpio);
- seq_putc(s, '\n');
- }
}
static struct irq_chip stmpe_gpio_irq_chip = {
--
2.39.1
Powered by blists - more mailing lists