linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	linux-gpio@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Nandor Han <nandor.han@ge.com>,
	Semi Malinen <semi.malinen@ge.com>
Subject: [PATCH v1 4/5] gpio: xra1403: Make use of for_each_requested_gpio()
Date: Mon, 15 Jun 2020 18:05:44 +0300	[thread overview]
Message-ID: <20200615150545.87964-5-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20200615150545.87964-1-andriy.shevchenko@linux.intel.com>

Make use of for_each_requested_gpio() instead of home grown analogue.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Nandor Han <nandor.han@ge.com>
Cc: Semi Malinen <semi.malinen@ge.com>
---
 drivers/gpio/gpio-xra1403.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c
index 31b5072b2df0..e2cac12092af 100644
--- a/drivers/gpio/gpio-xra1403.c
+++ b/drivers/gpio/gpio-xra1403.c
@@ -121,6 +121,7 @@ static void xra1403_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 	struct xra1403 *xra = gpiochip_get_data(chip);
 	int value[XRA_LAST];
 	int i;
+	const char *label;
 	unsigned int gcr;
 	unsigned int gsr;
 
@@ -136,12 +137,7 @@ static void xra1403_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 
 	gcr = value[XRA_GCR + 1] << 8 | value[XRA_GCR];
 	gsr = value[XRA_GSR + 1] << 8 | value[XRA_GSR];
-	for (i = 0; i < chip->ngpio; i++) {
-		const char *label = gpiochip_is_requested(chip, i);
-
-		if (!label)
-			continue;
-
+	for_each_requested_gpio(chip, i, label) {
 		seq_printf(s, " gpio-%-3d (%-12s) %s %s\n",
 			   chip->base + i, label,
 			   (gcr & BIT(i)) ? "in" : "out",
-- 
2.27.0.rc2


  parent reply	other threads:[~2020-06-15 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 15:05 [PATCH v1 0/5] gpio, pinctrl, introduce for_each_requested_gpio() helper Andy Shevchenko
2020-06-15 15:05 ` [PATCH v1 1/5] gpiolib: Introduce for_each_requested_gpio_in_range() macro Andy Shevchenko
2020-06-15 15:05 ` [PATCH v1 2/5] ARM/orion/gpio: Make use of for_each_requested_gpio() Andy Shevchenko
2020-06-16 20:43   ` Andrew Lunn
2020-07-18 20:52   ` Gregory CLEMENT
2020-07-18 21:31     ` Andy Shevchenko
2020-06-15 15:05 ` [PATCH v1 3/5] gpio: mvebu: " Andy Shevchenko
2020-06-15 15:05 ` Andy Shevchenko [this message]
2020-06-15 15:05 ` [PATCH v1 5/5] pinctrl: at91: " Andy Shevchenko
2020-06-20 21:16 ` [PATCH v1 0/5] gpio, pinctrl, introduce for_each_requested_gpio() helper Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200615150545.87964-5-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=nandor.han@ge.com \
    --cc=semi.malinen@ge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).