Re: [PATCH 2/6] drm/i915: use drm_connector_list_iter in intel_hotplug.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 19-12-16 om 09:24 schreef Daniel Vetter:
> Nothing special, just rote conversion.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_hotplug.c | 28 ++++++++++++++++++----------
>  1 file changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
> index 3d546c019de0..2ddc9e5842ec 100644
> --- a/drivers/gpu/drm/i915/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/intel_hotplug.c
> @@ -145,16 +145,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;
>  
>  	assert_spin_locked(&dev_priv->irq_lock);
>  
> -	list_for_each_entry(connector, &mode_config->connector_list, head) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		if (connector->polled != DRM_CONNECTOR_POLL_HPD)
>  			continue;
This is called with irqs disabled, will lockdep complain about inconsistent use of this lock with and without irqs?

If not,

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> @@ -177,6 +178,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_put(&conn_iter);
>  
>  	/* Enable polling and queue hotplug re-enabling. */
>  	if (hpd_disabled) {
> @@ -192,7 +194,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);
> @@ -200,13 +201,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_get(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) {
> @@ -218,6 +221,7 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
>  					connector->polled = DRM_CONNECTOR_POLL_HPD;
>  			}
>  		}
> +		drm_connector_list_iter_put(&conn_iter);
>  	}
>  	if (dev_priv->display.hpd_irq_setup)
>  		dev_priv->display.hpd_irq_setup(dev_priv);
> @@ -303,14 +307,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);
> @@ -323,7 +327,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_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		intel_connector = to_intel_connector(connector);
>  		if (!intel_connector->encoder)
>  			continue;
> @@ -337,7 +342,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
>  				changed = true;
>  		}
>  	}
> -	mutex_unlock(&mode_config->mutex);
> +	drm_connector_list_iter_put(&conn_iter);
> +	mutex_unlock(&dev->mode_config.mutex);
>  
>  	if (changed)
>  		drm_kms_helper_hotplug_event(dev);
> @@ -483,15 +489,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_get(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;
> @@ -509,6 +516,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
>  				DRM_CONNECTOR_POLL_HPD;
>  		}
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>  
>  	if (enabled)
>  		drm_kms_helper_poll_enable_locked(dev);


_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux