[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230306195556.55475-11-andriy.shevchenko@linux.intel.com>
Date: Mon, 6 Mar 2023 21:55:50 +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 10/16] gpio: mvebu: 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-mvebu.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index a68f682aec01..f2bbe928577c 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -48,6 +48,7 @@
#include <linux/pwm.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
/*
* GPIO unit register offsets.
@@ -897,32 +898,28 @@ static void mvebu_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
lvl_msk = mvebu_gpio_read_level_mask(mvchip);
for_each_requested_gpio(chip, i, label) {
- u32 msk;
- bool is_out;
+ u32 msk = BIT(i);
- msk = BIT(i);
- is_out = !(io_conf & msk);
+ seq_printf(s, " gpio-%-3d (%-20.20s) %-3.3s ", chip->base + i, label,
+ str_in_out(io_conf & msk));
- seq_printf(s, " gpio-%-3d (%-20.20s)", chip->base + i, label);
-
- if (is_out) {
- seq_printf(s, " out %s %s\n",
- out & msk ? "hi" : "lo",
+ if (!(io_conf & msk)) {
+ seq_printf(s, "%-2.2s %s\n", str_hi_lo(out & msk),
blink & msk ? "(blink )" : "");
continue;
}
- seq_printf(s, " in %s (act %s) - IRQ",
- (data_in ^ in_pol) & msk ? "hi" : "lo",
- in_pol & msk ? "lo" : "hi");
+ seq_printf(s, "%-2.2s (act %-2.2s) - IRQ ",
+ str_hi_lo((data_in ^ in_pol) & msk),
+ str_lo_hi(in_pol & msk));
if (!((edg_msk | lvl_msk) & msk)) {
- seq_puts(s, " disabled\n");
+ seq_puts(s, "disabled\n");
continue;
}
if (edg_msk & msk)
- seq_puts(s, " edge ");
+ seq_puts(s, "edge ");
if (lvl_msk & msk)
- seq_puts(s, " level");
+ seq_puts(s, "level");
seq_printf(s, " (%s)\n", cause & msk ? "pending" : "clear ");
}
}
--
2.39.1
Powered by blists - more mailing lists