All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Davis <fdavis@si.rr.com>
To: linux-kernel@vger.kernel.org
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] 2.4.9-ac5: drivers/sound/trident.c
Date: Sat, 01 Sep 2001 23:29:36 -0400	[thread overview]
Message-ID: <3B91A7A0.4020904@si.rr.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

Hello,
   The attached patch addresses a locking concern with the trident 
driver. Please apply and test. It is against 2.4.9-ac5 . Thanks.
Regards,
Frank

[-- Attachment #2: TRIDENTP --]
[-- Type: text/plain, Size: 1647 bytes --]

--- drivers/sound/trident.c.old	Thu Aug 30 21:42:58 2001
+++ drivers/sound/trident.c	Sat Sep  1 23:04:34 2001
@@ -37,6 +37,8 @@
  *
  *  History
  *  v0.14.9c
+ *	September 1 2001 Frank Davis <fdavis112@juno.com>
+ *	added spinlock to SNDCTL_DSP_RESET
  *	August 10 2001 Peter Wächtler <pwaechtler@loewe-komp.de>
  *	added support for Tvia (formerly Integraphics/IGST) CyberPro5050
  *	this chip is often found in settop boxes (combined video+audio)
@@ -703,8 +705,7 @@
  	 *	clash with another cyberpro config event
  	 */
  
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&card->lock, flags);
 	portDat = cyber_inidx(CYBER_PORT_AUDIO, CYBER_IDX_AUDIO_ENABLE);
 	/* enable, if it was disabled */
 	if( (portDat & CYBER_BMSK_AUENZ) != CYBER_BMSK_AUENZ_ENABLE ) {
@@ -729,7 +730,7 @@
 		cyber_outidx( CYBER_PORT_AUDIO, 0xb3, 0x06 );
 		cyber_outidx( CYBER_PORT_AUDIO, 0xbf, 0x00 );
 	}
-	restore_flags(flags);
+	spin_unlock_irqrestore(&card->lock, flags);
 	return ret;
 }
 
@@ -2098,20 +2099,23 @@
 		break;
 		
 	case SNDCTL_DSP_RESET:
-		/* FIXME: spin_lock ? */
 		if (file->f_mode & FMODE_WRITE) {
 			stop_dac(state);
 			synchronize_irq();
 			dmabuf->ready = 0;
+			spin_lock_irqsave(&card->lock, flags);
 			dmabuf->swptr = dmabuf->hwptr = 0;
 			dmabuf->count = dmabuf->total_bytes = 0;
+			spin_unlock_irqrestore(&card->lock, flags);
 		}
 		if (file->f_mode & FMODE_READ) {
 			stop_adc(state);
 			synchronize_irq();
 			dmabuf->ready = 0;
+			spin_lock_irqsave(&card->lock, flags);
 			dmabuf->swptr = dmabuf->hwptr = 0;
 			dmabuf->count = dmabuf->total_bytes = 0;
+			spin_unlock_irqrestore(&card->lock, flags);
 		}
 		break;
 

             reply	other threads:[~2001-09-02  3:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-02  3:29 Frank Davis [this message]
2001-09-02 12:59 ` [PATCH] 2.4.9-ac5: drivers/sound/trident.c Alan Cox

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=3B91A7A0.4020904@si.rr.com \
    --to=fdavis@si.rr.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.