[PATCH] 12/41 sound/oss/nm256_audio.c - convert cli to spinlocks

From: pwaechtler@mac.com
Date: Thu Aug 29 2002 - 14:56:27 EST


--- vanilla-2.5.32/sound/oss/nm256_audio.c Sat Apr 20 18:25:20 2002
+++ linux-2.5-cli-oss/sound/oss/nm256_audio.c Tue Aug 13 15:38:21 2002
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/pm.h>
 #include <linux/delay.h>
+#include <linux/spinlock.h>
 #include "sound_config.h"
 #include "nm256.h"
 #include "nm256_coeff.h"
@@ -262,8 +263,7 @@
         return;
     }
 
- save_flags (flags);
- cli ();
+ spin_lock_irqsave(&card->lock,flags);
     /*
      * If we're not currently recording, set up the start and end registers
      * for the recording engine.
@@ -283,7 +283,7 @@
         }
         else {
             /* Not sure what else to do here. */
- restore_flags (flags);
+ spin_unlock_irqrestore(&card->lock,flags);
             return;
         }
     }
@@ -303,7 +303,7 @@
         nm256_writePort8 (card, 2, NM_RECORD_ENABLE_REG,
                             NM_RECORD_ENABLE_FLAG | NM_RECORD_FREERUN);
 
- restore_flags (flags);
+ spin_unlock_irqrestore(&card->lock,flags);
 }
 
 /* Stop the play engine. */
@@ -370,8 +370,7 @@
 
     card->requested_amt = amt;
 
- save_flags (flags);
- cli ();
+ spin_lock_irqsave(&card->lock,flags);
 
     if ((card->curPlayPos + amt) >= ringsize) {
         u32 rem = ringsize - card->curPlayPos;
@@ -418,7 +417,7 @@
     if (! card->playing)
         startPlay (card);
 
- restore_flags (flags);
+ spin_unlock_irqrestore(&card->lock,flags);
 }
 
 /* We just got a card playback interrupt; process it. */
@@ -829,8 +828,7 @@
 
     base = card->mixer;
 
- save_flags (flags);
- cli ();
+ spin_lock_irqsave(&card->lock,flags);
 
     nm256_isReady (dev);
 
@@ -844,7 +842,7 @@
 
     }
 
- restore_flags (flags);
+ spin_unlock_irqrestore(&card->lock,flags);
     udelay (1000);
 
     return ! done;
@@ -1055,6 +1053,7 @@
     card->playing = 0;
     card->recording = 0;
     card->rev = rev;
+ spin_lock_init(&card->lock);
 
     /* Init the memory port info. */
     for (x = 0; x < 2; x++) {

-
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 : Sat Aug 31 2002 - 22:00:28 EST