提交 d5f362a7 编写于 作者: D David Henningsson 提交者: Takashi Iwai

drm/i915: Add locks around audio component bind/unbind

This will make sure that audio callbacks do not race with
component bind/unbind.

[Note: this is an update patch to commit [51e1d83c: drm/i915: Call
 audio pin/ELD notify function] where I mistakenly applied the older
 version.  Jani and Daniel's review tags were to the latest version,
 so I add them below, too -- tiwai]
Signed-off-by: NDavid Henningsson <david.henningsson@canonical.com>
Reviewed-by: NJani Nikula <jani.nikula@intel.com>
Acked-by: NDaniel Vetter <daniel@ffwll.ch>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 f0675d4a
...@@ -543,9 +543,11 @@ static int i915_audio_component_bind(struct device *i915_dev, ...@@ -543,9 +543,11 @@ static int i915_audio_component_bind(struct device *i915_dev,
if (WARN_ON(acomp->ops || acomp->dev)) if (WARN_ON(acomp->ops || acomp->dev))
return -EEXIST; return -EEXIST;
drm_modeset_lock_all(dev_priv->dev);
acomp->ops = &i915_audio_component_ops; acomp->ops = &i915_audio_component_ops;
acomp->dev = i915_dev; acomp->dev = i915_dev;
dev_priv->audio_component = acomp; dev_priv->audio_component = acomp;
drm_modeset_unlock_all(dev_priv->dev);
return 0; return 0;
} }
...@@ -556,9 +558,11 @@ static void i915_audio_component_unbind(struct device *i915_dev, ...@@ -556,9 +558,11 @@ static void i915_audio_component_unbind(struct device *i915_dev,
struct i915_audio_component *acomp = data; struct i915_audio_component *acomp = data;
struct drm_i915_private *dev_priv = dev_to_i915(i915_dev); struct drm_i915_private *dev_priv = dev_to_i915(i915_dev);
drm_modeset_lock_all(dev_priv->dev);
acomp->ops = NULL; acomp->ops = NULL;
acomp->dev = NULL; acomp->dev = NULL;
dev_priv->audio_component = NULL; dev_priv->audio_component = NULL;
drm_modeset_unlock_all(dev_priv->dev);
} }
static const struct component_ops i915_audio_component_bind_ops = { static const struct component_ops i915_audio_component_bind_ops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册