diff options
Diffstat (limited to 'sound/oss')
-rw-r--r-- | sound/oss/au1550_ac97.c | 91 | ||||
-rw-r--r-- | sound/oss/dmasound/dmasound_core.c | 63 | ||||
-rw-r--r-- | sound/oss/midi_synth.c | 4 | ||||
-rw-r--r-- | sound/oss/msnd_pinnacle.c | 35 | ||||
-rw-r--r-- | sound/oss/sh_dac_audio.c | 27 | ||||
-rw-r--r-- | sound/oss/soundcard.c | 20 | ||||
-rw-r--r-- | sound/oss/swarm_cs4297a.c | 41 | ||||
-rw-r--r-- | sound/oss/vidc.c | 3 | ||||
-rw-r--r-- | sound/oss/vwsnd.c | 32 | ||||
-rw-r--r-- | sound/oss/waveartist.c | 10 |
10 files changed, 220 insertions, 106 deletions
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index c1070e33b32f..c4a4cdc07ab9 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> |
@@ -162,19 +163,10 @@ ld2(unsigned int x) | |||
162 | static void | 163 | static void |
163 | au1550_delay(int msec) | 164 | au1550_delay(int msec) |
164 | { | 165 | { |
165 | unsigned long tmo; | ||
166 | signed long tmo2; | ||
167 | |||
168 | if (in_interrupt()) | 166 | if (in_interrupt()) |
169 | return; | 167 | return; |
170 | 168 | ||
171 | tmo = jiffies + (msec * HZ) / 1000; | 169 | schedule_timeout_uninterruptible(msecs_to_jiffies(msec)); |
172 | for (;;) { | ||
173 | tmo2 = tmo - jiffies; | ||
174 | if (tmo2 <= 0) | ||
175 | break; | ||
176 | schedule_timeout(tmo2); | ||
177 | } | ||
178 | } | 170 | } |
179 | 171 | ||
180 | static u16 | 172 | static u16 |
@@ -807,7 +799,9 @@ au1550_llseek(struct file *file, loff_t offset, int origin) | |||
807 | static int | 799 | static int |
808 | au1550_open_mixdev(struct inode *inode, struct file *file) | 800 | au1550_open_mixdev(struct inode *inode, struct file *file) |
809 | { | 801 | { |
802 | lock_kernel(); | ||
810 | file->private_data = &au1550_state; | 803 | file->private_data = &au1550_state; |
804 | unlock_kernel(); | ||
811 | return 0; | 805 | return 0; |
812 | } | 806 | } |
813 | 807 | ||
@@ -824,22 +818,26 @@ mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, | |||
824 | return codec->mixer_ioctl(codec, cmd, arg); | 818 | return codec->mixer_ioctl(codec, cmd, arg); |
825 | } | 819 | } |
826 | 820 | ||
827 | static int | 821 | static long |
828 | au1550_ioctl_mixdev(struct inode *inode, struct file *file, | 822 | au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg) |
829 | unsigned int cmd, unsigned long arg) | ||
830 | { | 823 | { |
831 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 824 | struct au1550_state *s = (struct au1550_state *)file->private_data; |
832 | struct ac97_codec *codec = s->codec; | 825 | struct ac97_codec *codec = s->codec; |
826 | int ret; | ||
833 | 827 | ||
834 | return mixdev_ioctl(codec, cmd, arg); | 828 | lock_kernel(); |
829 | ret = mixdev_ioctl(codec, cmd, arg); | ||
830 | unlock_kernel(); | ||
831 | |||
832 | return ret; | ||
835 | } | 833 | } |
836 | 834 | ||
837 | static /*const */ struct file_operations au1550_mixer_fops = { | 835 | static /*const */ struct file_operations au1550_mixer_fops = { |
838 | owner:THIS_MODULE, | 836 | .owner = THIS_MODULE, |
839 | llseek:au1550_llseek, | 837 | .llseek = au1550_llseek, |
840 | ioctl:au1550_ioctl_mixdev, | 838 | .unlocked_ioctl = au1550_ioctl_mixdev, |
841 | open:au1550_open_mixdev, | 839 | .open = au1550_open_mixdev, |
842 | release:au1550_release_mixdev, | 840 | .release = au1550_release_mixdev, |
843 | }; | 841 | }; |
844 | 842 | ||
845 | static int | 843 | static int |
@@ -1343,8 +1341,7 @@ dma_count_done(struct dmabuf *db) | |||
1343 | 1341 | ||
1344 | 1342 | ||
1345 | static int | 1343 | static int |
1346 | au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 1344 | au1550_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
1347 | unsigned long arg) | ||
1348 | { | 1345 | { |
1349 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 1346 | struct au1550_state *s = (struct au1550_state *)file->private_data; |
1350 | unsigned long flags; | 1347 | unsigned long flags; |
@@ -1780,6 +1777,17 @@ au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
1780 | return mixdev_ioctl(s->codec, cmd, arg); | 1777 | return mixdev_ioctl(s->codec, cmd, arg); |
1781 | } | 1778 | } |
1782 | 1779 | ||
1780 | static long | ||
1781 | au1550_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
1782 | { | ||
1783 | int ret; | ||
1784 | |||
1785 | lock_kernel(); | ||
1786 | ret = au1550_ioctl(file, cmd, arg); | ||
1787 | unlock_kernel(); | ||
1788 | |||
1789 | return ret; | ||
1790 | } | ||
1783 | 1791 | ||
1784 | static int | 1792 | static int |
1785 | au1550_open(struct inode *inode, struct file *file) | 1793 | au1550_open(struct inode *inode, struct file *file) |
@@ -1797,21 +1805,22 @@ au1550_open(struct inode *inode, struct file *file) | |||
1797 | #endif | 1805 | #endif |
1798 | 1806 | ||
1799 | file->private_data = s; | 1807 | file->private_data = s; |
1808 | lock_kernel(); | ||
1800 | /* wait for device to become free */ | 1809 | /* wait for device to become free */ |
1801 | mutex_lock(&s->open_mutex); | 1810 | mutex_lock(&s->open_mutex); |
1802 | while (s->open_mode & file->f_mode) { | 1811 | while (s->open_mode & file->f_mode) { |
1803 | if (file->f_flags & O_NONBLOCK) { | 1812 | ret = -EBUSY; |
1804 | mutex_unlock(&s->open_mutex); | 1813 | if (file->f_flags & O_NONBLOCK) |
1805 | return -EBUSY; | 1814 | goto out; |
1806 | } | ||
1807 | add_wait_queue(&s->open_wait, &wait); | 1815 | add_wait_queue(&s->open_wait, &wait); |
1808 | __set_current_state(TASK_INTERRUPTIBLE); | 1816 | __set_current_state(TASK_INTERRUPTIBLE); |
1809 | mutex_unlock(&s->open_mutex); | 1817 | mutex_unlock(&s->open_mutex); |
1810 | schedule(); | 1818 | schedule(); |
1811 | remove_wait_queue(&s->open_wait, &wait); | 1819 | remove_wait_queue(&s->open_wait, &wait); |
1812 | set_current_state(TASK_RUNNING); | 1820 | set_current_state(TASK_RUNNING); |
1821 | ret = -ERESTARTSYS; | ||
1813 | if (signal_pending(current)) | 1822 | if (signal_pending(current)) |
1814 | return -ERESTARTSYS; | 1823 | goto out2; |
1815 | mutex_lock(&s->open_mutex); | 1824 | mutex_lock(&s->open_mutex); |
1816 | } | 1825 | } |
1817 | 1826 | ||
@@ -1840,17 +1849,21 @@ au1550_open(struct inode *inode, struct file *file) | |||
1840 | 1849 | ||
1841 | if (file->f_mode & FMODE_READ) { | 1850 | if (file->f_mode & FMODE_READ) { |
1842 | if ((ret = prog_dmabuf_adc(s))) | 1851 | if ((ret = prog_dmabuf_adc(s))) |
1843 | return ret; | 1852 | goto out; |
1844 | } | 1853 | } |
1845 | if (file->f_mode & FMODE_WRITE) { | 1854 | if (file->f_mode & FMODE_WRITE) { |
1846 | if ((ret = prog_dmabuf_dac(s))) | 1855 | if ((ret = prog_dmabuf_dac(s))) |
1847 | return ret; | 1856 | goto out; |
1848 | } | 1857 | } |
1849 | 1858 | ||
1850 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); | 1859 | s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); |
1851 | mutex_unlock(&s->open_mutex); | ||
1852 | mutex_init(&s->sem); | 1860 | mutex_init(&s->sem); |
1853 | return 0; | 1861 | ret = 0; |
1862 | out: | ||
1863 | mutex_unlock(&s->open_mutex); | ||
1864 | out2: | ||
1865 | unlock_kernel(); | ||
1866 | return ret; | ||
1854 | } | 1867 | } |
1855 | 1868 | ||
1856 | static int | 1869 | static int |
@@ -1885,15 +1898,15 @@ au1550_release(struct inode *inode, struct file *file) | |||
1885 | } | 1898 | } |
1886 | 1899 | ||
1887 | static /*const */ struct file_operations au1550_audio_fops = { | 1900 | static /*const */ struct file_operations au1550_audio_fops = { |
1888 | owner: THIS_MODULE, | 1901 | .owner = THIS_MODULE, |
1889 | llseek: au1550_llseek, | 1902 | .llseek = au1550_llseek, |
1890 | read: au1550_read, | 1903 | .read = au1550_read, |
1891 | write: au1550_write, | 1904 | .write = au1550_write, |
1892 | poll: au1550_poll, | 1905 | .poll = au1550_poll, |
1893 | ioctl: au1550_ioctl, | 1906 | .unlocked_ioctl = au1550_unlocked_ioctl, |
1894 | mmap: au1550_mmap, | 1907 | .mmap = au1550_mmap, |
1895 | open: au1550_open, | 1908 | .open = au1550_open, |
1896 | release: au1550_release, | 1909 | .release = au1550_release, |
1897 | }; | 1910 | }; |
1898 | 1911 | ||
1899 | MODULE_AUTHOR("Advanced Micro Devices (AMD), dan@embeddededge.com"); | 1912 | MODULE_AUTHOR("Advanced Micro Devices (AMD), dan@embeddededge.com"); |
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index 3f3c3f71db4b..6ecd41abb066 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -323,9 +323,13 @@ static struct { | |||
323 | 323 | ||
324 | static int mixer_open(struct inode *inode, struct file *file) | 324 | static int mixer_open(struct inode *inode, struct file *file) |
325 | { | 325 | { |
326 | if (!try_module_get(dmasound.mach.owner)) | 326 | lock_kernel(); |
327 | if (!try_module_get(dmasound.mach.owner)) { | ||
328 | unlock_kernel(); | ||
327 | return -ENODEV; | 329 | return -ENODEV; |
330 | } | ||
328 | mixer.busy = 1; | 331 | mixer.busy = 1; |
332 | unlock_kernel(); | ||
329 | return 0; | 333 | return 0; |
330 | } | 334 | } |
331 | 335 | ||
@@ -337,8 +341,8 @@ static int mixer_release(struct inode *inode, struct file *file) | |||
337 | unlock_kernel(); | 341 | unlock_kernel(); |
338 | return 0; | 342 | return 0; |
339 | } | 343 | } |
340 | static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd, | 344 | |
341 | u_long arg) | 345 | static int mixer_ioctl(struct file *file, u_int cmd, u_long arg) |
342 | { | 346 | { |
343 | if (_SIOC_DIR(cmd) & _SIOC_WRITE) | 347 | if (_SIOC_DIR(cmd) & _SIOC_WRITE) |
344 | mixer.modify_counter++; | 348 | mixer.modify_counter++; |
@@ -362,11 +366,22 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd, | |||
362 | return -EINVAL; | 366 | return -EINVAL; |
363 | } | 367 | } |
364 | 368 | ||
369 | static long mixer_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | ||
370 | { | ||
371 | int ret; | ||
372 | |||
373 | lock_kernel(); | ||
374 | ret = mixer_ioctl(file, cmd, arg); | ||
375 | unlock_kernel(); | ||
376 | |||
377 | return ret; | ||
378 | } | ||
379 | |||
365 | static const struct file_operations mixer_fops = | 380 | static const struct file_operations mixer_fops = |
366 | { | 381 | { |
367 | .owner = THIS_MODULE, | 382 | .owner = THIS_MODULE, |
368 | .llseek = no_llseek, | 383 | .llseek = no_llseek, |
369 | .ioctl = mixer_ioctl, | 384 | .unlocked_ioctl = mixer_unlocked_ioctl, |
370 | .open = mixer_open, | 385 | .open = mixer_open, |
371 | .release = mixer_release, | 386 | .release = mixer_release, |
372 | }; | 387 | }; |
@@ -737,8 +752,11 @@ static int sq_open(struct inode *inode, struct file *file) | |||
737 | { | 752 | { |
738 | int rc; | 753 | int rc; |
739 | 754 | ||
740 | if (!try_module_get(dmasound.mach.owner)) | 755 | lock_kernel(); |
756 | if (!try_module_get(dmasound.mach.owner)) { | ||
757 | unlock_kernel(); | ||
741 | return -ENODEV; | 758 | return -ENODEV; |
759 | } | ||
742 | 760 | ||
743 | rc = write_sq_open(file); /* checks the f_mode */ | 761 | rc = write_sq_open(file); /* checks the f_mode */ |
744 | if (rc) | 762 | if (rc) |
@@ -781,10 +799,11 @@ static int sq_open(struct inode *inode, struct file *file) | |||
781 | sound_set_format(AFMT_MU_LAW); | 799 | sound_set_format(AFMT_MU_LAW); |
782 | } | 800 | } |
783 | #endif | 801 | #endif |
784 | 802 | unlock_kernel(); | |
785 | return 0; | 803 | return 0; |
786 | out: | 804 | out: |
787 | module_put(dmasound.mach.owner); | 805 | module_put(dmasound.mach.owner); |
806 | unlock_kernel(); | ||
788 | return rc; | 807 | return rc; |
789 | } | 808 | } |
790 | 809 | ||
@@ -955,8 +974,7 @@ printk("dmasound_core: tried to set_queue_frags on a locked queue\n") ; | |||
955 | return 0 ; | 974 | return 0 ; |
956 | } | 975 | } |
957 | 976 | ||
958 | static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd, | 977 | static int sq_ioctl(struct file *file, u_int cmd, u_long arg) |
959 | u_long arg) | ||
960 | { | 978 | { |
961 | int val, result; | 979 | int val, result; |
962 | u_long fmt; | 980 | u_long fmt; |
@@ -1114,18 +1132,29 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd, | |||
1114 | return IOCTL_OUT(arg,val); | 1132 | return IOCTL_OUT(arg,val); |
1115 | 1133 | ||
1116 | default: | 1134 | default: |
1117 | return mixer_ioctl(inode, file, cmd, arg); | 1135 | return mixer_ioctl(file, cmd, arg); |
1118 | } | 1136 | } |
1119 | return -EINVAL; | 1137 | return -EINVAL; |
1120 | } | 1138 | } |
1121 | 1139 | ||
1140 | static long sq_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | ||
1141 | { | ||
1142 | int ret; | ||
1143 | |||
1144 | lock_kernel(); | ||
1145 | ret = sq_ioctl(file, cmd, arg); | ||
1146 | unlock_kernel(); | ||
1147 | |||
1148 | return ret; | ||
1149 | } | ||
1150 | |||
1122 | static const struct file_operations sq_fops = | 1151 | static const struct file_operations sq_fops = |
1123 | { | 1152 | { |
1124 | .owner = THIS_MODULE, | 1153 | .owner = THIS_MODULE, |
1125 | .llseek = no_llseek, | 1154 | .llseek = no_llseek, |
1126 | .write = sq_write, | 1155 | .write = sq_write, |
1127 | .poll = sq_poll, | 1156 | .poll = sq_poll, |
1128 | .ioctl = sq_ioctl, | 1157 | .unlocked_ioctl = sq_unlocked_ioctl, |
1129 | .open = sq_open, | 1158 | .open = sq_open, |
1130 | .release = sq_release, | 1159 | .release = sq_release, |
1131 | }; | 1160 | }; |
@@ -1226,12 +1255,17 @@ static int state_open(struct inode *inode, struct file *file) | |||
1226 | { | 1255 | { |
1227 | char *buffer = state.buf; | 1256 | char *buffer = state.buf; |
1228 | int len = 0; | 1257 | int len = 0; |
1258 | int ret; | ||
1229 | 1259 | ||
1260 | lock_kernel(); | ||
1261 | ret = -EBUSY; | ||
1230 | if (state.busy) | 1262 | if (state.busy) |
1231 | return -EBUSY; | 1263 | goto out; |
1232 | 1264 | ||
1265 | ret = -ENODEV; | ||
1233 | if (!try_module_get(dmasound.mach.owner)) | 1266 | if (!try_module_get(dmasound.mach.owner)) |
1234 | return -ENODEV; | 1267 | goto out; |
1268 | |||
1235 | state.ptr = 0; | 1269 | state.ptr = 0; |
1236 | state.busy = 1; | 1270 | state.busy = 1; |
1237 | 1271 | ||
@@ -1293,7 +1327,10 @@ printk("dmasound: stat buffer used %d bytes\n", len) ; | |||
1293 | printk(KERN_ERR "dmasound_core: stat buffer overflowed!\n"); | 1327 | printk(KERN_ERR "dmasound_core: stat buffer overflowed!\n"); |
1294 | 1328 | ||
1295 | state.len = len; | 1329 | state.len = len; |
1296 | return 0; | 1330 | ret = 0; |
1331 | out: | ||
1332 | unlock_kernel(); | ||
1333 | return ret; | ||
1297 | } | 1334 | } |
1298 | 1335 | ||
1299 | static int state_release(struct inode *inode, struct file *file) | 1336 | static int state_release(struct inode *inode, struct file *file) |
diff --git a/sound/oss/midi_synth.c b/sound/oss/midi_synth.c index 3bc7104c5379..3c09374ea5bf 100644 --- a/sound/oss/midi_synth.c +++ b/sound/oss/midi_synth.c | |||
@@ -523,7 +523,9 @@ midi_synth_load_patch(int dev, int format, const char __user *addr, | |||
523 | { | 523 | { |
524 | unsigned char data; | 524 | unsigned char data; |
525 | 525 | ||
526 | get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[hdr_size + i])); | 526 | if (get_user(data, |
527 | (unsigned char __user *)(addr + hdr_size + i))) | ||
528 | return -EFAULT; | ||
527 | 529 | ||
528 | eox_seen = (i > 0 && data & 0x80); /* End of sysex */ | 530 | eox_seen = (i > 0 && data & 0x80); /* End of sysex */ |
529 | 531 | ||
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index a1e3f9671bea..2e48b17667d0 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c | |||
@@ -639,21 +639,26 @@ static int mixer_ioctl(unsigned int cmd, unsigned long arg) | |||
639 | return -EINVAL; | 639 | return -EINVAL; |
640 | } | 640 | } |
641 | 641 | ||
642 | static int dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 642 | static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
643 | { | 643 | { |
644 | int minor = iminor(inode); | 644 | int minor = iminor(file->f_path.dentry->d_inode); |
645 | int ret; | ||
645 | 646 | ||
646 | if (cmd == OSS_GETVERSION) { | 647 | if (cmd == OSS_GETVERSION) { |
647 | int sound_version = SOUND_VERSION; | 648 | int sound_version = SOUND_VERSION; |
648 | return put_user(sound_version, (int __user *)arg); | 649 | return put_user(sound_version, (int __user *)arg); |
649 | } | 650 | } |
650 | 651 | ||
652 | ret = -EINVAL; | ||
653 | |||
654 | lock_kernel(); | ||
651 | if (minor == dev.dsp_minor) | 655 | if (minor == dev.dsp_minor) |
652 | return dsp_ioctl(file, cmd, arg); | 656 | ret = dsp_ioctl(file, cmd, arg); |
653 | else if (minor == dev.mixer_minor) | 657 | else if (minor == dev.mixer_minor) |
654 | return mixer_ioctl(cmd, arg); | 658 | ret = mixer_ioctl(cmd, arg); |
659 | unlock_kernel(); | ||
655 | 660 | ||
656 | return -EINVAL; | 661 | return ret; |
657 | } | 662 | } |
658 | 663 | ||
659 | static void dsp_write_flush(void) | 664 | static void dsp_write_flush(void) |
@@ -756,12 +761,15 @@ static int dev_open(struct inode *inode, struct file *file) | |||
756 | int minor = iminor(inode); | 761 | int minor = iminor(inode); |
757 | int err = 0; | 762 | int err = 0; |
758 | 763 | ||
764 | lock_kernel(); | ||
759 | if (minor == dev.dsp_minor) { | 765 | if (minor == dev.dsp_minor) { |
760 | if ((file->f_mode & FMODE_WRITE && | 766 | if ((file->f_mode & FMODE_WRITE && |
761 | test_bit(F_AUDIO_WRITE_INUSE, &dev.flags)) || | 767 | test_bit(F_AUDIO_WRITE_INUSE, &dev.flags)) || |
762 | (file->f_mode & FMODE_READ && | 768 | (file->f_mode & FMODE_READ && |
763 | test_bit(F_AUDIO_READ_INUSE, &dev.flags))) | 769 | test_bit(F_AUDIO_READ_INUSE, &dev.flags))) { |
764 | return -EBUSY; | 770 | err = -EBUSY; |
771 | goto out; | ||
772 | } | ||
765 | 773 | ||
766 | if ((err = dsp_open(file)) >= 0) { | 774 | if ((err = dsp_open(file)) >= 0) { |
767 | dev.nresets = 0; | 775 | dev.nresets = 0; |
@@ -782,7 +790,8 @@ static int dev_open(struct inode *inode, struct file *file) | |||
782 | /* nothing */ | 790 | /* nothing */ |
783 | } else | 791 | } else |
784 | err = -EINVAL; | 792 | err = -EINVAL; |
785 | 793 | out: | |
794 | unlock_kernel(); | ||
786 | return err; | 795 | return err; |
787 | } | 796 | } |
788 | 797 | ||
@@ -1105,7 +1114,7 @@ static const struct file_operations dev_fileops = { | |||
1105 | .owner = THIS_MODULE, | 1114 | .owner = THIS_MODULE, |
1106 | .read = dev_read, | 1115 | .read = dev_read, |
1107 | .write = dev_write, | 1116 | .write = dev_write, |
1108 | .ioctl = dev_ioctl, | 1117 | .unlocked_ioctl = dev_ioctl, |
1109 | .open = dev_open, | 1118 | .open = dev_open, |
1110 | .release = dev_release, | 1119 | .release = dev_release, |
1111 | }; | 1120 | }; |
@@ -1391,9 +1400,13 @@ static int __init attach_multisound(void) | |||
1391 | printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", dev.irq); | 1400 | printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", dev.irq); |
1392 | return err; | 1401 | return err; |
1393 | } | 1402 | } |
1394 | request_region(dev.io, dev.numio, dev.name); | 1403 | if (request_region(dev.io, dev.numio, dev.name) == NULL) { |
1404 | free_irq(dev.irq, &dev); | ||
1405 | return -EBUSY; | ||
1406 | } | ||
1395 | 1407 | ||
1396 | if ((err = dsp_full_reset()) < 0) { | 1408 | err = dsp_full_reset(); |
1409 | if (err < 0) { | ||
1397 | release_region(dev.io, dev.numio); | 1410 | release_region(dev.io, dev.numio); |
1398 | free_irq(dev.irq, &dev); | 1411 | free_irq(dev.irq, &dev); |
1399 | return err; | 1412 | return err; |
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 4153752507e3..fdb58eb83d4e 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c | |||
@@ -15,7 +15,9 @@ | |||
15 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/smp_lock.h> | ||
18 | #include <linux/sound.h> | 19 | #include <linux/sound.h> |
20 | #include <linux/smp_lock.h> | ||
19 | #include <linux/soundcard.h> | 21 | #include <linux/soundcard.h> |
20 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
21 | #include <linux/hrtimer.h> | 23 | #include <linux/hrtimer.h> |
@@ -92,7 +94,7 @@ static void dac_audio_set_rate(void) | |||
92 | wakeups_per_second = ktime_set(0, 1000000000 / rate); | 94 | wakeups_per_second = ktime_set(0, 1000000000 / rate); |
93 | } | 95 | } |
94 | 96 | ||
95 | static int dac_audio_ioctl(struct inode *inode, struct file *file, | 97 | static int dac_audio_ioctl(struct file *file, |
96 | unsigned int cmd, unsigned long arg) | 98 | unsigned int cmd, unsigned long arg) |
97 | { | 99 | { |
98 | int val; | 100 | int val; |
@@ -158,6 +160,17 @@ static int dac_audio_ioctl(struct inode *inode, struct file *file, | |||
158 | return -EINVAL; | 160 | return -EINVAL; |
159 | } | 161 | } |
160 | 162 | ||
163 | static long dac_audio_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | ||
164 | { | ||
165 | int ret; | ||
166 | |||
167 | lock_kernel(); | ||
168 | ret = dac_audio_ioctl(file, cmd, arg); | ||
169 | unlock_kernel(); | ||
170 | |||
171 | return ret; | ||
172 | } | ||
173 | |||
161 | static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, | 174 | static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, |
162 | loff_t * ppos) | 175 | loff_t * ppos) |
163 | { | 176 | { |
@@ -216,13 +229,17 @@ static int dac_audio_open(struct inode *inode, struct file *file) | |||
216 | { | 229 | { |
217 | if (file->f_mode & FMODE_READ) | 230 | if (file->f_mode & FMODE_READ) |
218 | return -ENODEV; | 231 | return -ENODEV; |
219 | if (in_use) | 232 | |
233 | lock_kernel(); | ||
234 | if (in_use) { | ||
235 | unlock_kernel(); | ||
220 | return -EBUSY; | 236 | return -EBUSY; |
237 | } | ||
221 | 238 | ||
222 | in_use = 1; | 239 | in_use = 1; |
223 | 240 | ||
224 | dac_audio_start(); | 241 | dac_audio_start(); |
225 | 242 | unlock_kernel(); | |
226 | return 0; | 243 | return 0; |
227 | } | 244 | } |
228 | 245 | ||
@@ -237,8 +254,8 @@ static int dac_audio_release(struct inode *inode, struct file *file) | |||
237 | 254 | ||
238 | const struct file_operations dac_audio_fops = { | 255 | const struct file_operations dac_audio_fops = { |
239 | .read = dac_audio_read, | 256 | .read = dac_audio_read, |
240 | .write = dac_audio_write, | 257 | .write = dac_audio_write, |
241 | .ioctl = dac_audio_ioctl, | 258 | .unlocked_ioctl = dac_audio_unlocked_ioctl, |
242 | .open = dac_audio_open, | 259 | .open = dac_audio_open, |
243 | .release = dac_audio_release, | 260 | .release = dac_audio_release, |
244 | }; | 261 | }; |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 2d9c51312622..92aa762ffb7e 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -210,42 +210,44 @@ static int sound_open(struct inode *inode, struct file *file) | |||
210 | printk(KERN_ERR "Invalid minor device %d\n", dev); | 210 | printk(KERN_ERR "Invalid minor device %d\n", dev); |
211 | return -ENXIO; | 211 | return -ENXIO; |
212 | } | 212 | } |
213 | lock_kernel(); | ||
213 | switch (dev & 0x0f) { | 214 | switch (dev & 0x0f) { |
214 | case SND_DEV_CTL: | 215 | case SND_DEV_CTL: |
215 | dev >>= 4; | 216 | dev >>= 4; |
216 | if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) { | 217 | if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) { |
217 | request_module("mixer%d", dev); | 218 | request_module("mixer%d", dev); |
218 | } | 219 | } |
220 | retval = -ENXIO; | ||
219 | if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL)) | 221 | if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL)) |
220 | return -ENXIO; | 222 | break; |
221 | 223 | ||
222 | if (!try_module_get(mixer_devs[dev]->owner)) | 224 | if (!try_module_get(mixer_devs[dev]->owner)) |
223 | return -ENXIO; | 225 | break; |
226 | |||
227 | retval = 0; | ||
224 | break; | 228 | break; |
225 | 229 | ||
226 | case SND_DEV_SEQ: | 230 | case SND_DEV_SEQ: |
227 | case SND_DEV_SEQ2: | 231 | case SND_DEV_SEQ2: |
228 | if ((retval = sequencer_open(dev, file)) < 0) | 232 | retval = sequencer_open(dev, file); |
229 | return retval; | ||
230 | break; | 233 | break; |
231 | 234 | ||
232 | case SND_DEV_MIDIN: | 235 | case SND_DEV_MIDIN: |
233 | if ((retval = MIDIbuf_open(dev, file)) < 0) | 236 | retval = MIDIbuf_open(dev, file); |
234 | return retval; | ||
235 | break; | 237 | break; |
236 | 238 | ||
237 | case SND_DEV_DSP: | 239 | case SND_DEV_DSP: |
238 | case SND_DEV_DSP16: | 240 | case SND_DEV_DSP16: |
239 | case SND_DEV_AUDIO: | 241 | case SND_DEV_AUDIO: |
240 | if ((retval = audio_open(dev, file)) < 0) | 242 | retval = audio_open(dev, file); |
241 | return retval; | ||
242 | break; | 243 | break; |
243 | 244 | ||
244 | default: | 245 | default: |
245 | printk(KERN_ERR "Invalid minor device %d\n", dev); | 246 | printk(KERN_ERR "Invalid minor device %d\n", dev); |
246 | return -ENXIO; | 247 | retval = -ENXIO; |
247 | } | 248 | } |
248 | 249 | ||
250 | unlock_kernel(); | ||
249 | return 0; | 251 | return 0; |
250 | } | 252 | } |
251 | 253 | ||
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 3136c88eacdf..b15840ad2527 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -68,6 +68,7 @@ | |||
68 | #include <linux/delay.h> | 68 | #include <linux/delay.h> |
69 | #include <linux/sound.h> | 69 | #include <linux/sound.h> |
70 | #include <linux/slab.h> | 70 | #include <linux/slab.h> |
71 | #include <linux/smp_lock.h> | ||
71 | #include <linux/soundcard.h> | 72 | #include <linux/soundcard.h> |
72 | #include <linux/ac97_codec.h> | 73 | #include <linux/ac97_codec.h> |
73 | #include <linux/pci.h> | 74 | #include <linux/pci.h> |
@@ -1534,6 +1535,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1534 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, | 1535 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, |
1535 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()+\n")); | 1536 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()+\n")); |
1536 | 1537 | ||
1538 | lock_kernel(); | ||
1537 | list_for_each(entry, &cs4297a_devs) | 1539 | list_for_each(entry, &cs4297a_devs) |
1538 | { | 1540 | { |
1539 | s = list_entry(entry, struct cs4297a_state, list); | 1541 | s = list_entry(entry, struct cs4297a_state, list); |
@@ -1544,6 +1546,8 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1544 | { | 1546 | { |
1545 | CS_DBGOUT(CS_FUNCTION | CS_OPEN | CS_ERROR, 2, | 1547 | CS_DBGOUT(CS_FUNCTION | CS_OPEN | CS_ERROR, 2, |
1546 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- -ENODEV\n")); | 1548 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- -ENODEV\n")); |
1549 | |||
1550 | unlock_kernel(); | ||
1547 | return -ENODEV; | 1551 | return -ENODEV; |
1548 | } | 1552 | } |
1549 | VALIDATE_STATE(s); | 1553 | VALIDATE_STATE(s); |
@@ -1551,6 +1555,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1551 | 1555 | ||
1552 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, | 1556 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, |
1553 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n")); | 1557 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n")); |
1558 | unlock_kernel(); | ||
1554 | 1559 | ||
1555 | return nonseekable_open(inode, file); | 1560 | return nonseekable_open(inode, file); |
1556 | } | 1561 | } |
@@ -1566,11 +1571,15 @@ static int cs4297a_release_mixdev(struct inode *inode, struct file *file) | |||
1566 | } | 1571 | } |
1567 | 1572 | ||
1568 | 1573 | ||
1569 | static int cs4297a_ioctl_mixdev(struct inode *inode, struct file *file, | 1574 | static int cs4297a_ioctl_mixdev(struct file *file, |
1570 | unsigned int cmd, unsigned long arg) | 1575 | unsigned int cmd, unsigned long arg) |
1571 | { | 1576 | { |
1572 | return mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, | 1577 | int ret; |
1578 | lock_kernel(); | ||
1579 | ret = mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, | ||
1573 | arg); | 1580 | arg); |
1581 | unlock_kernel(); | ||
1582 | return ret; | ||
1574 | } | 1583 | } |
1575 | 1584 | ||
1576 | 1585 | ||
@@ -1580,7 +1589,7 @@ static int cs4297a_ioctl_mixdev(struct inode *inode, struct file *file, | |||
1580 | static const struct file_operations cs4297a_mixer_fops = { | 1589 | static const struct file_operations cs4297a_mixer_fops = { |
1581 | .owner = THIS_MODULE, | 1590 | .owner = THIS_MODULE, |
1582 | .llseek = no_llseek, | 1591 | .llseek = no_llseek, |
1583 | .ioctl = cs4297a_ioctl_mixdev, | 1592 | .unlocked_ioctl = cs4297a_ioctl_mixdev, |
1584 | .open = cs4297a_open_mixdev, | 1593 | .open = cs4297a_open_mixdev, |
1585 | .release = cs4297a_release_mixdev, | 1594 | .release = cs4297a_release_mixdev, |
1586 | }; | 1595 | }; |
@@ -1944,7 +1953,7 @@ static int cs4297a_mmap(struct file *file, struct vm_area_struct *vma) | |||
1944 | } | 1953 | } |
1945 | 1954 | ||
1946 | 1955 | ||
1947 | static int cs4297a_ioctl(struct inode *inode, struct file *file, | 1956 | static int cs4297a_ioctl(struct file *file, |
1948 | unsigned int cmd, unsigned long arg) | 1957 | unsigned int cmd, unsigned long arg) |
1949 | { | 1958 | { |
1950 | struct cs4297a_state *s = | 1959 | struct cs4297a_state *s = |
@@ -2337,6 +2346,16 @@ static int cs4297a_ioctl(struct inode *inode, struct file *file, | |||
2337 | return mixer_ioctl(s, cmd, arg); | 2346 | return mixer_ioctl(s, cmd, arg); |
2338 | } | 2347 | } |
2339 | 2348 | ||
2349 | static long cs4297a_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | ||
2350 | { | ||
2351 | int ret; | ||
2352 | |||
2353 | lock_kernel(); | ||
2354 | ret = cs4297a_ioctl(file, cmd, arg); | ||
2355 | unlock_kernel(); | ||
2356 | |||
2357 | return ret; | ||
2358 | } | ||
2340 | 2359 | ||
2341 | static int cs4297a_release(struct inode *inode, struct file *file) | 2360 | static int cs4297a_release(struct inode *inode, struct file *file) |
2342 | { | 2361 | { |
@@ -2369,7 +2388,7 @@ static int cs4297a_release(struct inode *inode, struct file *file) | |||
2369 | return 0; | 2388 | return 0; |
2370 | } | 2389 | } |
2371 | 2390 | ||
2372 | static int cs4297a_open(struct inode *inode, struct file *file) | 2391 | static int cs4297a_locked_open(struct inode *inode, struct file *file) |
2373 | { | 2392 | { |
2374 | int minor = iminor(inode); | 2393 | int minor = iminor(inode); |
2375 | struct cs4297a_state *s=NULL; | 2394 | struct cs4297a_state *s=NULL; |
@@ -2486,6 +2505,16 @@ static int cs4297a_open(struct inode *inode, struct file *file) | |||
2486 | return nonseekable_open(inode, file); | 2505 | return nonseekable_open(inode, file); |
2487 | } | 2506 | } |
2488 | 2507 | ||
2508 | static int cs4297a_open(struct inode *inode, struct file *file) | ||
2509 | { | ||
2510 | int ret; | ||
2511 | |||
2512 | lock_kernel(); | ||
2513 | ret = cs4297a_open(inode, file); | ||
2514 | unlock_kernel(); | ||
2515 | |||
2516 | return ret; | ||
2517 | } | ||
2489 | 2518 | ||
2490 | // ****************************************************************************************** | 2519 | // ****************************************************************************************** |
2491 | // Wave (audio) file operations struct. | 2520 | // Wave (audio) file operations struct. |
@@ -2496,7 +2525,7 @@ static const struct file_operations cs4297a_audio_fops = { | |||
2496 | .read = cs4297a_read, | 2525 | .read = cs4297a_read, |
2497 | .write = cs4297a_write, | 2526 | .write = cs4297a_write, |
2498 | .poll = cs4297a_poll, | 2527 | .poll = cs4297a_poll, |
2499 | .ioctl = cs4297a_ioctl, | 2528 | .unlocked_ioctl = cs4297a_unlocked_ioctl, |
2500 | .mmap = cs4297a_mmap, | 2529 | .mmap = cs4297a_mmap, |
2501 | .open = cs4297a_open, | 2530 | .open = cs4297a_open, |
2502 | .release = cs4297a_release, | 2531 | .release = cs4297a_release, |
diff --git a/sound/oss/vidc.c b/sound/oss/vidc.c index ac39a531df19..f0e0caa53200 100644 --- a/sound/oss/vidc.c +++ b/sound/oss/vidc.c | |||
@@ -491,9 +491,6 @@ static void __init attach_vidc(struct address_info *hw_config) | |||
491 | vidc_adev = adev; | 491 | vidc_adev = adev; |
492 | vidc_mixer_set(SOUND_MIXER_VOLUME, (85 | 85 << 8)); | 492 | vidc_mixer_set(SOUND_MIXER_VOLUME, (85 | 85 << 8)); |
493 | 493 | ||
494 | #if defined(CONFIG_SOUND_SOFTOSS) || defined(CONFIG_SOUND_SOFTOSS_MODULE) | ||
495 | softoss_dev = adev; | ||
496 | #endif | ||
497 | return; | 494 | return; |
498 | 495 | ||
499 | irq_failed: | 496 | irq_failed: |
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index 20b3b325aa80..8cd73cdd88af 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c | |||
@@ -2429,8 +2429,7 @@ static unsigned int vwsnd_audio_poll(struct file *file, | |||
2429 | return mask; | 2429 | return mask; |
2430 | } | 2430 | } |
2431 | 2431 | ||
2432 | static int vwsnd_audio_do_ioctl(struct inode *inode, | 2432 | static int vwsnd_audio_do_ioctl(struct file *file, |
2433 | struct file *file, | ||
2434 | unsigned int cmd, | 2433 | unsigned int cmd, |
2435 | unsigned long arg) | 2434 | unsigned long arg) |
2436 | { | 2435 | { |
@@ -2446,8 +2445,8 @@ static int vwsnd_audio_do_ioctl(struct inode *inode, | |||
2446 | int ival; | 2445 | int ival; |
2447 | 2446 | ||
2448 | 2447 | ||
2449 | DBGEV("(inode=0x%p, file=0x%p, cmd=0x%x, arg=0x%lx)\n", | 2448 | DBGEV("(file=0x%p, cmd=0x%x, arg=0x%lx)\n", |
2450 | inode, file, cmd, arg); | 2449 | file, cmd, arg); |
2451 | switch (cmd) { | 2450 | switch (cmd) { |
2452 | case OSS_GETVERSION: /* _SIOR ('M', 118, int) */ | 2451 | case OSS_GETVERSION: /* _SIOR ('M', 118, int) */ |
2453 | DBGX("OSS_GETVERSION\n"); | 2452 | DBGX("OSS_GETVERSION\n"); |
@@ -2885,17 +2884,19 @@ static int vwsnd_audio_do_ioctl(struct inode *inode, | |||
2885 | return -EINVAL; | 2884 | return -EINVAL; |
2886 | } | 2885 | } |
2887 | 2886 | ||
2888 | static int vwsnd_audio_ioctl(struct inode *inode, | 2887 | static long vwsnd_audio_ioctl(struct file *file, |
2889 | struct file *file, | ||
2890 | unsigned int cmd, | 2888 | unsigned int cmd, |
2891 | unsigned long arg) | 2889 | unsigned long arg) |
2892 | { | 2890 | { |
2893 | vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data; | 2891 | vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data; |
2894 | int ret; | 2892 | int ret; |
2895 | 2893 | ||
2894 | lock_kernel(); | ||
2896 | mutex_lock(&devc->io_mutex); | 2895 | mutex_lock(&devc->io_mutex); |
2897 | ret = vwsnd_audio_do_ioctl(inode, file, cmd, arg); | 2896 | ret = vwsnd_audio_do_ioctl(file, cmd, arg); |
2898 | mutex_unlock(&devc->io_mutex); | 2897 | mutex_unlock(&devc->io_mutex); |
2898 | unlock_kernel(); | ||
2899 | |||
2899 | return ret; | 2900 | return ret; |
2900 | } | 2901 | } |
2901 | 2902 | ||
@@ -2921,6 +2922,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2921 | 2922 | ||
2922 | DBGE("(inode=0x%p, file=0x%p)\n", inode, file); | 2923 | DBGE("(inode=0x%p, file=0x%p)\n", inode, file); |
2923 | 2924 | ||
2925 | lock_kernel(); | ||
2924 | INC_USE_COUNT; | 2926 | INC_USE_COUNT; |
2925 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) | 2927 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) |
2926 | if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F)) | 2928 | if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F)) |
@@ -2928,6 +2930,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2928 | 2930 | ||
2929 | if (devc == NULL) { | 2931 | if (devc == NULL) { |
2930 | DEC_USE_COUNT; | 2932 | DEC_USE_COUNT; |
2933 | unlock_kernel(); | ||
2931 | return -ENODEV; | 2934 | return -ENODEV; |
2932 | } | 2935 | } |
2933 | 2936 | ||
@@ -2936,11 +2939,13 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2936 | mutex_unlock(&devc->open_mutex); | 2939 | mutex_unlock(&devc->open_mutex); |
2937 | if (file->f_flags & O_NONBLOCK) { | 2940 | if (file->f_flags & O_NONBLOCK) { |
2938 | DEC_USE_COUNT; | 2941 | DEC_USE_COUNT; |
2942 | unlock_kernel(); | ||
2939 | return -EBUSY; | 2943 | return -EBUSY; |
2940 | } | 2944 | } |
2941 | interruptible_sleep_on(&devc->open_wait); | 2945 | interruptible_sleep_on(&devc->open_wait); |
2942 | if (signal_pending(current)) { | 2946 | if (signal_pending(current)) { |
2943 | DEC_USE_COUNT; | 2947 | DEC_USE_COUNT; |
2948 | unlock_kernel(); | ||
2944 | return -ERESTARTSYS; | 2949 | return -ERESTARTSYS; |
2945 | } | 2950 | } |
2946 | mutex_lock(&devc->open_mutex); | 2951 | mutex_lock(&devc->open_mutex); |
@@ -2993,6 +2998,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2993 | 2998 | ||
2994 | file->private_data = devc; | 2999 | file->private_data = devc; |
2995 | DBGRV(); | 3000 | DBGRV(); |
3001 | unlock_kernel(); | ||
2996 | return 0; | 3002 | return 0; |
2997 | } | 3003 | } |
2998 | 3004 | ||
@@ -3044,7 +3050,7 @@ static const struct file_operations vwsnd_audio_fops = { | |||
3044 | .read = vwsnd_audio_read, | 3050 | .read = vwsnd_audio_read, |
3045 | .write = vwsnd_audio_write, | 3051 | .write = vwsnd_audio_write, |
3046 | .poll = vwsnd_audio_poll, | 3052 | .poll = vwsnd_audio_poll, |
3047 | .ioctl = vwsnd_audio_ioctl, | 3053 | .unlocked_ioctl = vwsnd_audio_ioctl, |
3048 | .mmap = vwsnd_audio_mmap, | 3054 | .mmap = vwsnd_audio_mmap, |
3049 | .open = vwsnd_audio_open, | 3055 | .open = vwsnd_audio_open, |
3050 | .release = vwsnd_audio_release, | 3056 | .release = vwsnd_audio_release, |
@@ -3062,15 +3068,18 @@ static int vwsnd_mixer_open(struct inode *inode, struct file *file) | |||
3062 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); | 3068 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); |
3063 | 3069 | ||
3064 | INC_USE_COUNT; | 3070 | INC_USE_COUNT; |
3071 | lock_kernel(); | ||
3065 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) | 3072 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) |
3066 | if (devc->mixer_minor == iminor(inode)) | 3073 | if (devc->mixer_minor == iminor(inode)) |
3067 | break; | 3074 | break; |
3068 | 3075 | ||
3069 | if (devc == NULL) { | 3076 | if (devc == NULL) { |
3070 | DEC_USE_COUNT; | 3077 | DEC_USE_COUNT; |
3078 | unlock_kernel(); | ||
3071 | return -ENODEV; | 3079 | return -ENODEV; |
3072 | } | 3080 | } |
3073 | file->private_data = devc; | 3081 | file->private_data = devc; |
3082 | unlock_kernel(); | ||
3074 | return 0; | 3083 | return 0; |
3075 | } | 3084 | } |
3076 | 3085 | ||
@@ -3203,8 +3212,7 @@ static int mixer_write_ioctl(vwsnd_dev_t *devc, unsigned int nr, void __user *ar | |||
3203 | 3212 | ||
3204 | /* This is the ioctl entry to the mixer driver. */ | 3213 | /* This is the ioctl entry to the mixer driver. */ |
3205 | 3214 | ||
3206 | static int vwsnd_mixer_ioctl(struct inode *ioctl, | 3215 | static long vwsnd_mixer_ioctl(struct file *file, |
3207 | struct file *file, | ||
3208 | unsigned int cmd, | 3216 | unsigned int cmd, |
3209 | unsigned long arg) | 3217 | unsigned long arg) |
3210 | { | 3218 | { |
@@ -3215,6 +3223,7 @@ static int vwsnd_mixer_ioctl(struct inode *ioctl, | |||
3215 | 3223 | ||
3216 | DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg); | 3224 | DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg); |
3217 | 3225 | ||
3226 | lock_kernel(); | ||
3218 | mutex_lock(&devc->mix_mutex); | 3227 | mutex_lock(&devc->mix_mutex); |
3219 | { | 3228 | { |
3220 | if ((cmd & ~nrmask) == MIXER_READ(0)) | 3229 | if ((cmd & ~nrmask) == MIXER_READ(0)) |
@@ -3225,13 +3234,14 @@ static int vwsnd_mixer_ioctl(struct inode *ioctl, | |||
3225 | retval = -EINVAL; | 3234 | retval = -EINVAL; |
3226 | } | 3235 | } |
3227 | mutex_unlock(&devc->mix_mutex); | 3236 | mutex_unlock(&devc->mix_mutex); |
3237 | unlock_kernel(); | ||
3228 | return retval; | 3238 | return retval; |
3229 | } | 3239 | } |
3230 | 3240 | ||
3231 | static const struct file_operations vwsnd_mixer_fops = { | 3241 | static const struct file_operations vwsnd_mixer_fops = { |
3232 | .owner = THIS_MODULE, | 3242 | .owner = THIS_MODULE, |
3233 | .llseek = no_llseek, | 3243 | .llseek = no_llseek, |
3234 | .ioctl = vwsnd_mixer_ioctl, | 3244 | .unlocked_ioctl = vwsnd_mixer_ioctl, |
3235 | .open = vwsnd_mixer_open, | 3245 | .open = vwsnd_mixer_open, |
3236 | .release = vwsnd_mixer_release, | 3246 | .release = vwsnd_mixer_release, |
3237 | }; | 3247 | }; |
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index e688dde6bbde..52468742d9f2 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c | |||
@@ -184,14 +184,8 @@ waveartist_iack(wavnc_info *devc) | |||
184 | static inline int | 184 | static inline int |
185 | waveartist_sleep(int timeout_ms) | 185 | waveartist_sleep(int timeout_ms) |
186 | { | 186 | { |
187 | unsigned int timeout = timeout_ms * 10 * HZ / 100; | 187 | unsigned int timeout = msecs_to_jiffies(timeout_ms*100); |
188 | 188 | return schedule_timeout_interruptible(timeout); | |
189 | do { | ||
190 | set_current_state(TASK_INTERRUPTIBLE); | ||
191 | timeout = schedule_timeout(timeout); | ||
192 | } while (timeout); | ||
193 | |||
194 | return 0; | ||
195 | } | 189 | } |
196 | 190 | ||
197 | static int | 191 | static int |