From: Julien BĂ©raud Date: Mon, 7 Jan 2019 09:17:46 +0000 (+0000) Subject: gpio: altera_pio: fix get_value X-Git-Tag: v2019.04-rc3~5^2~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=97b262758b7c99a644155254bee9f716573b10ac;p=oweals%2Fu-boot.git gpio: altera_pio: fix get_value gpio_get_value should return 0 or 1, not the value of bit & (1 << pin) Acked-by: Marek Vasut Signed-off-by: Julien Beraud --- diff --git a/drivers/gpio/altera_pio.c b/drivers/gpio/altera_pio.c index 59e30979f0..324f9c29a8 100644 --- a/drivers/gpio/altera_pio.c +++ b/drivers/gpio/altera_pio.c @@ -56,7 +56,7 @@ static int altera_pio_get_value(struct udevice *dev, unsigned pin) struct altera_pio_platdata *plat = dev_get_platdata(dev); struct altera_pio_regs *const regs = plat->regs; - return readl(®s->data) & (1 << pin); + return !!(readl(®s->data) & (1 << pin)); }