diff mbox

[4/7] drm: Flatten drm_mode_connector_list_update() a bit

Message ID 1449177255-9515-5-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Dec. 3, 2015, 9:14 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Use 'continue' to eliminate one indent level from
drm_mode_connector_list_update(). And while at it,
make 'found_it' bool.

Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_modes.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

Comments

Daniel Vetter Dec. 4, 2015, 8:19 a.m. UTC | #1
On Thu, Dec 03, 2015 at 11:14:12PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Use 'continue' to eliminate one indent level from
> drm_mode_connector_list_update(). And while at it,
> make 'found_it' bool.
> 
> Cc: Adam Jackson <ajax@redhat.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  drivers/gpu/drm/drm_modes.c | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 824125b3337f..2b94a5c661b0 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1183,30 +1183,30 @@ EXPORT_SYMBOL(drm_mode_sort);
>  void drm_mode_connector_list_update(struct drm_connector *connector,
>  				    bool merge_type_bits)
>  {
> -	struct drm_display_mode *mode;
>  	struct drm_display_mode *pmode, *pt;
> -	int found_it;
>  
>  	WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex));
>  
> -	list_for_each_entry_safe(pmode, pt, &connector->probed_modes,
> -				 head) {
> -		found_it = 0;
> +	list_for_each_entry_safe(pmode, pt, &connector->probed_modes, head) {
> +		struct drm_display_mode *mode;
> +		bool found_it = false;
> +
>  		/* go through current modes checking for the new probed mode */
>  		list_for_each_entry(mode, &connector->modes, head) {
> -			if (drm_mode_equal(pmode, mode)) {
> -				found_it = 1;
> -				/* if equal delete the probed mode */
> -				mode->status = pmode->status;
> -				/* Merge type bits together */
> -				if (merge_type_bits)
> -					mode->type |= pmode->type;
> -				else
> -					mode->type = pmode->type;
> -				list_del(&pmode->head);
> -				drm_mode_destroy(connector->dev, pmode);
> -				break;
> -			}
> +			if (!drm_mode_equal(pmode, mode))
> +				continue;
> +
> +			found_it = true;
> +			/* if equal delete the probed mode */
> +			mode->status = pmode->status;
> +			/* Merge type bits together */
> +			if (merge_type_bits)
> +				mode->type |= pmode->type;
> +			else
> +				mode->type = pmode->type;
> +			list_del(&pmode->head);
> +			drm_mode_destroy(connector->dev, pmode);
> +			break;
>  		}
>  
>  		if (!found_it) {
> -- 
> 2.4.10
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 824125b3337f..2b94a5c661b0 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1183,30 +1183,30 @@  EXPORT_SYMBOL(drm_mode_sort);
 void drm_mode_connector_list_update(struct drm_connector *connector,
 				    bool merge_type_bits)
 {
-	struct drm_display_mode *mode;
 	struct drm_display_mode *pmode, *pt;
-	int found_it;
 
 	WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex));
 
-	list_for_each_entry_safe(pmode, pt, &connector->probed_modes,
-				 head) {
-		found_it = 0;
+	list_for_each_entry_safe(pmode, pt, &connector->probed_modes, head) {
+		struct drm_display_mode *mode;
+		bool found_it = false;
+
 		/* go through current modes checking for the new probed mode */
 		list_for_each_entry(mode, &connector->modes, head) {
-			if (drm_mode_equal(pmode, mode)) {
-				found_it = 1;
-				/* if equal delete the probed mode */
-				mode->status = pmode->status;
-				/* Merge type bits together */
-				if (merge_type_bits)
-					mode->type |= pmode->type;
-				else
-					mode->type = pmode->type;
-				list_del(&pmode->head);
-				drm_mode_destroy(connector->dev, pmode);
-				break;
-			}
+			if (!drm_mode_equal(pmode, mode))
+				continue;
+
+			found_it = true;
+			/* if equal delete the probed mode */
+			mode->status = pmode->status;
+			/* Merge type bits together */
+			if (merge_type_bits)
+				mode->type |= pmode->type;
+			else
+				mode->type = pmode->type;
+			list_del(&pmode->head);
+			drm_mode_destroy(connector->dev, pmode);
+			break;
 		}
 
 		if (!found_it) {