aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/au1550_ac97.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/oss/au1550_ac97.c')
-rw-r--r--sound/oss/au1550_ac97.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
index c6f2621221ba..a8f626d99c5b 100644
--- a/sound/oss/au1550_ac97.c
+++ b/sound/oss/au1550_ac97.c
@@ -43,7 +43,6 @@
43#include <linux/sound.h> 43#include <linux/sound.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/soundcard.h> 45#include <linux/soundcard.h>
46#include <linux/smp_lock.h>
47#include <linux/init.h> 46#include <linux/init.h>
48#include <linux/interrupt.h> 47#include <linux/interrupt.h>
49#include <linux/kernel.h> 48#include <linux/kernel.h>
@@ -77,6 +76,7 @@
77/* Boot options 76/* Boot options
78 * 0 = no VRA, 1 = use VRA if codec supports it 77 * 0 = no VRA, 1 = use VRA if codec supports it
79 */ 78 */
79static DEFINE_MUTEX(au1550_ac97_mutex);
80static int vra = 1; 80static int vra = 1;
81module_param(vra, bool, 0); 81module_param(vra, bool, 0);
82MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); 82MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it");
@@ -171,7 +171,7 @@ au1550_delay(int msec)
171static u16 171static u16
172rdcodec(struct ac97_codec *codec, u8 addr) 172rdcodec(struct ac97_codec *codec, u8 addr)
173{ 173{
174 struct au1550_state *s = (struct au1550_state *)codec->private_data; 174 struct au1550_state *s = codec->private_data;
175 unsigned long flags; 175 unsigned long flags;
176 u32 cmd, val; 176 u32 cmd, val;
177 u16 data; 177 u16 data;
@@ -239,7 +239,7 @@ rdcodec(struct ac97_codec *codec, u8 addr)
239static void 239static void
240wrcodec(struct ac97_codec *codec, u8 addr, u16 data) 240wrcodec(struct ac97_codec *codec, u8 addr, u16 data)
241{ 241{
242 struct au1550_state *s = (struct au1550_state *)codec->private_data; 242 struct au1550_state *s = codec->private_data;
243 unsigned long flags; 243 unsigned long flags;
244 u32 cmd, val; 244 u32 cmd, val;
245 int i; 245 int i;
@@ -798,9 +798,9 @@ au1550_llseek(struct file *file, loff_t offset, int origin)
798static int 798static int
799au1550_open_mixdev(struct inode *inode, struct file *file) 799au1550_open_mixdev(struct inode *inode, struct file *file)
800{ 800{
801 lock_kernel(); 801 mutex_lock(&au1550_ac97_mutex);
802 file->private_data = &au1550_state; 802 file->private_data = &au1550_state;
803 unlock_kernel(); 803 mutex_unlock(&au1550_ac97_mutex);
804 return 0; 804 return 0;
805} 805}
806 806
@@ -820,13 +820,13 @@ mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd,
820static long 820static long
821au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg) 821au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg)
822{ 822{
823 struct au1550_state *s = (struct au1550_state *)file->private_data; 823 struct au1550_state *s = file->private_data;
824 struct ac97_codec *codec = s->codec; 824 struct ac97_codec *codec = s->codec;
825 int ret; 825 int ret;
826 826
827 lock_kernel(); 827 mutex_lock(&au1550_ac97_mutex);
828 ret = mixdev_ioctl(codec, cmd, arg); 828 ret = mixdev_ioctl(codec, cmd, arg);
829 unlock_kernel(); 829 mutex_unlock(&au1550_ac97_mutex);
830 830
831 return ret; 831 return ret;
832} 832}
@@ -1031,7 +1031,7 @@ copy_dmabuf_user(struct dmabuf *db, char* userbuf, int count, int to_user)
1031static ssize_t 1031static ssize_t
1032au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos) 1032au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
1033{ 1033{
1034 struct au1550_state *s = (struct au1550_state *)file->private_data; 1034 struct au1550_state *s = file->private_data;
1035 struct dmabuf *db = &s->dma_adc; 1035 struct dmabuf *db = &s->dma_adc;
1036 DECLARE_WAITQUEUE(wait, current); 1036 DECLARE_WAITQUEUE(wait, current);
1037 ssize_t ret; 1037 ssize_t ret;
@@ -1111,7 +1111,7 @@ out2:
1111static ssize_t 1111static ssize_t
1112au1550_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) 1112au1550_write(struct file *file, const char *buffer, size_t count, loff_t * ppos)
1113{ 1113{
1114 struct au1550_state *s = (struct au1550_state *)file->private_data; 1114 struct au1550_state *s = file->private_data;
1115 struct dmabuf *db = &s->dma_dac; 1115 struct dmabuf *db = &s->dma_dac;
1116 DECLARE_WAITQUEUE(wait, current); 1116 DECLARE_WAITQUEUE(wait, current);
1117 ssize_t ret = 0; 1117 ssize_t ret = 0;
@@ -1211,7 +1211,7 @@ out2:
1211static unsigned int 1211static unsigned int
1212au1550_poll(struct file *file, struct poll_table_struct *wait) 1212au1550_poll(struct file *file, struct poll_table_struct *wait)
1213{ 1213{
1214 struct au1550_state *s = (struct au1550_state *)file->private_data; 1214 struct au1550_state *s = file->private_data;
1215 unsigned long flags; 1215 unsigned long flags;
1216 unsigned int mask = 0; 1216 unsigned int mask = 0;
1217 1217
@@ -1250,12 +1250,12 @@ au1550_poll(struct file *file, struct poll_table_struct *wait)
1250static int 1250static int
1251au1550_mmap(struct file *file, struct vm_area_struct *vma) 1251au1550_mmap(struct file *file, struct vm_area_struct *vma)
1252{ 1252{
1253 struct au1550_state *s = (struct au1550_state *)file->private_data; 1253 struct au1550_state *s = file->private_data;
1254 struct dmabuf *db; 1254 struct dmabuf *db;
1255 unsigned long size; 1255 unsigned long size;
1256 int ret = 0; 1256 int ret = 0;
1257 1257
1258 lock_kernel(); 1258 mutex_lock(&au1550_ac97_mutex);
1259 mutex_lock(&s->sem); 1259 mutex_lock(&s->sem);
1260 if (vma->vm_flags & VM_WRITE) 1260 if (vma->vm_flags & VM_WRITE)
1261 db = &s->dma_dac; 1261 db = &s->dma_dac;
@@ -1283,7 +1283,7 @@ au1550_mmap(struct file *file, struct vm_area_struct *vma)
1283 db->mapped = 1; 1283 db->mapped = 1;
1284out: 1284out:
1285 mutex_unlock(&s->sem); 1285 mutex_unlock(&s->sem);
1286 unlock_kernel(); 1286 mutex_unlock(&au1550_ac97_mutex);
1287 return ret; 1287 return ret;
1288} 1288}
1289 1289
@@ -1342,7 +1342,7 @@ dma_count_done(struct dmabuf *db)
1342static int 1342static int
1343au1550_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1343au1550_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1344{ 1344{
1345 struct au1550_state *s = (struct au1550_state *)file->private_data; 1345 struct au1550_state *s = file->private_data;
1346 unsigned long flags; 1346 unsigned long flags;
1347 audio_buf_info abinfo; 1347 audio_buf_info abinfo;
1348 count_info cinfo; 1348 count_info cinfo;
@@ -1781,9 +1781,9 @@ au1550_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1781{ 1781{
1782 int ret; 1782 int ret;
1783 1783
1784 lock_kernel(); 1784 mutex_lock(&au1550_ac97_mutex);
1785 ret = au1550_ioctl(file, cmd, arg); 1785 ret = au1550_ioctl(file, cmd, arg);
1786 unlock_kernel(); 1786 mutex_unlock(&au1550_ac97_mutex);
1787 1787
1788 return ret; 1788 return ret;
1789} 1789}
@@ -1804,7 +1804,7 @@ au1550_open(struct inode *inode, struct file *file)
1804#endif 1804#endif
1805 1805
1806 file->private_data = s; 1806 file->private_data = s;
1807 lock_kernel(); 1807 mutex_lock(&au1550_ac97_mutex);
1808 /* wait for device to become free */ 1808 /* wait for device to become free */
1809 mutex_lock(&s->open_mutex); 1809 mutex_lock(&s->open_mutex);
1810 while (s->open_mode & file->f_mode) { 1810 while (s->open_mode & file->f_mode) {
@@ -1861,21 +1861,21 @@ au1550_open(struct inode *inode, struct file *file)
1861out: 1861out:
1862 mutex_unlock(&s->open_mutex); 1862 mutex_unlock(&s->open_mutex);
1863out2: 1863out2:
1864 unlock_kernel(); 1864 mutex_unlock(&au1550_ac97_mutex);
1865 return ret; 1865 return ret;
1866} 1866}
1867 1867
1868static int 1868static int
1869au1550_release(struct inode *inode, struct file *file) 1869au1550_release(struct inode *inode, struct file *file)
1870{ 1870{
1871 struct au1550_state *s = (struct au1550_state *)file->private_data; 1871 struct au1550_state *s = file->private_data;
1872 1872
1873 lock_kernel(); 1873 mutex_lock(&au1550_ac97_mutex);
1874 1874
1875 if (file->f_mode & FMODE_WRITE) { 1875 if (file->f_mode & FMODE_WRITE) {
1876 unlock_kernel(); 1876 mutex_unlock(&au1550_ac97_mutex);
1877 drain_dac(s, file->f_flags & O_NONBLOCK); 1877 drain_dac(s, file->f_flags & O_NONBLOCK);
1878 lock_kernel(); 1878 mutex_lock(&au1550_ac97_mutex);
1879 } 1879 }
1880 1880
1881 mutex_lock(&s->open_mutex); 1881 mutex_lock(&s->open_mutex);
@@ -1892,7 +1892,7 @@ au1550_release(struct inode *inode, struct file *file)
1892 s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE)); 1892 s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE));
1893 mutex_unlock(&s->open_mutex); 1893 mutex_unlock(&s->open_mutex);
1894 wake_up(&s->open_wait); 1894 wake_up(&s->open_wait);
1895 unlock_kernel(); 1895 mutex_unlock(&au1550_ac97_mutex);
1896 return 0; 1896 return 0;
1897} 1897}
1898 1898