Commit acf06ff7 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Linus Walleij

gpio: refactor gpiochip_find() slightly

The if...else... block after the loop can be dropped with
a slight refactoring.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 05cc995f
...@@ -1363,19 +1363,15 @@ struct gpio_chip *gpiochip_find(void *data, ...@@ -1363,19 +1363,15 @@ struct gpio_chip *gpiochip_find(void *data,
void *data)) void *data))
{ {
struct gpio_device *gdev; struct gpio_device *gdev;
struct gpio_chip *chip; struct gpio_chip *chip = NULL;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gpio_lock, flags); spin_lock_irqsave(&gpio_lock, flags);
list_for_each_entry(gdev, &gpio_devices, list) list_for_each_entry(gdev, &gpio_devices, list)
if (gdev->chip && match(gdev->chip, data)) if (gdev->chip && match(gdev->chip, data)) {
break;
/* No match? */
if (&gdev->list == &gpio_devices)
chip = NULL;
else
chip = gdev->chip; chip = gdev->chip;
break;
}
spin_unlock_irqrestore(&gpio_lock, flags); spin_unlock_irqrestore(&gpio_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment