drm/i915: Polish intel_tv_mode_valid()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Oct 2019 15:46:29 +0000 (18:46 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 2 Oct 2019 14:21:48 +0000 (17:21 +0300)
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>
Link: https://patchwork.freedesktop.org/patch/msgid/20191001154629.11063-2-ville.syrjala@linux.intel.com
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
drivers/gpu/drm/i915/display/intel_tv.c

index b70221f5112a78179d1885fd3d011cbcb55eb6dd..71c3f7e5df7d26848271d96818ef1a9d7c2c1947 100644 (file)
@@ -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