Commit fd9c963c authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij

gpio: mb86s70: Return error if requesting an already assigned gpio

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c517d838
...@@ -58,6 +58,11 @@ static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio) ...@@ -58,6 +58,11 @@ static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio)
spin_lock_irqsave(&gchip->lock, flags); spin_lock_irqsave(&gchip->lock, flags);
val = readl(gchip->base + PFR(gpio)); val = readl(gchip->base + PFR(gpio));
if (!(val & OFFSET(gpio))) {
spin_unlock_irqrestore(&gchip->lock, flags);
return -EINVAL;
}
val &= ~OFFSET(gpio); val &= ~OFFSET(gpio);
writel(val, gchip->base + PFR(gpio)); writel(val, gchip->base + PFR(gpio));
......
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