diff mbox series

[9/9] drm/i915/dvo: Make .get_modes() return the number of modes

Message ID 20200108181242.13650-9-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/9] drm/i915/sdvo: Reduce the size of the on stack buffers | expand

Commit Message

Ville Syrjala Jan. 8, 2020, 6:12 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

.get_modes() is supposed to return the number of modes added to the
probed_modes list (not that anyone actually checks for anything
except zero vs. not zero). Let's do that.

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

Comments

Imre Deak July 9, 2020, 11:52 a.m. UTC | #1
On Wed, Jan 08, 2020 at 08:12:42PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> .get_modes() is supposed to return the number of modes added to the
> probed_modes list (not that anyone actually checks for anything
> except zero vs. not zero). Let's do that.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dvo.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c b/drivers/gpu/drm/i915/display/intel_dvo.c
> index a74dc5b915d1..3ce9f72d12e5 100644
> --- a/drivers/gpu/drm/i915/display/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_dvo.c
> @@ -322,6 +322,7 @@ static int intel_dvo_get_modes(struct drm_connector *connector)
>  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
>  	const struct drm_display_mode *fixed_mode =
>  		to_intel_connector(connector)->panel.fixed_mode;
> +	int num_modes;
>  
>  	/*
>  	 * We should probably have an i2c driver get_modes function for those
> @@ -329,21 +330,22 @@ static int intel_dvo_get_modes(struct drm_connector *connector)
>  	 * (TV-out, for example), but for now with just TMDS and LVDS,
>  	 * that's not the case.
>  	 */
> -	intel_ddc_get_modes(connector,
> -			    intel_gmbus_get_adapter(dev_priv, GMBUS_PIN_DPC));
> -	if (!list_empty(&connector->probed_modes))
> -		return 1;
> +	num_modes = intel_ddc_get_modes(connector,
> +					intel_gmbus_get_adapter(dev_priv, GMBUS_PIN_DPC));
> +	if (num_modes)
> +		return num_modes;
>  
>  	if (fixed_mode) {
>  		struct drm_display_mode *mode;
> +
>  		mode = drm_mode_duplicate(connector->dev, fixed_mode);
>  		if (mode) {
>  			drm_mode_probed_add(connector, mode);
> -			return 1;
> +			num_modes++;
>  		}
>  	}
>  
> -	return 0;
> +	return num_modes;
>  }
>  
>  static const struct drm_connector_funcs intel_dvo_connector_funcs = {
> -- 
> 2.24.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c b/drivers/gpu/drm/i915/display/intel_dvo.c
index a74dc5b915d1..3ce9f72d12e5 100644
--- a/drivers/gpu/drm/i915/display/intel_dvo.c
+++ b/drivers/gpu/drm/i915/display/intel_dvo.c
@@ -322,6 +322,7 @@  static int intel_dvo_get_modes(struct drm_connector *connector)
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	const struct drm_display_mode *fixed_mode =
 		to_intel_connector(connector)->panel.fixed_mode;
+	int num_modes;
 
 	/*
 	 * We should probably have an i2c driver get_modes function for those
@@ -329,21 +330,22 @@  static int intel_dvo_get_modes(struct drm_connector *connector)
 	 * (TV-out, for example), but for now with just TMDS and LVDS,
 	 * that's not the case.
 	 */
-	intel_ddc_get_modes(connector,
-			    intel_gmbus_get_adapter(dev_priv, GMBUS_PIN_DPC));
-	if (!list_empty(&connector->probed_modes))
-		return 1;
+	num_modes = intel_ddc_get_modes(connector,
+					intel_gmbus_get_adapter(dev_priv, GMBUS_PIN_DPC));
+	if (num_modes)
+		return num_modes;
 
 	if (fixed_mode) {
 		struct drm_display_mode *mode;
+
 		mode = drm_mode_duplicate(connector->dev, fixed_mode);
 		if (mode) {
 			drm_mode_probed_add(connector, mode);
-			return 1;
+			num_modes++;
 		}
 	}
 
-	return 0;
+	return num_modes;
 }
 
 static const struct drm_connector_funcs intel_dvo_connector_funcs = {