drm/i915: use drm_connector_list_iter in intel_hotplug.c
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 1 Mar 2017 09:52:22 +0000 (10:52 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 8 Mar 2017 22:42:40 +0000 (23:42 +0100)
Nothing special, just rote conversion.

v2: Rebase onto the iter_get/put->iter_begin/end rename.

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301095226.30584-2-daniel.vetter@ffwll.ch
drivers/gpu/drm/i915/intel_hotplug.c

index ba763e7..7d21009 100644 (file)
@@ -150,16 +150,17 @@ static bool intel_hpd_irq_storm_detect(struct drm_i915_private *dev_priv,
 static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv)
 {
        struct drm_device *dev = &dev_priv->drm;
-       struct drm_mode_config *mode_config = &dev->mode_config;
        struct intel_connector *intel_connector;
        struct intel_encoder *intel_encoder;
        struct drm_connector *connector;
+       struct drm_connector_list_iter conn_iter;
        enum hpd_pin pin;
        bool hpd_disabled = false;
 
        lockdep_assert_held(&dev_priv->irq_lock);
 
-       list_for_each_entry(connector, &mode_config->connector_list, head) {
+       drm_connector_list_iter_begin(dev, &conn_iter);
+       drm_for_each_connector_iter(connector, &conn_iter) {
                if (connector->polled != DRM_CONNECTOR_POLL_HPD)
                        continue;
 
@@ -182,6 +183,7 @@ static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv)
                        | DRM_CONNECTOR_POLL_DISCONNECT;
                hpd_disabled = true;
        }
+       drm_connector_list_iter_end(&conn_iter);
 
        /* Enable polling and queue hotplug re-enabling. */
        if (hpd_disabled) {
@@ -197,7 +199,6 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
                container_of(work, typeof(*dev_priv),
                             hotplug.reenable_work.work);
        struct drm_device *dev = &dev_priv->drm;
-       struct drm_mode_config *mode_config = &dev->mode_config;
        int i;
 
        intel_runtime_pm_get(dev_priv);
@@ -205,13 +206,15 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
        spin_lock_irq(&dev_priv->irq_lock);
        for_each_hpd_pin(i) {
                struct drm_connector *connector;
+               struct drm_connector_list_iter conn_iter;
 
                if (dev_priv->hotplug.stats[i].state != HPD_DISABLED)
                        continue;
 
                dev_priv->hotplug.stats[i].state = HPD_ENABLED;
 
-               list_for_each_entry(connector, &mode_config->connector_list, head) {
+               drm_connector_list_iter_begin(dev, &conn_iter);
+               drm_for_each_connector_iter(connector, &conn_iter) {
                        struct intel_connector *intel_connector = to_intel_connector(connector);
 
                        if (intel_connector->encoder->hpd_pin == i) {
@@ -223,6 +226,7 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
                                        connector->polled = DRM_CONNECTOR_POLL_HPD;
                        }
                }
+               drm_connector_list_iter_end(&conn_iter);
        }
        if (dev_priv->display_irqs_enabled && dev_priv->display.hpd_irq_setup)
                dev_priv->display.hpd_irq_setup(dev_priv);
@@ -308,14 +312,14 @@ static void i915_hotplug_work_func(struct work_struct *work)
        struct drm_i915_private *dev_priv =
                container_of(work, struct drm_i915_private, hotplug.hotplug_work);
        struct drm_device *dev = &dev_priv->drm;
-       struct drm_mode_config *mode_config = &dev->mode_config;
        struct intel_connector *intel_connector;
        struct intel_encoder *intel_encoder;
        struct drm_connector *connector;
+       struct drm_connector_list_iter conn_iter;
        bool changed = false;
        u32 hpd_event_bits;
 
-       mutex_lock(&mode_config->mutex);
+       mutex_lock(&dev->mode_config.mutex);
        DRM_DEBUG_KMS("running encoder hotplug functions\n");
 
        spin_lock_irq(&dev_priv->irq_lock);
@@ -328,7 +332,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
 
        spin_unlock_irq(&dev_priv->irq_lock);
 
-       list_for_each_entry(connector, &mode_config->connector_list, head) {
+       drm_connector_list_iter_begin(dev, &conn_iter);
+       drm_for_each_connector_iter(connector, &conn_iter) {
                intel_connector = to_intel_connector(connector);
                if (!intel_connector->encoder)
                        continue;
@@ -342,7 +347,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
                                changed = true;
                }
        }
-       mutex_unlock(&mode_config->mutex);
+       drm_connector_list_iter_end(&conn_iter);
+       mutex_unlock(&dev->mode_config.mutex);
 
        if (changed)
                drm_kms_helper_hotplug_event(dev);
@@ -490,15 +496,16 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
                container_of(work, struct drm_i915_private,
                             hotplug.poll_init_work);
        struct drm_device *dev = &dev_priv->drm;
-       struct drm_mode_config *mode_config = &dev->mode_config;
        struct drm_connector *connector;
+       struct drm_connector_list_iter conn_iter;
        bool enabled;
 
        mutex_lock(&dev->mode_config.mutex);
 
        enabled = READ_ONCE(dev_priv->hotplug.poll_enabled);
 
-       list_for_each_entry(connector, &mode_config->connector_list, head) {
+       drm_connector_list_iter_begin(dev, &conn_iter);
+       drm_for_each_connector_iter(connector, &conn_iter) {
                struct intel_connector *intel_connector =
                        to_intel_connector(connector);
                connector->polled = intel_connector->polled;
@@ -516,6 +523,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
                                DRM_CONNECTOR_POLL_HPD;
                }
        }
+       drm_connector_list_iter_end(&conn_iter);
 
        if (enabled)
                drm_kms_helper_poll_enable(dev);