From: Axel Lin Date: Tue, 24 Sep 2013 07:47:41 +0000 (+0800) Subject: pinctrl: adi2: Fix dead lock in adi_gpio_direction_output X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fe4315c3b0cbd4ae5a0b7fcf42c265ed03e27d7a;p=openwrt%2Fstaging%2Fblogic.git pinctrl: adi2: Fix dead lock in adi_gpio_direction_output 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 Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c index f2aa8773f4e3..8089fda00427 100644 --- a/drivers/pinctrl/pinctrl-adi2.c +++ b/drivers/pinctrl/pinctrl-adi2.c @@ -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(®s->inen) & ~(1 << offset), ®s->inen); - adi_gpio_set_value(chip, offset, value); writew(1 << offset, ®s->dir_set); spin_unlock_irqrestore(&port->lock, flags);