diff mbox series

[U-Boot,3/5] video: anx6345: don't fail if there's no sleep or reset GPIOs

Message ID 20180929234553.31019-4-vagrant@debian.org
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series [U-Boot,1/5] mmc: sunxi: add support for automatic delay calibration | expand

Commit Message

Vagrant Cascadian Sept. 29, 2018, 11:45 p.m. UTC
From: Vasily Khoruzhick <anarsoul@gmail.com>

If there's no sleep or reset GPIOs, video_bridge_set_active() returns
-ENOENT. Don't fail in this case, since these GPIOs are optional.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
---

 drivers/video/bridge/anx6345.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andre Przywara Sept. 30, 2018, 10:26 p.m. UTC | #1
On 9/30/18 12:45 AM, Vagrant Cascadian wrote:

(CC:ing Anatolij)

> From: Vasily Khoruzhick <anarsoul@gmail.com>
> 
> If there's no sleep or reset GPIOs, video_bridge_set_active() returns
> -ENOENT. Don't fail in this case, since these GPIOs are optional.

Are really *both* optional?
If yes, you should apply the same check I suggested in the last patch
there as well, to also cover reset. Something like:

int video_bridge_set_active(struct udevice *dev, bool active)
{
	int ret = 0;

	/* The sleep GPIO is optional. */
	if (uc_priv->sleep.dev) {
		ret = dm_gpio_set_value(&uc_priv->sleep, !active);
		if (ret)
			return ret;
	}
	if (uc_priv->reset.dev && active) {
		ret = dm_gpio_set_value(&uc_priv->reset, true);
		...
	}

	return ret;
}

This avoids any attempts of cleverly ignoring errors, also allows you to
get rid of this patch at all. Plus it's a more suitable approach for
this generic driver file.

Cheers,
Andre.

> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
> ---
> 
>  drivers/video/bridge/anx6345.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c
> index 3e3f0e2ce6..28cf2a9c2d 100644
> --- a/drivers/video/bridge/anx6345.c
> +++ b/drivers/video/bridge/anx6345.c
> @@ -274,7 +274,7 @@ static int anx6345_enable(struct udevice *dev)
>  
>  	/* Deassert reset and enable power */
>  	ret = video_bridge_set_active(dev, true);
> -	if (ret)
> +	if (ret && ret != -ENOENT)
>  		return ret;
>  
>  	/* Reset */
>
diff mbox series

Patch

diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c
index 3e3f0e2ce6..28cf2a9c2d 100644
--- a/drivers/video/bridge/anx6345.c
+++ b/drivers/video/bridge/anx6345.c
@@ -274,7 +274,7 @@  static int anx6345_enable(struct udevice *dev)
 
 	/* Deassert reset and enable power */
 	ret = video_bridge_set_active(dev, true);
-	if (ret)
+	if (ret && ret != -ENOENT)
 		return ret;
 
 	/* Reset */