Skip to content

Commit

Permalink
pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
Browse files Browse the repository at this point in the history
Current code hold port->lock spinlock and then try to grab the lock again
in adi_gpio_set_value(). Fix it.

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 Sep 27, 2013
1 parent c8690d6 commit fe4315c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/pinctrl/pinctrl-adi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,11 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
struct gpio_port_t *regs = port->regs;
unsigned long flags;

adi_gpio_set_value(chip, offset, value);

spin_lock_irqsave(&port->lock, flags);

writew(readw(&regs->inen) & ~(1 << offset), &regs->inen);
adi_gpio_set_value(chip, offset, value);
writew(1 << offset, &regs->dir_set);

spin_unlock_irqrestore(&port->lock, flags);
Expand Down

0 comments on commit fe4315c

Please sign in to comment.