diff options
Diffstat (limited to 'sound/oss/au1550_ac97.c')
-rw-r--r-- | sound/oss/au1550_ac97.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index c1070e33b32f..fb913e568de1 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -43,6 +43,7 @@ | |||
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> | ||
46 | #include <linux/init.h> | 47 | #include <linux/init.h> |
47 | #include <linux/interrupt.h> | 48 | #include <linux/interrupt.h> |
48 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
@@ -807,7 +808,9 @@ au1550_llseek(struct file *file, loff_t offset, int origin) | |||
807 | static int | 808 | static int |
808 | au1550_open_mixdev(struct inode *inode, struct file *file) | 809 | au1550_open_mixdev(struct inode *inode, struct file *file) |
809 | { | 810 | { |
811 | lock_kernel(); | ||
810 | file->private_data = &au1550_state; | 812 | file->private_data = &au1550_state; |
813 | unlock_kernel(); | ||
811 | return 0; | 814 | return 0; |
812 | } | 815 | } |
813 | 816 | ||
@@ -1797,21 +1800,22 @@ au1550_open(struct inode *inode, struct file *file) | |||
1797 | #endif | 1800 | #endif |
1798 | 1801 | ||
1799 | file->private_data = s; | 1802 | file->private_data = s; |
1803 | lock_kernel(); | ||
1800 | /* wait for device to become free */ | 1804 | /* wait for device to become free */ |
1801 | mutex_lock(&s->open_mutex); | 1805 | mutex_lock(&s->open_mutex); |
1802 | while (s->open_mode & file->f_mode) { | 1806 | while (s->open_mode & file->f_mode) { |
1803 | if (file->f_flags & O_NONBLOCK) { | 1807 | ret = -EBUSY; |
1804 | mutex_unlock(&s->open_mutex); | 1808 | if (file->f_flags & O_NONBLOCK) |
1805 | return -EBUSY; | 1809 | goto out; |
1806 | } | ||
1807 | add_wait_queue(&s->open_wait, &wait); | 1810 | add_wait_queue(&s->open_wait, &wait); |
1808 | __set_current_state(TASK_INTERRUPTIBLE); | 1811 | __set_current_state(TASK_INTERRUPTIBLE); |
1809 | mutex_unlock(&s->open_mutex); | 1812 | mutex_unlock(&s->open_mutex); |
1810 | schedule(); | 1813 | schedule(); |
1811 | remove_wait_queue(&s->open_wait, &wait); | 1814 | remove_wait_queue(&s->open_wait, &wait); |
1812 | set_current_state(TASK_RUNNING); | 1815 | set_current_state(TASK_RUNNING); |
1816 | ret = -ERESTARTSYS; | ||
1813 | if (signal_pending(current)) | 1817 | if (signal_pending(current)) |
1814 | return -ERESTARTSYS; | 1818 | goto out2; |
1815 | mutex_lock(&s->open_mutex); | 1819 | mutex_lock(&s->open_mutex); |
1816 | } | 1820 | } |
1817 | 1821 | ||
@@ -1840,17 +1844,21 @@ au1550_open(struct inode *inode, struct file *file) | |||
1840 | 1844 | ||
1841 | if (file->f_mode & FMODE_READ) { | 1845 | if (file->f_mode & FMODE_READ) { |
1842 | if ((ret = prog_dmabuf_adc(s))) | 1846 | if ((ret = prog_dmabuf_adc(s))) |
1843 | return ret; | 1847 | goto out; |
1844 | } | 1848 | } |
1845 | if (file->f_mode & FMODE_WRITE) { | 1849 | if (file->f_mode & FMODE_WRITE) { |
1846 | if ((ret = prog_dmabuf_dac(s))) | 1850 | if ((ret = prog_dmabuf_dac(s))) |
1847 | return ret; | 1851 | goto out; |
1848 | } | 1852 | } |
1849 | 1853 | ||
1850 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); | 1854 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); |
1851 | mutex_unlock(&s->open_mutex); | ||
1852 | mutex_init(&s->sem); | 1855 | mutex_init(&s->sem); |
1853 | return 0; | 1856 | ret = 0; |
1857 | out: | ||
1858 | mutex_unlock(&s->open_mutex); | ||
1859 | out2: | ||
1860 | unlock_kernel(); | ||
1861 | return ret; | ||
1854 | } | 1862 | } |
1855 | 1863 | ||
1856 | static int | 1864 | static int |