diff mbox series

[1/3] drm/dp/mst: Reduce nested ifs

Message ID 20190925141442.23236-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/dp/mst: Reduce nested ifs | expand

Commit Message

Ville Syrjälä Sept. 25, 2019, 2:14 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the nested ifs with a single if and a logical AND.

Cc: Lyude Paul <lyude@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Lucas De Marchi Sept. 25, 2019, 4:14 p.m. UTC | #1
On Wed, Sep 25, 2019 at 7:14 AM Ville Syrjala
<ville.syrjala@linux.intel.com> wrote:
>
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Replace the nested ifs with a single if and a logical AND.
>
> Cc: Lyude Paul <lyude@redhat.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

Lucas De Marchi

> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 97216099a718..e25597eb3ca1 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1123,11 +1123,11 @@ static void drm_dp_mst_put_payload_id(struct drm_dp_mst_topology_mgr *mgr,
>         clear_bit(vcpi - 1, &mgr->vcpi_mask);
>
>         for (i = 0; i < mgr->max_payloads; i++) {
> -               if (mgr->proposed_vcpis[i])
> -                       if (mgr->proposed_vcpis[i]->vcpi == vcpi) {
> -                               mgr->proposed_vcpis[i] = NULL;
> -                               clear_bit(i + 1, &mgr->payload_mask);
> -                       }
> +               if (mgr->proposed_vcpis[i] &&
> +                   mgr->proposed_vcpis[i]->vcpi == vcpi) {
> +                       mgr->proposed_vcpis[i] = NULL;
> +                       clear_bit(i + 1, &mgr->payload_mask);
> +               }
>         }
>         mutex_unlock(&mgr->payload_lock);
>  }
> --
> 2.21.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lyude Paul Sept. 25, 2019, 7:10 p.m. UTC | #2
Reviewed-by: Lyude Paul <lyude@redhat.com>

On Wed, 2019-09-25 at 17:14 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Replace the nested ifs with a single if and a logical AND.
> 
> Cc: Lyude Paul <lyude@redhat.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 97216099a718..e25597eb3ca1 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1123,11 +1123,11 @@ static void drm_dp_mst_put_payload_id(struct
> drm_dp_mst_topology_mgr *mgr,
>  	clear_bit(vcpi - 1, &mgr->vcpi_mask);
>  
>  	for (i = 0; i < mgr->max_payloads; i++) {
> -		if (mgr->proposed_vcpis[i])
> -			if (mgr->proposed_vcpis[i]->vcpi == vcpi) {
> -				mgr->proposed_vcpis[i] = NULL;
> -				clear_bit(i + 1, &mgr->payload_mask);
> -			}
> +		if (mgr->proposed_vcpis[i] &&
> +		    mgr->proposed_vcpis[i]->vcpi == vcpi) {
> +			mgr->proposed_vcpis[i] = NULL;
> +			clear_bit(i + 1, &mgr->payload_mask);
> +		}
>  	}
>  	mutex_unlock(&mgr->payload_lock);
>  }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 97216099a718..e25597eb3ca1 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1123,11 +1123,11 @@  static void drm_dp_mst_put_payload_id(struct drm_dp_mst_topology_mgr *mgr,
 	clear_bit(vcpi - 1, &mgr->vcpi_mask);
 
 	for (i = 0; i < mgr->max_payloads; i++) {
-		if (mgr->proposed_vcpis[i])
-			if (mgr->proposed_vcpis[i]->vcpi == vcpi) {
-				mgr->proposed_vcpis[i] = NULL;
-				clear_bit(i + 1, &mgr->payload_mask);
-			}
+		if (mgr->proposed_vcpis[i] &&
+		    mgr->proposed_vcpis[i]->vcpi == vcpi) {
+			mgr->proposed_vcpis[i] = NULL;
+			clear_bit(i + 1, &mgr->payload_mask);
+		}
 	}
 	mutex_unlock(&mgr->payload_lock);
 }