@@ -448,9 +448,11 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
struct drm_device *dev = intel_dig_port->base.base.dev;
+ struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_connector *intel_connector;
struct drm_connector *connector;
- int i, ret;
+ enum pipe p;
+ int ret;
intel_connector = intel_connector_alloc();
if (!intel_connector)
@@ -470,8 +472,8 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
intel_connector->mst_port = intel_dp;
intel_connector->port = port;
- for (i = PIPE_A; i <= PIPE_C; i++) {
- struct drm_encoder *enc = &intel_dp->mst_encoders[i]->base.base;
+ for_each_pipe(dev_priv, p) {
+ struct drm_encoder *enc = &intel_dp->mst_encoders[p]->base.base;
ret = drm_mode_connector_attach_encoder(&intel_connector->base,
enc);
@@ -580,11 +582,14 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum
static bool
intel_dp_create_fake_mst_encoders(struct intel_digital_port *intel_dig_port)
{
- int i;
+ struct drm_device *dev = intel_dig_port->base.base.dev;
+ struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_dp *intel_dp = &intel_dig_port->dp;
+ enum pipe p;
- for (i = PIPE_A; i <= PIPE_C; i++)
- intel_dp->mst_encoders[i] = intel_dp_create_fake_mst_encoder(intel_dig_port, i);
+ for_each_pipe(dev_priv, p)
+ intel_dp->mst_encoders[p] =
+ intel_dp_create_fake_mst_encoder(intel_dig_port, p);
return true;
}
Use the helper instead of manually looping through pipes. Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: James Ausmus <james.ausmus@intel.com> --- drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)