From: Andre Przywara Date: Thu, 18 Oct 2018 15:18:36 +0100 Subject: [U-Boot] [PATCH v3 2/5] dm: video: bridge: don't fail to activate bridge if reset or sleep GPIO is missing In-Reply-To: <20181018055651.10249-3-anarsoul@gmail.com> References: <20181018055651.10249-1-anarsoul@gmail.com> <20181018055651.10249-3-anarsoul@gmail.com> Message-ID: <20181018151836.34b28ec0@donnerap.cambridge.arm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, 17 Oct 2018 22:56:48 -0700 Vasily Khoruzhick wrote: > Both GPIOs are optional, so we shouldn't fail if any is missing. > Without this fix reset is not deasserted if sleep GPIO is missing. > > Signed-off-by: Vasily Khoruzhick > Acked-by: Maxime Ripard > Tested-by: Maxime Ripard > Cc: Vagrant Cascadian Reviewed-by: Andre Przywara Thanks! Andre. > --- > drivers/video/bridge/video-bridge-uclass.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/drivers/video/bridge/video-bridge-uclass.c > b/drivers/video/bridge/video-bridge-uclass.c index > cd4959cc71..5fecb4cfd5 100644 --- > a/drivers/video/bridge/video-bridge-uclass.c +++ > b/drivers/video/bridge/video-bridge-uclass.c @@ -106,13 +106,19 @@ > static int video_bridge_pre_probe(struct udevice *dev) int > video_bridge_set_active(struct udevice *dev, bool active) { > struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev); > - int ret; > + int ret = 0; > > debug("%s: %d\n", __func__, active); > - ret = dm_gpio_set_value(&uc_priv->sleep, !active); > - if (ret) > - return ret; > - if (active) { > + if (uc_priv->sleep.dev) { > + ret = dm_gpio_set_value(&uc_priv->sleep, !active); > + if (ret) > + return ret; > + } > + > + if (!active) > + return 0; > + > + if (uc_priv->reset.dev) { > ret = dm_gpio_set_value(&uc_priv->reset, true); > if (ret) > return ret;