[2/2] drm/i915: Polish intel_tv_mode_valid()
diff mbox series

Message ID 20191001154629.11063-2-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/2] drm/i915: Limit MST modes based on plane size too
Related show

Commit Message

Ville Syrjälä Oct. 1, 2019, 3:46 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Drop the tv_mode NULL check since intel_tv_mode_find() never
actually returns NULL, and flip the condition around so that
the MODE_OK case is at the end, which is customary to all
the other .mode_valid() implementations.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_tv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Souza, Jose Oct. 1, 2019, 5:28 p.m. UTC | #1
On Tue, 2019-10-01 at 18:46 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Drop the tv_mode NULL check since intel_tv_mode_find() never
> actually returns NULL, and flip the condition around so that
> the MODE_OK case is at the end, which is customary to all
> the other .mode_valid() implementations.
> 

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_tv.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_tv.c
> b/drivers/gpu/drm/i915/display/intel_tv.c
> index b70221f5112a..71c3f7e5df7d 100644
> --- a/drivers/gpu/drm/i915/display/intel_tv.c
> +++ b/drivers/gpu/drm/i915/display/intel_tv.c
> @@ -961,11 +961,10 @@ intel_tv_mode_valid(struct drm_connector
> *connector,
>  		return MODE_CLOCK_HIGH;
>  
>  	/* Ensure TV refresh is close to desired refresh */
> -	if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) *
> 1000)
> -				< 1000)
> -		return MODE_OK;
> +	if (abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000) >=
> 1000)
> +		return MODE_CLOCK_RANGE;
>  
> -	return MODE_CLOCK_RANGE;
> +	return MODE_OK;
>  }
>  
>  static int

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
index b70221f5112a..71c3f7e5df7d 100644
--- a/drivers/gpu/drm/i915/display/intel_tv.c
+++ b/drivers/gpu/drm/i915/display/intel_tv.c
@@ -961,11 +961,10 @@  intel_tv_mode_valid(struct drm_connector *connector,
 		return MODE_CLOCK_HIGH;
 
 	/* Ensure TV refresh is close to desired refresh */
-	if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000)
-				< 1000)
-		return MODE_OK;
+	if (abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000) >= 1000)
+		return MODE_CLOCK_RANGE;
 
-	return MODE_CLOCK_RANGE;
+	return MODE_OK;
 }
 
 static int