Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe4315c3 authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij
Browse files

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: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c8690d6d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);