aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-oss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-oss.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 7448e386a804..80e34a5fdcc5 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -254,7 +254,7 @@ static int dsp_open(struct inode *inode, struct file *file)
254 if (NULL == dev) 254 if (NULL == dev)
255 return -ENODEV; 255 return -ENODEV;
256 256
257 down(&dev->dmasound.lock); 257 mutex_lock(&dev->dmasound.lock);
258 err = -EBUSY; 258 err = -EBUSY;
259 if (dev->dmasound.users_dsp) 259 if (dev->dmasound.users_dsp)
260 goto fail1; 260 goto fail1;
@@ -270,13 +270,13 @@ static int dsp_open(struct inode *inode, struct file *file)
270 if (0 != err) 270 if (0 != err)
271 goto fail2; 271 goto fail2;
272 272
273 up(&dev->dmasound.lock); 273 mutex_unlock(&dev->dmasound.lock);
274 return 0; 274 return 0;
275 275
276 fail2: 276 fail2:
277 dev->dmasound.users_dsp--; 277 dev->dmasound.users_dsp--;
278 fail1: 278 fail1:
279 up(&dev->dmasound.lock); 279 mutex_unlock(&dev->dmasound.lock);
280 return err; 280 return err;
281} 281}
282 282
@@ -284,13 +284,13 @@ static int dsp_release(struct inode *inode, struct file *file)
284{ 284{
285 struct saa7134_dev *dev = file->private_data; 285 struct saa7134_dev *dev = file->private_data;
286 286
287 down(&dev->dmasound.lock); 287 mutex_lock(&dev->dmasound.lock);
288 if (dev->dmasound.recording_on) 288 if (dev->dmasound.recording_on)
289 dsp_rec_stop(dev); 289 dsp_rec_stop(dev);
290 dsp_buffer_free(dev); 290 dsp_buffer_free(dev);
291 dev->dmasound.users_dsp--; 291 dev->dmasound.users_dsp--;
292 file->private_data = NULL; 292 file->private_data = NULL;
293 up(&dev->dmasound.lock); 293 mutex_unlock(&dev->dmasound.lock);
294 return 0; 294 return 0;
295} 295}
296 296
@@ -304,7 +304,7 @@ static ssize_t dsp_read(struct file *file, char __user *buffer,
304 int err,ret = 0; 304 int err,ret = 0;
305 305
306 add_wait_queue(&dev->dmasound.wq, &wait); 306 add_wait_queue(&dev->dmasound.wq, &wait);
307 down(&dev->dmasound.lock); 307 mutex_lock(&dev->dmasound.lock);
308 while (count > 0) { 308 while (count > 0) {
309 /* wait for data if needed */ 309 /* wait for data if needed */
310 if (0 == dev->dmasound.read_count) { 310 if (0 == dev->dmasound.read_count) {
@@ -328,12 +328,12 @@ static ssize_t dsp_read(struct file *file, char __user *buffer,
328 ret = -EAGAIN; 328 ret = -EAGAIN;
329 break; 329 break;
330 } 330 }
331 up(&dev->dmasound.lock); 331 mutex_unlock(&dev->dmasound.lock);
332 set_current_state(TASK_INTERRUPTIBLE); 332 set_current_state(TASK_INTERRUPTIBLE);
333 if (0 == dev->dmasound.read_count) 333 if (0 == dev->dmasound.read_count)
334 schedule(); 334 schedule();
335 set_current_state(TASK_RUNNING); 335 set_current_state(TASK_RUNNING);
336 down(&dev->dmasound.lock); 336 mutex_lock(&dev->dmasound.lock);
337 if (signal_pending(current)) { 337 if (signal_pending(current)) {
338 if (0 == ret) 338 if (0 == ret)
339 ret = -EINTR; 339 ret = -EINTR;
@@ -362,7 +362,7 @@ static ssize_t dsp_read(struct file *file, char __user *buffer,
362 if (dev->dmasound.read_offset == dev->dmasound.bufsize) 362 if (dev->dmasound.read_offset == dev->dmasound.bufsize)
363 dev->dmasound.read_offset = 0; 363 dev->dmasound.read_offset = 0;
364 } 364 }
365 up(&dev->dmasound.lock); 365 mutex_unlock(&dev->dmasound.lock);
366 remove_wait_queue(&dev->dmasound.wq, &wait); 366 remove_wait_queue(&dev->dmasound.wq, &wait);
367 return ret; 367 return ret;
368} 368}
@@ -435,13 +435,13 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
435 case SNDCTL_DSP_STEREO: 435 case SNDCTL_DSP_STEREO:
436 if (get_user(val, p)) 436 if (get_user(val, p))
437 return -EFAULT; 437 return -EFAULT;
438 down(&dev->dmasound.lock); 438 mutex_lock(&dev->dmasound.lock);
439 dev->dmasound.channels = val ? 2 : 1; 439 dev->dmasound.channels = val ? 2 : 1;
440 if (dev->dmasound.recording_on) { 440 if (dev->dmasound.recording_on) {
441 dsp_rec_stop(dev); 441 dsp_rec_stop(dev);
442 dsp_rec_start(dev); 442 dsp_rec_start(dev);
443 } 443 }
444 up(&dev->dmasound.lock); 444 mutex_unlock(&dev->dmasound.lock);
445 return put_user(dev->dmasound.channels-1, p); 445 return put_user(dev->dmasound.channels-1, p);
446 446
447 case SNDCTL_DSP_CHANNELS: 447 case SNDCTL_DSP_CHANNELS:
@@ -449,13 +449,13 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
449 return -EFAULT; 449 return -EFAULT;
450 if (val != 1 && val != 2) 450 if (val != 1 && val != 2)
451 return -EINVAL; 451 return -EINVAL;
452 down(&dev->dmasound.lock); 452 mutex_lock(&dev->dmasound.lock);
453 dev->dmasound.channels = val; 453 dev->dmasound.channels = val;
454 if (dev->dmasound.recording_on) { 454 if (dev->dmasound.recording_on) {
455 dsp_rec_stop(dev); 455 dsp_rec_stop(dev);
456 dsp_rec_start(dev); 456 dsp_rec_start(dev);
457 } 457 }
458 up(&dev->dmasound.lock); 458 mutex_unlock(&dev->dmasound.lock);
459 /* fall through */ 459 /* fall through */
460 case SOUND_PCM_READ_CHANNELS: 460 case SOUND_PCM_READ_CHANNELS:
461 return put_user(dev->dmasound.channels, p); 461 return put_user(dev->dmasound.channels, p);
@@ -478,13 +478,13 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
478 case AFMT_U16_BE: 478 case AFMT_U16_BE:
479 case AFMT_S16_LE: 479 case AFMT_S16_LE:
480 case AFMT_S16_BE: 480 case AFMT_S16_BE:
481 down(&dev->dmasound.lock); 481 mutex_lock(&dev->dmasound.lock);
482 dev->dmasound.afmt = val; 482 dev->dmasound.afmt = val;
483 if (dev->dmasound.recording_on) { 483 if (dev->dmasound.recording_on) {
484 dsp_rec_stop(dev); 484 dsp_rec_stop(dev);
485 dsp_rec_start(dev); 485 dsp_rec_start(dev);
486 } 486 }
487 up(&dev->dmasound.lock); 487 mutex_unlock(&dev->dmasound.lock);
488 return put_user(dev->dmasound.afmt, p); 488 return put_user(dev->dmasound.afmt, p);
489 default: 489 default:
490 return -EINVAL; 490 return -EINVAL;
@@ -509,10 +509,10 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
509 return 0; 509 return 0;
510 510
511 case SNDCTL_DSP_RESET: 511 case SNDCTL_DSP_RESET:
512 down(&dev->dmasound.lock); 512 mutex_lock(&dev->dmasound.lock);
513 if (dev->dmasound.recording_on) 513 if (dev->dmasound.recording_on)
514 dsp_rec_stop(dev); 514 dsp_rec_stop(dev);
515 up(&dev->dmasound.lock); 515 mutex_unlock(&dev->dmasound.lock);
516 return 0; 516 return 0;
517 case SNDCTL_DSP_GETBLKSIZE: 517 case SNDCTL_DSP_GETBLKSIZE:
518 return put_user(dev->dmasound.blksize, p); 518 return put_user(dev->dmasound.blksize, p);
@@ -556,10 +556,10 @@ static unsigned int dsp_poll(struct file *file, struct poll_table_struct *wait)
556 poll_wait(file, &dev->dmasound.wq, wait); 556 poll_wait(file, &dev->dmasound.wq, wait);
557 557
558 if (0 == dev->dmasound.read_count) { 558 if (0 == dev->dmasound.read_count) {
559 down(&dev->dmasound.lock); 559 mutex_lock(&dev->dmasound.lock);
560 if (!dev->dmasound.recording_on) 560 if (!dev->dmasound.recording_on)
561 dsp_rec_start(dev); 561 dsp_rec_start(dev);
562 up(&dev->dmasound.lock); 562 mutex_unlock(&dev->dmasound.lock);
563 } else 563 } else
564 mask |= (POLLIN | POLLRDNORM); 564 mask |= (POLLIN | POLLRDNORM);
565 return mask; 565 return mask;
@@ -852,7 +852,7 @@ int saa7134_oss_init1(struct saa7134_dev *dev)
852 return -1; 852 return -1;
853 853
854 /* general */ 854 /* general */
855 init_MUTEX(&dev->dmasound.lock); 855 mutex_init(&dev->dmasound.lock);
856 init_waitqueue_head(&dev->dmasound.wq); 856 init_waitqueue_head(&dev->dmasound.wq);
857 857
858 switch (dev->pci->device) { 858 switch (dev->pci->device) {