[PATCH 6/8] drm/nouveau: Use drm_for_each_connector_encoder_ids()

Ville Syrjala ville.syrjala at linux.intel.com
Tue Jun 26 17:47:12 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Use drm_for_each_connector_encoder_ids() for iterating
connector->encoder_ids[]. A bit more convenient not having
to deal with the implementation details.

Cc: Ben Skeggs <bskeggs at redhat.com>
Cc: nouveau at lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 7b557c354307..ea12fbbea92e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -366,14 +366,11 @@ find_encoder(struct drm_connector *connector, int type)
 	struct drm_device *dev = connector->dev;
 	struct nouveau_encoder *nv_encoder;
 	struct drm_encoder *enc;
-	int i, id;
+	u32 encoder_id;
+	int i;
 
-	for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
-		id = connector->encoder_ids[i];
-		if (!id)
-			break;
-
-		enc = drm_encoder_find(dev, NULL, id);
+	drm_for_each_connector_encoder_ids(connector, encoder_id, i) {
+		enc = drm_encoder_find(dev, NULL, encoder_id);
 		if (!enc)
 			continue;
 		nv_encoder = nouveau_encoder(enc);
@@ -423,6 +420,7 @@ nouveau_connector_ddc_detect(struct drm_connector *connector)
 	struct nouveau_encoder *nv_encoder;
 	struct drm_encoder *encoder;
 	int i, panel = -ENODEV;
+	u32 encoder_id;
 
 	/* eDP panels need powering on by us (if the VBIOS doesn't default it
 	 * to on) before doing any AUX channel transactions.  LVDS panel power
@@ -436,12 +434,8 @@ nouveau_connector_ddc_detect(struct drm_connector *connector)
 		}
 	}
 
-	for (i = 0; nv_encoder = NULL, i < DRM_CONNECTOR_MAX_ENCODER; i++) {
-		int id = connector->encoder_ids[i];
-		if (id == 0)
-			break;
-
-		encoder = drm_encoder_find(dev, NULL, id);
+	drm_for_each_connector_encoder_ids(connector, encoder_id, i) {
+		encoder = drm_encoder_find(dev, NULL, encoder_id);
 		if (!encoder)
 			continue;
 		nv_encoder = nouveau_encoder(encoder);
-- 
2.16.4



More information about the dri-devel mailing list