altera_pio: fix get_value
PATCH v2 1/1 altera_pio: fix get_value
gpio_get_value should return 0 or 1, not 1 << pin
Signed-off-by Julien Beraud <[email protected]>
--- drivers/gpio/altera_pio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/altera_pio.c +1 -1
@@ -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)); }
Signature · 1 line
2.20.1
PATCH v2 1/1 altera_pio: fix get_value
Quoted 1 line · Julien Béraud
gpio_get_valueshould return 0 or 1, not 1 << pin
It does not return 1 << pin, it returns value of the bit & (1 << pin). The patch is fine, reword the commit message and add my
Acked-by Marek Vasut <[email protected]>
Thanks
btw you can also align the $subject tags to "gpio: altera_pio: ...".
Quoted 19 lines
Signed-off-by Julien Beraud <[email protected]>--- drivers/gpio/altera_pio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/altera_pio.c +1
-1@@ -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)); }
Signature · 2 lines
Best regards, Marek Vasut