[PATCH] 2.4.9-ac5: drivers/sound/trident.c

From: Frank Davis (fdavis@si.rr.com)
Date: Sat Sep 01 2001 - 22:29:36 EST


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


--- 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;
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 07 2001 - 21:00:13 EST