diff mbox series

[1/2] w1: w1-gpio: claim the gpio with correct initial flag

Message ID 20210623142017.634100-1-eugen.hristev@microchip.com
State Accepted
Commit dffea443a3c4d899085f7c0d307dbb8e88ea849a
Delegated to: Eugen Hristev
Headers show
Series [1/2] w1: w1-gpio: claim the gpio with correct initial flag | expand

Commit Message

Eugen Hristev June 23, 2021, 2:20 p.m. UTC
gpio_request_by_name should be called with proper flags.
The 0 value flag is invalid, and causes bad initialization of the gpio.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/w1/w1-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eugen Hristev July 6, 2021, 12:18 p.m. UTC | #1
On 6/23/21 5:20 PM, Eugen Hristev wrote:
> gpio_request_by_name should be called with proper flags.
> The 0 value flag is invalid, and causes bad initialization of the gpio.
> 
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> ---
>   drivers/w1/w1-gpio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/w1/w1-gpio.c b/drivers/w1/w1-gpio.c
> index 3b0ead6f6d..9346f810ce 100644
> --- a/drivers/w1/w1-gpio.c
> +++ b/drivers/w1/w1-gpio.c
> @@ -156,7 +156,7 @@ static int w1_gpio_of_to_plat(struct udevice *dev)
>   	struct w1_gpio_pdata *pdata = dev_get_plat(dev);
>   	int ret;
>   
> -	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, 0);
> +	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, GPIOD_IS_IN);
>   	if (ret < 0)
>   		printf("Error claiming GPIO %d\n", ret);
>   
> 

Applied both to u-boot-atmel/master
diff mbox series

Patch

diff --git a/drivers/w1/w1-gpio.c b/drivers/w1/w1-gpio.c
index 3b0ead6f6d..9346f810ce 100644
--- a/drivers/w1/w1-gpio.c
+++ b/drivers/w1/w1-gpio.c
@@ -156,7 +156,7 @@  static int w1_gpio_of_to_plat(struct udevice *dev)
 	struct w1_gpio_pdata *pdata = dev_get_plat(dev);
 	int ret;
 
-	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, 0);
+	ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, GPIOD_IS_IN);
 	if (ret < 0)
 		printf("Error claiming GPIO %d\n", ret);