diff mbox

[v2,9/9] drm/tilcdc: Use drm_connector_has_possible_encoder()

Message ID 20180628131315.14156-10-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä June 28, 2018, 1:13 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Use drm_connector_has_possible_encoder() for checking
whether the encoder has an associated connector.

v2: Replace the drm_for_each_connector_encoder_ids() loop
    with a simple drm_connector_has_possible_encoder() call

Cc: Jyri Sarha <jsarha@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_external.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Jyri Sarha June 28, 2018, 1:45 p.m. UTC | #1
On 28/06/18 16:13, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Use drm_connector_has_possible_encoder() for checking
> whether the encoder has an associated connector.
> 
> v2: Replace the drm_for_each_connector_encoder_ids() loop
>     with a simple drm_connector_has_possible_encoder() call
> 
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Jyri Sarha <jsarha@ti.com>

I guess you are going to merge these at one go trough drm-misc.

> ---
>  drivers/gpu/drm/tilcdc/tilcdc_external.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> index d651bdd6597e..b4eaf9bc87f8 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> @@ -103,12 +103,11 @@ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
>  						    struct drm_encoder *encoder)
>  {
>  	struct drm_connector *connector;
> -	int i;
>  
> -	list_for_each_entry(connector, &ddev->mode_config.connector_list, head)
> -		for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++)
> -			if (connector->encoder_ids[i] == encoder->base.id)
> -				return connector;
> +	list_for_each_entry(connector, &ddev->mode_config.connector_list, head) {
> +		if (drm_connector_has_possible_encoder(connector, encoder))
> +			return connector;
> +	}
>  
>  	dev_err(ddev->dev, "No connector found for %s encoder (id %d)\n",
>  		encoder->name, encoder->base.id);
>
Ville Syrjälä June 28, 2018, 5:52 p.m. UTC | #2
On Thu, Jun 28, 2018 at 04:45:50PM +0300, Jyri Sarha wrote:
> On 28/06/18 16:13, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Use drm_connector_has_possible_encoder() for checking
> > whether the encoder has an associated connector.
> > 
> > v2: Replace the drm_for_each_connector_encoder_ids() loop
> >     with a simple drm_connector_has_possible_encoder() call
> > 
> > Cc: Jyri Sarha <jsarha@ti.com>
> > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Acked-by: Jyri Sarha <jsarha@ti.com>
> 
> I guess you are going to merge these at one go trough drm-misc.

That's the plan. Thanks for the ack.

> 
> > ---
> >  drivers/gpu/drm/tilcdc/tilcdc_external.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> > index d651bdd6597e..b4eaf9bc87f8 100644
> > --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
> > +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> > @@ -103,12 +103,11 @@ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
> >  						    struct drm_encoder *encoder)
> >  {
> >  	struct drm_connector *connector;
> > -	int i;
> >  
> > -	list_for_each_entry(connector, &ddev->mode_config.connector_list, head)
> > -		for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++)
> > -			if (connector->encoder_ids[i] == encoder->base.id)
> > -				return connector;
> > +	list_for_each_entry(connector, &ddev->mode_config.connector_list, head) {
> > +		if (drm_connector_has_possible_encoder(connector, encoder))
> > +			return connector;
> > +	}
> >  
> >  	dev_err(ddev->dev, "No connector found for %s encoder (id %d)\n",
> >  		encoder->name, encoder->base.id);
> > 
> 
> 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff mbox

Patch

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
index d651bdd6597e..b4eaf9bc87f8 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
@@ -103,12 +103,11 @@  struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
 						    struct drm_encoder *encoder)
 {
 	struct drm_connector *connector;
-	int i;
 
-	list_for_each_entry(connector, &ddev->mode_config.connector_list, head)
-		for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++)
-			if (connector->encoder_ids[i] == encoder->base.id)
-				return connector;
+	list_for_each_entry(connector, &ddev->mode_config.connector_list, head) {
+		if (drm_connector_has_possible_encoder(connector, encoder))
+			return connector;
+	}
 
 	dev_err(ddev->dev, "No connector found for %s encoder (id %d)\n",
 		encoder->name, encoder->base.id);