From: Sonic Zhang Date: Tue, 8 Oct 2013 07:31:21 +0000 (+0800) Subject: pinctrl: pinctrl-adi2: disable IRQ when setting value X-Git-Tag: firefly_0821_release~176^2~5008^2~26 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d3224ed140dc440c43e1da607b7685635e8064a6;p=firefly-linux-kernel-4.4.55.git pinctrl: pinctrl-adi2: disable IRQ when setting value GPIO output value should be set after the GPIO interrupt is disabled. Use BIT macro as well. Signed-off-by: Sonic Zhang [Edited commit message] Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c index a74e6f4ffbd7..7a39562c3e42 100644 --- a/drivers/pinctrl/pinctrl-adi2.c +++ b/drivers/pinctrl/pinctrl-adi2.c @@ -766,9 +766,9 @@ static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset, spin_lock_irqsave(&port->lock, flags); if (value) - writew(1 << offset, ®s->data_set); + writew(BIT(offset), ®s->data_set); else - writew(1 << offset, ®s->data_clear); + writew(BIT(offset), ®s->data_clear); spin_unlock_irqrestore(&port->lock, flags); } @@ -780,12 +780,14 @@ 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); - writew(1 << offset, ®s->dir_set); + writew(readw(®s->inen) & ~BIT(offset), ®s->inen); + if (value) + writew(BIT(offset), ®s->data_set); + else + writew(BIT(offset), ®s->data_clear); + writew(BIT(offset), ®s->dir_set); spin_unlock_irqrestore(&port->lock, flags);