diff mbox series

drm/bridge: lvds-encoder: remove surplus NULL checks

Message ID 20190118231129.8281-1-peda@axentia.se (mailing list archive)
State New, archived
Headers show
Series drm/bridge: lvds-encoder: remove surplus NULL checks | expand

Commit Message

Peter Rosin Jan. 18, 2019, 11:11 p.m. UTC
The gpio API explicitly allows skipping the NULL check, precisely to
allow for neat support for optional gpios. Which is exactly what is at
play here.

Reported-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/gpu/drm/bridge/lvds-encoder.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Daniel Vetter Jan. 21, 2019, 9:33 a.m. UTC | #1
On Fri, Jan 18, 2019 at 11:11:38PM +0000, Peter Rosin wrote:
> The gpio API explicitly allows skipping the NULL check, precisely to
> allow for neat support for optional gpios. Which is exactly what is at
> play here.
> 
> Reported-by: Andrzej Hajda <a.hajda@samsung.com>
> Signed-off-by: Peter Rosin <peda@axentia.se>

lgtm, Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

btw plan to stick around a bit in drm land, i.e. want commit rights for
drm-misc?
-Daniel

> ---
>  drivers/gpu/drm/bridge/lvds-encoder.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
> index 36d8557bc097..584007eaf6e1 100644
> --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> @@ -36,8 +36,7 @@ static void lvds_encoder_enable(struct drm_bridge *bridge)
>  							 struct lvds_encoder,
>  							 bridge);
>  
> -	if (lvds_encoder->powerdown_gpio)
> -		gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0);
> +	gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0);
>  }
>  
>  static void lvds_encoder_disable(struct drm_bridge *bridge)
> @@ -46,8 +45,7 @@ static void lvds_encoder_disable(struct drm_bridge *bridge)
>  							 struct lvds_encoder,
>  							 bridge);
>  
> -	if (lvds_encoder->powerdown_gpio)
> -		gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1);
> +	gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1);
>  }
>  
>  static struct drm_bridge_funcs funcs = {
> -- 
> 2.11.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Laurent Pinchart Jan. 22, 2019, 9:04 p.m. UTC | #2
Hi Peter,

Thank you for the patch.

On Fri, Jan 18, 2019 at 11:11:38PM +0000, Peter Rosin wrote:
> The gpio API explicitly allows skipping the NULL check, precisely to
> allow for neat support for optional gpios. Which is exactly what is at
> play here.
> 
> Reported-by: Andrzej Hajda <a.hajda@samsung.com>
> Signed-off-by: Peter Rosin <peda@axentia.se>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/bridge/lvds-encoder.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
> index 36d8557bc097..584007eaf6e1 100644
> --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> @@ -36,8 +36,7 @@ static void lvds_encoder_enable(struct drm_bridge *bridge)
>  							 struct lvds_encoder,
>  							 bridge);
>  
> -	if (lvds_encoder->powerdown_gpio)
> -		gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0);
> +	gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0);
>  }
>  
>  static void lvds_encoder_disable(struct drm_bridge *bridge)
> @@ -46,8 +45,7 @@ static void lvds_encoder_disable(struct drm_bridge *bridge)
>  							 struct lvds_encoder,
>  							 bridge);
>  
> -	if (lvds_encoder->powerdown_gpio)
> -		gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1);
> +	gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1);
>  }
>  
>  static struct drm_bridge_funcs funcs = {
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
index 36d8557bc097..584007eaf6e1 100644
--- a/drivers/gpu/drm/bridge/lvds-encoder.c
+++ b/drivers/gpu/drm/bridge/lvds-encoder.c
@@ -36,8 +36,7 @@  static void lvds_encoder_enable(struct drm_bridge *bridge)
 							 struct lvds_encoder,
 							 bridge);
 
-	if (lvds_encoder->powerdown_gpio)
-		gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0);
+	gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0);
 }
 
 static void lvds_encoder_disable(struct drm_bridge *bridge)
@@ -46,8 +45,7 @@  static void lvds_encoder_disable(struct drm_bridge *bridge)
 							 struct lvds_encoder,
 							 bridge);
 
-	if (lvds_encoder->powerdown_gpio)
-		gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1);
+	gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1);
 }
 
 static struct drm_bridge_funcs funcs = {