drm/connector: Allow max possible encoders to attach to a connector
[sfrench/cifs-2.6.git] / drivers / gpu / drm / drm_probe_helper.c
index dd427c7ff96771f8170fe0572038b21dfa4f2b69..a7c87abe88d0b2230efba8b6972271cbf44c4838 100644 (file)
 #include <linux/export.h>
 #include <linux/moduleparam.h>
 
-#include <drm/drmP.h>
+#include <drm/drm_bridge.h>
 #include <drm/drm_client.h>
 #include <drm/drm_crtc.h>
-#include <drm/drm_fourcc.h>
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_edid.h>
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_modeset_helper_vtables.h>
+#include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_sysfs.h>
 
 #include "drm_crtc_helper_internal.h"
 
@@ -91,7 +93,6 @@ drm_mode_validate_pipeline(struct drm_display_mode *mode,
        struct drm_device *dev = connector->dev;
        enum drm_mode_status ret = MODE_OK;
        struct drm_encoder *encoder;
-       int i;
 
        /* Step 1: Validate against connector */
        ret = drm_connector_mode_valid(connector, mode);
@@ -99,7 +100,7 @@ drm_mode_validate_pipeline(struct drm_display_mode *mode,
                return ret;
 
        /* Step 2: Validate against encoders and crtcs */
-       drm_connector_for_each_possible_encoder(connector, encoder, i) {
+       drm_connector_for_each_possible_encoder(connector, encoder) {
                struct drm_crtc *crtc;
 
                ret = drm_encoder_mode_valid(encoder, mode);
@@ -581,6 +582,9 @@ static void output_poll_execute(struct work_struct *work)
        enum drm_connector_status old_status;
        bool repoll = false, changed;
 
+       if (!dev->mode_config.poll_enabled)
+               return;
+
        /* Pick up any changes detected by the probe functions. */
        changed = dev->mode_config.delayed_event;
        dev->mode_config.delayed_event = false;
@@ -735,7 +739,11 @@ EXPORT_SYMBOL(drm_kms_helper_poll_init);
  */
 void drm_kms_helper_poll_fini(struct drm_device *dev)
 {
-       drm_kms_helper_poll_disable(dev);
+       if (!dev->mode_config.poll_enabled)
+               return;
+
+       dev->mode_config.poll_enabled = false;
+       cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
 }
 EXPORT_SYMBOL(drm_kms_helper_poll_fini);