public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: David Ford <david+challenge-response@blue-labs.org>,
	linux-kernel@vger.kernel.org
Subject: Re: sound driver (opti) spinlock bug, 2.6.7-rc3
Date: Mon, 14 Jun 2004 19:20:11 +0200	[thread overview]
Message-ID: <s5hr7sigipg.wl@alsa2.suse.de> (raw)
In-Reply-To: <20040612171947.31218266.akpm@osdl.org>

At Sat, 12 Jun 2004 17:19:47 -0700,
Andrew Morton wrote:
> 
> David Ford <david+challenge-response@blue-labs.org> wrote:
> >
> > sound/isa/opti9xx/opti92x-ad1848.c:428: 
> >  spin_lock(sound/isa/opti9xx/opti92x-ad1848.c:cf40eea0) already locked by 
> >  sound/isa/opti9xx/opti92x-ad1848.c/604
> 
> Like this?
> 
> The locking in there seems fairly optimistic - looks like someone did a
> cli() translation on it.

Oh my.  Apparently this driver has been never used/tested on
SMP/preempt practically since long ago.

I checked the code quickly now, and it Looks like it has other
deadlocks.  Could you try the patch below?


Takashi

--- linux/sound/isa/opti9xx/opti92x-ad1848.c	23 Apr 2004 15:01:17 -0000	1.40
+++ linux/sound/isa/opti9xx/opti92x-ad1848.c	14 Jun 2004 17:18:09 -0000
@@ -474,7 +474,6 @@ static int __devinit snd_opti9xx_configu
 	unsigned char dma_bits;
 	unsigned char mpu_port_bits = 0;
 	unsigned char mpu_irq_bits;
-	unsigned long flags;
 
 	switch (chip->hardware) {
 #ifndef OPTi93X
@@ -601,13 +600,11 @@ __skip_base:
 	dma_bits |= 0x04;
 #endif	/* CS4231 || OPTi93X */
 
-	spin_lock_irqsave(&chip->lock, flags);
 #ifndef OPTi93X
 	 outb(irq_bits << 3 | dma_bits, chip->wss_base);
 #else /* OPTi93X */
 	snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
 #endif /* OPTi93X */
-	spin_unlock_irqrestore(&chip->lock, flags);
 
 __skip_resources:
 	if (chip->hardware > OPTi9XX_HW_82C928) {
@@ -767,15 +764,10 @@ static void snd_opti93x_mce_down(opti93x
 
 static void snd_opti93x_mute(opti93x_t *chip, int mute)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&chip->lock, flags);
-
 	mute = mute ? 1 : 0;
-	if (chip->mute == mute) {
-		spin_unlock_irqrestore(&chip->lock, flags);
+	if (chip->mute == mute)
 		return;
-	}
+
 	chip->mute = mute;
 
 	snd_opti93x_mute_reg(chip, OPTi93X_CD_LEFT_INPUT, mute);
@@ -800,8 +792,6 @@ static void snd_opti93x_mute(opti93x_t *
 	snd_opti93x_mute_reg(chip, OPTi93X_MIC_RIGHT_INPUT, mute);
 	snd_opti93x_mute_reg(chip, OPTi93X_OUT_LEFT, mute);
 	snd_opti93x_mute_reg(chip, OPTi93X_OUT_RIGHT, mute);
-
-	spin_unlock_irqrestore(&chip->lock, flags);
 }
 
 
@@ -873,10 +863,8 @@ static unsigned char snd_opti93x_get_for
 
 static void snd_opti93x_playback_format(opti93x_t *chip, unsigned char fmt)
 {
-	unsigned long flags;
 	unsigned char mask;
 
-	spin_lock_irqsave(&chip->lock, flags);
 	snd_opti93x_mute(chip, 1);
 
 	snd_opti93x_mce_up(chip);
@@ -885,14 +873,10 @@ static void snd_opti93x_playback_format(
 	snd_opti93x_mce_down(chip);
 
 	snd_opti93x_mute(chip, 0);
-	spin_unlock_irqrestore(&chip->lock, flags);
 }
 
 static void snd_opti93x_capture_format(opti93x_t *chip, unsigned char fmt)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&chip->lock, flags);
 	snd_opti93x_mute(chip, 1);
 
 	snd_opti93x_mce_up(chip);
@@ -904,7 +888,6 @@ static void snd_opti93x_capture_format(o
 	snd_opti93x_mce_down(chip);
 
 	snd_opti93x_mute(chip, 0);
-	spin_unlock_irqrestore(&chip->lock, flags);
 }
 
 

      reply	other threads:[~2004-06-14 17:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-12 20:10 sound driver (opti) spinlock bug, 2.6.7-rc3 David Ford
2004-06-13  0:19 ` Andrew Morton
2004-06-14 17:20   ` Takashi Iwai [this message]

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=s5hr7sigipg.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=akpm@osdl.org \
    --cc=david+challenge-response@blue-labs.org \
    --cc=linux-kernel@vger.kernel.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