diff options
Diffstat (limited to 'sound/oss/sh_dac_audio.c')
-rw-r--r-- | sound/oss/sh_dac_audio.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 4153752507e3..479e3025a8a3 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/sound.h> | 18 | #include <linux/sound.h> |
19 | #include <linux/smp_lock.h> | ||
19 | #include <linux/soundcard.h> | 20 | #include <linux/soundcard.h> |
20 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
21 | #include <linux/hrtimer.h> | 22 | #include <linux/hrtimer.h> |
@@ -92,7 +93,7 @@ static void dac_audio_set_rate(void) | |||
92 | wakeups_per_second = ktime_set(0, 1000000000 / rate); | 93 | wakeups_per_second = ktime_set(0, 1000000000 / rate); |
93 | } | 94 | } |
94 | 95 | ||
95 | static int dac_audio_ioctl(struct inode *inode, struct file *file, | 96 | static int dac_audio_ioctl(struct file *file, |
96 | unsigned int cmd, unsigned long arg) | 97 | unsigned int cmd, unsigned long arg) |
97 | { | 98 | { |
98 | int val; | 99 | int val; |
@@ -158,6 +159,17 @@ static int dac_audio_ioctl(struct inode *inode, struct file *file, | |||
158 | return -EINVAL; | 159 | return -EINVAL; |
159 | } | 160 | } |
160 | 161 | ||
162 | static long dac_audio_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | ||
163 | { | ||
164 | int ret; | ||
165 | |||
166 | lock_kernel(); | ||
167 | ret = dac_audio_ioctl(file, cmd, arg); | ||
168 | unlock_kernel(); | ||
169 | |||
170 | return ret; | ||
171 | } | ||
172 | |||
161 | static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, | 173 | static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, |
162 | loff_t * ppos) | 174 | loff_t * ppos) |
163 | { | 175 | { |
@@ -216,13 +228,17 @@ static int dac_audio_open(struct inode *inode, struct file *file) | |||
216 | { | 228 | { |
217 | if (file->f_mode & FMODE_READ) | 229 | if (file->f_mode & FMODE_READ) |
218 | return -ENODEV; | 230 | return -ENODEV; |
219 | if (in_use) | 231 | |
232 | lock_kernel(); | ||
233 | if (in_use) { | ||
234 | unlock_kernel(); | ||
220 | return -EBUSY; | 235 | return -EBUSY; |
236 | } | ||
221 | 237 | ||
222 | in_use = 1; | 238 | in_use = 1; |
223 | 239 | ||
224 | dac_audio_start(); | 240 | dac_audio_start(); |
225 | 241 | unlock_kernel(); | |
226 | return 0; | 242 | return 0; |
227 | } | 243 | } |
228 | 244 | ||
@@ -237,8 +253,8 @@ static int dac_audio_release(struct inode *inode, struct file *file) | |||
237 | 253 | ||
238 | const struct file_operations dac_audio_fops = { | 254 | const struct file_operations dac_audio_fops = { |
239 | .read = dac_audio_read, | 255 | .read = dac_audio_read, |
240 | .write = dac_audio_write, | 256 | .write = dac_audio_write, |
241 | .ioctl = dac_audio_ioctl, | 257 | .unlocked_ioctl = dac_audio_unlocked_ioctl, |
242 | .open = dac_audio_open, | 258 | .open = dac_audio_open, |
243 | .release = dac_audio_release, | 259 | .release = dac_audio_release, |
244 | }; | 260 | }; |