Commit 8737c96b authored by Peter Wächtler's avatar Peter Wächtler Committed by Linus Torvalds

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

parent 23e6718a
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spinlock.h>
#include "sound_config.h" #include "sound_config.h"
#include "nm256.h" #include "nm256.h"
#include "nm256_coeff.h" #include "nm256_coeff.h"
...@@ -262,8 +263,7 @@ nm256_startRecording (struct nm256_info *card, char *buffer, u32 amt) ...@@ -262,8 +263,7 @@ nm256_startRecording (struct nm256_info *card, char *buffer, u32 amt)
return; return;
} }
save_flags (flags); spin_lock_irqsave(&card->lock,flags);
cli ();
/* /*
* If we're not currently recording, set up the start and end registers * If we're not currently recording, set up the start and end registers
* for the recording engine. * for the recording engine.
...@@ -283,7 +283,7 @@ nm256_startRecording (struct nm256_info *card, char *buffer, u32 amt) ...@@ -283,7 +283,7 @@ nm256_startRecording (struct nm256_info *card, char *buffer, u32 amt)
} }
else { else {
/* Not sure what else to do here. */ /* Not sure what else to do here. */
restore_flags (flags); spin_unlock_irqrestore(&card->lock,flags);
return; return;
} }
} }
...@@ -303,7 +303,7 @@ nm256_startRecording (struct nm256_info *card, char *buffer, u32 amt) ...@@ -303,7 +303,7 @@ nm256_startRecording (struct nm256_info *card, char *buffer, u32 amt)
nm256_writePort8 (card, 2, NM_RECORD_ENABLE_REG, nm256_writePort8 (card, 2, NM_RECORD_ENABLE_REG,
NM_RECORD_ENABLE_FLAG | NM_RECORD_FREERUN); NM_RECORD_ENABLE_FLAG | NM_RECORD_FREERUN);
restore_flags (flags); spin_unlock_irqrestore(&card->lock,flags);
} }
/* Stop the play engine. */ /* Stop the play engine. */
...@@ -370,8 +370,7 @@ nm256_write_block (struct nm256_info *card, char *buffer, u32 amt) ...@@ -370,8 +370,7 @@ nm256_write_block (struct nm256_info *card, char *buffer, u32 amt)
card->requested_amt = amt; card->requested_amt = amt;
save_flags (flags); spin_lock_irqsave(&card->lock,flags);
cli ();
if ((card->curPlayPos + amt) >= ringsize) { if ((card->curPlayPos + amt) >= ringsize) {
u32 rem = ringsize - card->curPlayPos; u32 rem = ringsize - card->curPlayPos;
...@@ -418,7 +417,7 @@ nm256_write_block (struct nm256_info *card, char *buffer, u32 amt) ...@@ -418,7 +417,7 @@ nm256_write_block (struct nm256_info *card, char *buffer, u32 amt)
if (! card->playing) if (! card->playing)
startPlay (card); startPlay (card);
restore_flags (flags); spin_unlock_irqrestore(&card->lock,flags);
} }
/* We just got a card playback interrupt; process it. */ /* We just got a card playback interrupt; process it. */
...@@ -829,8 +828,7 @@ nm256_writeAC97Reg (struct ac97_hwint *dev, u8 reg, u16 value) ...@@ -829,8 +828,7 @@ nm256_writeAC97Reg (struct ac97_hwint *dev, u8 reg, u16 value)
base = card->mixer; base = card->mixer;
save_flags (flags); spin_lock_irqsave(&card->lock,flags);
cli ();
nm256_isReady (dev); nm256_isReady (dev);
...@@ -844,7 +842,7 @@ nm256_writeAC97Reg (struct ac97_hwint *dev, u8 reg, u16 value) ...@@ -844,7 +842,7 @@ nm256_writeAC97Reg (struct ac97_hwint *dev, u8 reg, u16 value)
} }
restore_flags (flags); spin_unlock_irqrestore(&card->lock,flags);
udelay (1000); udelay (1000);
return ! done; return ! done;
...@@ -1055,6 +1053,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr) ...@@ -1055,6 +1053,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
card->playing = 0; card->playing = 0;
card->recording = 0; card->recording = 0;
card->rev = rev; card->rev = rev;
spin_lock_init(&card->lock);
/* Init the memory port info. */ /* Init the memory port info. */
for (x = 0; x < 2; x++) { for (x = 0; x < 2; x++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment