[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230306195556.55475-7-andriy.shevchenko@linux.intel.com>
Date: Mon, 6 Mar 2023 21:55:46 +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 06/16] gpio: adnp: 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-adnp.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
index a6439e3daff0..823cad855ee8 100644
--- a/drivers/gpio/gpio-adnp.c
+++ b/drivers/gpio/gpio-adnp.c
@@ -11,6 +11,7 @@
#include <linux/property.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#define GPIO_DDR(gpio) (0x00 << (gpio)->reg_shift)
#define GPIO_PLR(gpio) (0x01 << (gpio)->reg_shift)
@@ -211,25 +212,12 @@ static void adnp_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
for (j = 0; j < 8; j++) {
unsigned int bit = (i << adnp->reg_shift) + j;
- const char *direction = "input ";
- const char *level = "low ";
- const char *interrupt = "disabled";
- const char *pending = "";
- if (ddr & BIT(j))
- direction = "output";
-
- if (plr & BIT(j))
- level = "high";
-
- if (ier & BIT(j))
- interrupt = "enabled ";
-
- if (isr & BIT(j))
- pending = "pending";
-
- seq_printf(s, "%2u: %s %s IRQ %s %s\n", bit,
- direction, level, interrupt, pending);
+ seq_printf(s, "%2u: %-6.6s %-4.4s IRQ %-8.8s %s\n", bit,
+ str_output_input(ddr & BIT(j)),
+ str_high_low(plr & BIT(j)),
+ str_enabled_disabled(ier & BIT(j)),
+ (isr & BIT(j)) ? "pending" : "");
}
}
--
2.39.1
Powered by blists - more mailing lists