Commit cc3ca4f3 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: use drm_connector_list_iter in intel_hotplug.c

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: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301095226.30584-2-daniel.vetter@ffwll.ch
parent 3f6a5e1e
...@@ -150,16 +150,17 @@ static bool intel_hpd_irq_storm_detect(struct drm_i915_private *dev_priv, ...@@ -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) static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv)
{ {
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct drm_mode_config *mode_config = &dev->mode_config;
struct intel_connector *intel_connector; struct intel_connector *intel_connector;
struct intel_encoder *intel_encoder; struct intel_encoder *intel_encoder;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_connector_list_iter conn_iter;
enum hpd_pin pin; enum hpd_pin pin;
bool hpd_disabled = false; bool hpd_disabled = false;
lockdep_assert_held(&dev_priv->irq_lock); 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) if (connector->polled != DRM_CONNECTOR_POLL_HPD)
continue; continue;
...@@ -182,6 +183,7 @@ static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv) ...@@ -182,6 +183,7 @@ static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv)
| DRM_CONNECTOR_POLL_DISCONNECT; | DRM_CONNECTOR_POLL_DISCONNECT;
hpd_disabled = true; hpd_disabled = true;
} }
drm_connector_list_iter_end(&conn_iter);
/* Enable polling and queue hotplug re-enabling. */ /* Enable polling and queue hotplug re-enabling. */
if (hpd_disabled) { if (hpd_disabled) {
...@@ -197,7 +199,6 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work) ...@@ -197,7 +199,6 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
container_of(work, typeof(*dev_priv), container_of(work, typeof(*dev_priv),
hotplug.reenable_work.work); hotplug.reenable_work.work);
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct drm_mode_config *mode_config = &dev->mode_config;
int i; int i;
intel_runtime_pm_get(dev_priv); intel_runtime_pm_get(dev_priv);
...@@ -205,13 +206,15 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work) ...@@ -205,13 +206,15 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
for_each_hpd_pin(i) { for_each_hpd_pin(i) {
struct drm_connector *connector; struct drm_connector *connector;
struct drm_connector_list_iter conn_iter;
if (dev_priv->hotplug.stats[i].state != HPD_DISABLED) if (dev_priv->hotplug.stats[i].state != HPD_DISABLED)
continue; continue;
dev_priv->hotplug.stats[i].state = HPD_ENABLED; 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); struct intel_connector *intel_connector = to_intel_connector(connector);
if (intel_connector->encoder->hpd_pin == i) { if (intel_connector->encoder->hpd_pin == i) {
...@@ -223,6 +226,7 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work) ...@@ -223,6 +226,7 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
connector->polled = DRM_CONNECTOR_POLL_HPD; 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) if (dev_priv->display_irqs_enabled && dev_priv->display.hpd_irq_setup)
dev_priv->display.hpd_irq_setup(dev_priv); dev_priv->display.hpd_irq_setup(dev_priv);
...@@ -308,14 +312,14 @@ static void i915_hotplug_work_func(struct work_struct *work) ...@@ -308,14 +312,14 @@ static void i915_hotplug_work_func(struct work_struct *work)
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
container_of(work, struct drm_i915_private, hotplug.hotplug_work); container_of(work, struct drm_i915_private, hotplug.hotplug_work);
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct drm_mode_config *mode_config = &dev->mode_config;
struct intel_connector *intel_connector; struct intel_connector *intel_connector;
struct intel_encoder *intel_encoder; struct intel_encoder *intel_encoder;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_connector_list_iter conn_iter;
bool changed = false; bool changed = false;
u32 hpd_event_bits; u32 hpd_event_bits;
mutex_lock(&mode_config->mutex); mutex_lock(&dev->mode_config.mutex);
DRM_DEBUG_KMS("running encoder hotplug functions\n"); DRM_DEBUG_KMS("running encoder hotplug functions\n");
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
...@@ -328,7 +332,8 @@ static void i915_hotplug_work_func(struct work_struct *work) ...@@ -328,7 +332,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
spin_unlock_irq(&dev_priv->irq_lock); 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); intel_connector = to_intel_connector(connector);
if (!intel_connector->encoder) if (!intel_connector->encoder)
continue; continue;
...@@ -342,7 +347,8 @@ static void i915_hotplug_work_func(struct work_struct *work) ...@@ -342,7 +347,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
changed = true; changed = true;
} }
} }
mutex_unlock(&mode_config->mutex); drm_connector_list_iter_end(&conn_iter);
mutex_unlock(&dev->mode_config.mutex);
if (changed) if (changed)
drm_kms_helper_hotplug_event(dev); drm_kms_helper_hotplug_event(dev);
...@@ -490,15 +496,16 @@ static void i915_hpd_poll_init_work(struct work_struct *work) ...@@ -490,15 +496,16 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
container_of(work, struct drm_i915_private, container_of(work, struct drm_i915_private,
hotplug.poll_init_work); hotplug.poll_init_work);
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct drm_mode_config *mode_config = &dev->mode_config;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_connector_list_iter conn_iter;
bool enabled; bool enabled;
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
enabled = READ_ONCE(dev_priv->hotplug.poll_enabled); 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 = struct intel_connector *intel_connector =
to_intel_connector(connector); to_intel_connector(connector);
connector->polled = intel_connector->polled; connector->polled = intel_connector->polled;
...@@ -516,6 +523,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work) ...@@ -516,6 +523,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
DRM_CONNECTOR_POLL_HPD; DRM_CONNECTOR_POLL_HPD;
} }
} }
drm_connector_list_iter_end(&conn_iter);
if (enabled) if (enabled)
drm_kms_helper_poll_enable(dev); drm_kms_helper_poll_enable(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment