alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: ian_minett@creativelabs.com
To: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org, Ian Minett <ian_minett@creativelabs.com>
Subject: [PATCH - CA0132 HDA Codec 2/2] Change spin_lock()/unlock() to spin_lock_irqsave()/restore() in azx_pcm_trigger(). This prevents deadlock when an interrupt occurs, caused by chip->reg_lock contention.
Date: Fri, 13 Jul 2012 16:44:29 -0700	[thread overview]
Message-ID: <1342223070-25852-2-git-send-email-ian_minett@creativelabs.com> (raw)
In-Reply-To: <1342223070-25852-1-git-send-email-ian_minett@creativelabs.com>

From: Ian Minett <ian_minett@creativelabs.com>


Signed-off-by: Ian Minett <ian_minett@creativelabs.com>

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 796472d..0ccffde 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -551,6 +551,7 @@ enum {
 	(AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY | AZX_DCAPS_NO_MSI |\
 	 AZX_DCAPS_ALIGN_BUFSIZE)
 
+/* quirks for Creative CTHDA */
 #define AZX_DCAPS_PRESET_CTHDA \
 	(AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_4K_BDLE_BOUNDARY)
 
@@ -1930,6 +1931,7 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 	struct snd_pcm_substream *s;
 	int rstart = 0, start, nsync = 0, sbits = 0;
 	int nwait, timeout;
+	unsigned long flags;
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
@@ -1956,7 +1958,7 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 		snd_pcm_trigger_done(s, substream);
 	}
 
-	spin_lock(&chip->reg_lock);
+	spin_lock_irqsave(&chip->reg_lock, flags);
 	if (nsync > 1) {
 		/* first, set SYNC bits of corresponding streams */
 		if (chip->driver_caps & AZX_DCAPS_OLD_SSYNC)
@@ -1980,7 +1982,7 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 		}
 		azx_dev->running = start;
 	}
-	spin_unlock(&chip->reg_lock);
+	spin_unlock_irqrestore(&chip->reg_lock, flags);
 	if (start) {
 		if (nsync == 1)
 			return 0;
-- 
1.7.4.1

       reply	other threads:[~2012-07-13 23:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1342223070-25852-1-git-send-email-ian_minett@creativelabs.com>
2012-07-13 23:44 ` ian_minett [this message]
2012-07-16 10:18 ` [PATCH - CA0132 HDA Codec 1/2] ALSA: Update Creative CA0132 codec to add DSP features Takashi Iwai
2012-07-25 18:01   ` [PATCHv2 " Ian Minett
2012-07-25 18:01     ` [PATCHv2 - CA0132 HDA Codec 2/2] Change spin_lock()/unlock() to spin_lock_irqsave()/restore() Ian Minett
2012-07-26  8:06     ` [PATCHv2 - CA0132 HDA Codec 1/2] ALSA: Update Creative CA0132 codec to add DSP features Takashi Iwai
     [not found]       ` <OF0CFC3DA9.A9100453-ON88257A48.006BF087-88257A48.006FCB42@cli.creative.com>
2012-07-28  5:57         ` Takashi Iwai
     [not found]           ` <OF301523C9.1A0D8E05-ON88257A4B.0074BC06-88257A4B.007D5630@cli.creative.com>
2012-07-31 15:15             ` Takashi Iwai
2012-08-01  2:38               ` Ian Minett
2012-08-01  5:48                 ` Takashi Iwai
2012-08-04  3:29                   ` Ian Minett
2012-08-04  7:29                     ` Takashi Iwai
2012-08-08  0:27                       ` Ian Minett
2012-08-08  7:22                         ` Takashi Iwai
     [not found]                           ` <1344665872-15537-1-git-send-email-ian_minett@creativelabs.com>
2012-08-11  6:17                             ` [PATCHv2.1-CA0132 HDA Codec 2/2] Add DSP loader code to CA0132 codec Ian Minett
2012-08-11  7:12                               ` Takashi Iwai
2012-08-13 23:04                                 ` Ian Minett
2012-08-15  5:50                                 ` [PATCHv2.1-CA0132 HDA Codec 1/1] Draft DSP loader update #2 Ian Minett
2012-08-15  7:06                                   ` Takashi Iwai
2012-08-22  1:36                                     ` Ian Minett
2012-08-22 13:39                                       ` Takashi Iwai
2012-08-11  7:19                             ` [PATCHv2.1-CA0132 HDA Codec 1/2] Add DSP loader code to CA0132 codec Takashi Iwai

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=1342223070-25852-2-git-send-email-ian_minett@creativelabs.com \
    --to=ian_minett@creativelabs.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=patch@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;
as well as URLs for NNTP newsgroup(s).