[U-Boot] [PATCH v3 1/1] gpio: altera_pio: fix get_value

Marek Vasut marex at denx.de
Mon Jan 7 09:26:21 UTC 2019


On 1/7/19 10:17 AM, Julien BĂ©raud wrote:
> gpio_get_value should return 0 or 1, not the value of bit & (1 << pin)
> 
> Acked-by: Marek Vasut <marex at denx.de>
> Signed-off-by: Julien Beraud <julien.beraud at orolia.com>

btw. you should keep a changelog with each new Vx of a patch.
Here it's fine, just add one next time you submit patches.

> ---
>  drivers/gpio/altera_pio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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(&regs->data) & (1 << pin);
> +	return !!(readl(&regs->data) & (1 << pin));
>  }
>  
>  
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list