diff mbox

[2/2] drm/i915: Add locks around audio component bind/unbind

Message ID 1441273895-31153-3-git-send-email-david.henningsson@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Henningsson Sept. 3, 2015, 9:51 a.m. UTC
This will make sure that audio callbacks do not race with
component bind/unbind.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 drivers/gpu/drm/i915/intel_audio.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Takashi Iwai Sept. 3, 2015, 10:08 a.m. UTC | #1
On Thu, 03 Sep 2015 11:51:35 +0200,
David Henningsson wrote:
> 
> This will make sure that audio callbacks do not race with
> component bind/unbind.
> 
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>

Applied, thanks.


Takashi

> ---
>  drivers/gpu/drm/i915/intel_audio.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index 2d52d96..678a34f 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -543,9 +543,11 @@ static int i915_audio_component_bind(struct device *i915_dev,
>  	if (WARN_ON(acomp->ops || acomp->dev))
>  		return -EEXIST;
>  
> +	drm_modeset_lock_all(dev_priv->dev);
>  	acomp->ops = &i915_audio_component_ops;
>  	acomp->dev = i915_dev;
>  	dev_priv->audio_component = acomp;
> +	drm_modeset_unlock_all(dev_priv->dev);
>  
>  	return 0;
>  }
> @@ -556,9 +558,11 @@ static void i915_audio_component_unbind(struct device *i915_dev,
>  	struct i915_audio_component *acomp = data;
>  	struct drm_i915_private *dev_priv = dev_to_i915(i915_dev);
>  
> +	drm_modeset_lock_all(dev_priv->dev);
>  	acomp->ops = NULL;
>  	acomp->dev = NULL;
>  	dev_priv->audio_component = NULL;
> +	drm_modeset_unlock_all(dev_priv->dev);
>  }
>  
>  static const struct component_ops i915_audio_component_bind_ops = {
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index 2d52d96..678a34f 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -543,9 +543,11 @@  static int i915_audio_component_bind(struct device *i915_dev,
 	if (WARN_ON(acomp->ops || acomp->dev))
 		return -EEXIST;
 
+	drm_modeset_lock_all(dev_priv->dev);
 	acomp->ops = &i915_audio_component_ops;
 	acomp->dev = i915_dev;
 	dev_priv->audio_component = acomp;
+	drm_modeset_unlock_all(dev_priv->dev);
 
 	return 0;
 }
@@ -556,9 +558,11 @@  static void i915_audio_component_unbind(struct device *i915_dev,
 	struct i915_audio_component *acomp = data;
 	struct drm_i915_private *dev_priv = dev_to_i915(i915_dev);
 
+	drm_modeset_lock_all(dev_priv->dev);
 	acomp->ops = NULL;
 	acomp->dev = NULL;
 	dev_priv->audio_component = NULL;
+	drm_modeset_unlock_all(dev_priv->dev);
 }
 
 static const struct component_ops i915_audio_component_bind_ops = {