Re: [PATCH 3/6] drm/i915: use drm_connector_list_iter in intel_opregion.c

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

 



On Mon, Dec 19, 2016 at 09:24:20AM +0100, Daniel Vetter wrote:
> One case where I nuked a now unecessary locking, otherwise all just
> boring stuff.

Forgot to update the commit message:

"Note that we can't drop the connection_mutex in asle_set_backlight
because the backlight functions need that (they look at connector->state
to figure out the pipe). Otherwise all boring stuff."

I fixed the patch, but not the original commit message ;-)
-Daniel

> 
> Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_opregion.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index f4429f67a4e3..d586ff9a66ce 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -434,6 +434,7 @@ int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
>  static u32 asle_set_backlight(struct drm_i915_private *dev_priv, u32 bclp)
>  {
>  	struct intel_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	struct opregion_asle *asle = dev_priv->opregion.asle;
>  	struct drm_device *dev = &dev_priv->drm;
>  
> @@ -458,8 +459,10 @@ static u32 asle_set_backlight(struct drm_i915_private *dev_priv, u32 bclp)
>  	 * only one).
>  	 */
>  	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
> -	for_each_intel_connector(dev, connector)
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	for_each_intel_connector_iter(connector, &conn_iter)
>  		intel_panel_set_backlight_acpi(connector, bclp, 255);
> +	drm_connector_list_iter_put(&conn_iter);
>  	asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
>  
>  	drm_modeset_unlock(&dev->mode_config.connection_mutex);
> @@ -701,6 +704,7 @@ static void intel_didl_outputs(struct drm_i915_private *dev_priv)
>  {
>  	struct intel_opregion *opregion = &dev_priv->opregion;
>  	struct intel_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	int i = 0, max_outputs;
>  	int display_index[16] = {};
>  
> @@ -714,7 +718,8 @@ static void intel_didl_outputs(struct drm_i915_private *dev_priv)
>  	max_outputs = ARRAY_SIZE(opregion->acpi->didl) +
>  		ARRAY_SIZE(opregion->acpi->did2);
>  
> -	for_each_intel_connector(&dev_priv->drm, connector) {
> +	drm_connector_list_iter_get(&dev_priv->drm, &conn_iter);
> +	for_each_intel_connector_iter(connector, &conn_iter) {
>  		u32 device_id, type;
>  
>  		device_id = acpi_display_type(connector);
> @@ -729,6 +734,7 @@ static void intel_didl_outputs(struct drm_i915_private *dev_priv)
>  			set_did(opregion, i, device_id);
>  		i++;
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>  
>  	DRM_DEBUG_KMS("%d outputs detected\n", i);
>  
> @@ -745,6 +751,7 @@ static void intel_setup_cadls(struct drm_i915_private *dev_priv)
>  {
>  	struct intel_opregion *opregion = &dev_priv->opregion;
>  	struct intel_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	int i = 0;
>  
>  	/*
> @@ -757,11 +764,13 @@ static void intel_setup_cadls(struct drm_i915_private *dev_priv)
>  	 * Note that internal panels should be at the front of the connector
>  	 * list already, ensuring they're not left out.
>  	 */
> -	for_each_intel_connector(&dev_priv->drm, connector) {
> +	drm_connector_list_iter_get(&dev_priv->drm, &conn_iter);
> +	for_each_intel_connector_iter(connector, &conn_iter) {
>  		if (i >= ARRAY_SIZE(opregion->acpi->cadl))
>  			break;
>  		opregion->acpi->cadl[i++] = connector->acpi_device_id;
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>  
>  	/* If fewer than 8 active devices, the list must be null terminated */
>  	if (i < ARRAY_SIZE(opregion->acpi->cadl))
> -- 
> 2.11.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
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