Skip to content

Commit

Permalink
gpio: xra1403: Make use of for_each_requested_gpio()
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20200615150545.87964-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Andy Shevchenko authored and Linus Walleij committed Jun 20, 2020
1 parent 86661fd commit 7796cdc
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/gpio/gpio-xra1403.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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",
Expand Down

0 comments on commit 7796cdc

Please sign in to comment.