]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
authorAxel Lin <axel.lin@ingics.com>
Tue, 24 Sep 2013 07:47:41 +0000 (15:47 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 27 Sep 2013 12:19:59 +0000 (14:19 +0200)
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>
drivers/pinctrl/pinctrl-adi2.c

index f2aa8773f4e3a48e7bb30837a72a249dbbe1d166..8089fda00427712b2733a6a8b09107226312ee4d 100644 (file)
@@ -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);