Skip to content

Commit

Permalink
gpio: mb86s70: Return error if requesting an already assigned gpio
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Axel Lin authored and Linus Walleij committed Mar 2, 2015
1 parent c517d83 commit fd9c963
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpio/gpio-mb86s7x.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio)
spin_lock_irqsave(&gchip->lock, flags);

val = readl(gchip->base + PFR(gpio));
if (!(val & OFFSET(gpio))) {
spin_unlock_irqrestore(&gchip->lock, flags);
return -EINVAL;
}

val &= ~OFFSET(gpio);
writel(val, gchip->base + PFR(gpio));

Expand Down

0 comments on commit fd9c963

Please sign in to comment.