]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Create a intel_encoder_find_connector helper function.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 23 Aug 2016 14:18:07 +0000 (16:18 +0200)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Wed, 24 Aug 2016 07:49:10 +0000 (09:49 +0200)
This makes the code in intel_sanitize_encoder slightly more readable.
This was meant to be addressed in fd6bbda9c7a4, but I missed that
review comment.

Fixes: fd6bbda9c7a4 ("drm/i915: Pass crtc_state and connector_state to encoder functions")
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1471961888-10771-1-git-send-email-maarten.lankhorst@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[mlankhorst: Fix unused variable reported by kbuild.]

drivers/gpu/drm/i915/intel_display.c

index 2dd2c0e9ae3246ecad1ee25ce1b149493ffda509..b747402ab310507b0dc2feee7a00026107f8d616 100644 (file)
@@ -16423,6 +16423,17 @@ static bool intel_crtc_has_encoders(struct intel_crtc *crtc)
        return false;
 }
 
+static struct intel_connector *intel_encoder_find_connector(struct intel_encoder *encoder)
+{
+       struct drm_device *dev = encoder->base.dev;
+       struct intel_connector *connector;
+
+       for_each_connector_on_encoder(dev, &encoder->base, connector)
+               return connector;
+
+       return NULL;
+}
+
 static bool has_pch_trancoder(struct drm_i915_private *dev_priv,
                              enum transcoder pch_transcoder)
 {
@@ -16525,8 +16536,6 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
 static void intel_sanitize_encoder(struct intel_encoder *encoder)
 {
        struct intel_connector *connector;
-       struct drm_device *dev = encoder->base.dev;
-       bool found_connector = false;
 
        /* We need to check both for a crtc link (meaning that the
         * encoder is active and trying to read from a pipe) and the
@@ -16534,12 +16543,8 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
        bool has_active_crtc = encoder->base.crtc &&
                to_intel_crtc(encoder->base.crtc)->active;
 
-       for_each_connector_on_encoder(dev, &encoder->base, connector) {
-               found_connector = true;
-               break;
-       }
-
-       if (found_connector && !has_active_crtc) {
+       connector = intel_encoder_find_connector(encoder);
+       if (connector && !has_active_crtc) {
                DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n",
                              encoder->base.base.id,
                              encoder->base.name);