Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Irestal <andreas.irestal@axis.com>
To: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: [PATCH] ASoC: codecs: tlv320aic3x: Remove deadlock from snd_soc_dapm_put_volsw_aic3x()
Date: Wed, 5 Jun 2013 08:49:47 +0200	[thread overview]
Message-ID: <201306050849.47726.Andreas.Irestal@axis.com> (raw)

From: Andreas Irestål <Andreas.Irestal@axis.com>

When calling snd_soc_dapm_sync(), it eventually tries to lock the same mutex
already locked in snd_soc_dapm_put_volsw_aic3x() and a deadlock occurs. By
moving the mutex unlock to just before snd_soc_dapm_sync(), this deadlock is
prevented. This problem was introduced in Linux 3.5

Signed-off-by: Andreas Irestål <Andreas.Irestal@axis.com>
---
 sound/soc/codecs/tlv320aic3x.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 65d09d6..1514bf8 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -187,14 +187,14 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
 
 			break;
 		}
-
-		if (found)
-			snd_soc_dapm_sync(widget->dapm);
 	}
 
-	ret = snd_soc_update_bits(widget->codec, reg, val_mask, val);
-
 	mutex_unlock(&widget->codec->mutex);
+
+	if (found)
+		snd_soc_dapm_sync(widget->dapm);
+
+	ret = snd_soc_update_bits_locked(widget->codec, reg, val_mask, val);
 	return ret;
 }
 

             reply	other threads:[~2013-06-05  6:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05  6:49 Andreas Irestal [this message]
2013-06-07 16:56 ` [PATCH] ASoC: codecs: tlv320aic3x: Remove deadlock from snd_soc_dapm_put_volsw_aic3x() Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201306050849.47726.Andreas.Irestal@axis.com \
    --to=andreas.irestal@axis.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox