diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-02-07 03:49:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-02-07 03:49:14 -0500 |
commit | 3593cab5d62c4c7abced1076710f9bc2d8847433 (patch) | |
tree | dd5dc21961f6b4aef6900b0c2eb63ce7c70aecd5 /drivers/media/video/em28xx | |
parent | 538f9630afbbe429ecbcdcf92536200293a8e4b3 (diff) |
V4L/DVB (3318b): sem2mutex: drivers/media/, #2
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 106 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 3 |
2 files changed, 55 insertions, 54 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 1c1557d9bace..671fc52b6a88 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -362,12 +362,12 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
362 | return -EBUSY; | 362 | return -EBUSY; |
363 | } | 363 | } |
364 | 364 | ||
365 | init_MUTEX(&dev->fileop_lock); /* to 1 == available */ | 365 | mutex_init(&dev->fileop_lock); /* to 1 == available */ |
366 | spin_lock_init(&dev->queue_lock); | 366 | spin_lock_init(&dev->queue_lock); |
367 | init_waitqueue_head(&dev->wait_frame); | 367 | init_waitqueue_head(&dev->wait_frame); |
368 | init_waitqueue_head(&dev->wait_stream); | 368 | init_waitqueue_head(&dev->wait_stream); |
369 | 369 | ||
370 | down(&dev->lock); | 370 | mutex_lock(&dev->lock); |
371 | 371 | ||
372 | if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 372 | if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
373 | em28xx_set_alternate(dev); | 373 | em28xx_set_alternate(dev); |
@@ -404,8 +404,8 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
404 | 404 | ||
405 | dev->state |= DEV_INITIALIZED; | 405 | dev->state |= DEV_INITIALIZED; |
406 | 406 | ||
407 | err: | 407 | err: |
408 | up(&dev->lock); | 408 | mutex_unlock(&dev->lock); |
409 | up_read(&em28xx_disconnect); | 409 | up_read(&em28xx_disconnect); |
410 | return errCode; | 410 | return errCode; |
411 | } | 411 | } |
@@ -447,7 +447,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp) | |||
447 | 447 | ||
448 | em28xx_videodbg("users=%d\n", dev->users); | 448 | em28xx_videodbg("users=%d\n", dev->users); |
449 | 449 | ||
450 | down(&dev->lock); | 450 | mutex_lock(&dev->lock); |
451 | 451 | ||
452 | em28xx_uninit_isoc(dev); | 452 | em28xx_uninit_isoc(dev); |
453 | 453 | ||
@@ -456,7 +456,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp) | |||
456 | /* the device is already disconnect, free the remaining resources */ | 456 | /* the device is already disconnect, free the remaining resources */ |
457 | if (dev->state & DEV_DISCONNECTED) { | 457 | if (dev->state & DEV_DISCONNECTED) { |
458 | em28xx_release_resources(dev); | 458 | em28xx_release_resources(dev); |
459 | up(&dev->lock); | 459 | mutex_unlock(&dev->lock); |
460 | kfree(dev); | 460 | kfree(dev); |
461 | return 0; | 461 | return 0; |
462 | } | 462 | } |
@@ -472,7 +472,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp) | |||
472 | 472 | ||
473 | dev->users--; | 473 | dev->users--; |
474 | wake_up_interruptible_nr(&dev->open, 1); | 474 | wake_up_interruptible_nr(&dev->open, 1); |
475 | up(&dev->lock); | 475 | mutex_unlock(&dev->lock); |
476 | return 0; | 476 | return 0; |
477 | } | 477 | } |
478 | 478 | ||
@@ -496,7 +496,7 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, | |||
496 | em28xx_videodbg("V4L2_BUF_TYPE_VBI_CAPTURE is set\n"); | 496 | em28xx_videodbg("V4L2_BUF_TYPE_VBI_CAPTURE is set\n"); |
497 | em28xx_videodbg("not supported yet! ...\n"); | 497 | em28xx_videodbg("not supported yet! ...\n"); |
498 | if (copy_to_user(buf, "", 1)) { | 498 | if (copy_to_user(buf, "", 1)) { |
499 | up(&dev->fileop_lock); | 499 | mutex_unlock(&dev->fileop_lock); |
500 | return -EFAULT; | 500 | return -EFAULT; |
501 | } | 501 | } |
502 | return (1); | 502 | return (1); |
@@ -505,38 +505,38 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, | |||
505 | em28xx_videodbg("V4L2_BUF_TYPE_SLICED_VBI_CAPTURE is set\n"); | 505 | em28xx_videodbg("V4L2_BUF_TYPE_SLICED_VBI_CAPTURE is set\n"); |
506 | em28xx_videodbg("not supported yet! ...\n"); | 506 | em28xx_videodbg("not supported yet! ...\n"); |
507 | if (copy_to_user(buf, "", 1)) { | 507 | if (copy_to_user(buf, "", 1)) { |
508 | up(&dev->fileop_lock); | 508 | mutex_unlock(&dev->fileop_lock); |
509 | return -EFAULT; | 509 | return -EFAULT; |
510 | } | 510 | } |
511 | return (1); | 511 | return (1); |
512 | } | 512 | } |
513 | 513 | ||
514 | if (down_interruptible(&dev->fileop_lock)) | 514 | if (mutex_lock_interruptible(&dev->fileop_lock)) |
515 | return -ERESTARTSYS; | 515 | return -ERESTARTSYS; |
516 | 516 | ||
517 | if (dev->state & DEV_DISCONNECTED) { | 517 | if (dev->state & DEV_DISCONNECTED) { |
518 | em28xx_videodbg("device not present\n"); | 518 | em28xx_videodbg("device not present\n"); |
519 | up(&dev->fileop_lock); | 519 | mutex_unlock(&dev->fileop_lock); |
520 | return -ENODEV; | 520 | return -ENODEV; |
521 | } | 521 | } |
522 | 522 | ||
523 | if (dev->state & DEV_MISCONFIGURED) { | 523 | if (dev->state & DEV_MISCONFIGURED) { |
524 | em28xx_videodbg("device misconfigured; close and open it again\n"); | 524 | em28xx_videodbg("device misconfigured; close and open it again\n"); |
525 | up(&dev->fileop_lock); | 525 | mutex_unlock(&dev->fileop_lock); |
526 | return -EIO; | 526 | return -EIO; |
527 | } | 527 | } |
528 | 528 | ||
529 | if (dev->io == IO_MMAP) { | 529 | if (dev->io == IO_MMAP) { |
530 | em28xx_videodbg ("IO method is set to mmap; close and open" | 530 | em28xx_videodbg ("IO method is set to mmap; close and open" |
531 | " the device again to choose the read method\n"); | 531 | " the device again to choose the read method\n"); |
532 | up(&dev->fileop_lock); | 532 | mutex_unlock(&dev->fileop_lock); |
533 | return -EINVAL; | 533 | return -EINVAL; |
534 | } | 534 | } |
535 | 535 | ||
536 | if (dev->io == IO_NONE) { | 536 | if (dev->io == IO_NONE) { |
537 | if (!em28xx_request_buffers(dev, EM28XX_NUM_READ_FRAMES)) { | 537 | if (!em28xx_request_buffers(dev, EM28XX_NUM_READ_FRAMES)) { |
538 | em28xx_errdev("read failed, not enough memory\n"); | 538 | em28xx_errdev("read failed, not enough memory\n"); |
539 | up(&dev->fileop_lock); | 539 | mutex_unlock(&dev->fileop_lock); |
540 | return -ENOMEM; | 540 | return -ENOMEM; |
541 | } | 541 | } |
542 | dev->io = IO_READ; | 542 | dev->io = IO_READ; |
@@ -545,13 +545,13 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, | |||
545 | } | 545 | } |
546 | 546 | ||
547 | if (!count) { | 547 | if (!count) { |
548 | up(&dev->fileop_lock); | 548 | mutex_unlock(&dev->fileop_lock); |
549 | return 0; | 549 | return 0; |
550 | } | 550 | } |
551 | 551 | ||
552 | if (list_empty(&dev->outqueue)) { | 552 | if (list_empty(&dev->outqueue)) { |
553 | if (filp->f_flags & O_NONBLOCK) { | 553 | if (filp->f_flags & O_NONBLOCK) { |
554 | up(&dev->fileop_lock); | 554 | mutex_unlock(&dev->fileop_lock); |
555 | return -EAGAIN; | 555 | return -EAGAIN; |
556 | } | 556 | } |
557 | ret = wait_event_interruptible | 557 | ret = wait_event_interruptible |
@@ -559,11 +559,11 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, | |||
559 | (!list_empty(&dev->outqueue)) || | 559 | (!list_empty(&dev->outqueue)) || |
560 | (dev->state & DEV_DISCONNECTED)); | 560 | (dev->state & DEV_DISCONNECTED)); |
561 | if (ret) { | 561 | if (ret) { |
562 | up(&dev->fileop_lock); | 562 | mutex_unlock(&dev->fileop_lock); |
563 | return ret; | 563 | return ret; |
564 | } | 564 | } |
565 | if (dev->state & DEV_DISCONNECTED) { | 565 | if (dev->state & DEV_DISCONNECTED) { |
566 | up(&dev->fileop_lock); | 566 | mutex_unlock(&dev->fileop_lock); |
567 | return -ENODEV; | 567 | return -ENODEV; |
568 | } | 568 | } |
569 | } | 569 | } |
@@ -582,12 +582,12 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, | |||
582 | count = f->buf.length; | 582 | count = f->buf.length; |
583 | 583 | ||
584 | if (copy_to_user(buf, f->bufmem, count)) { | 584 | if (copy_to_user(buf, f->bufmem, count)) { |
585 | up(&dev->fileop_lock); | 585 | mutex_unlock(&dev->fileop_lock); |
586 | return -EFAULT; | 586 | return -EFAULT; |
587 | } | 587 | } |
588 | *f_pos += count; | 588 | *f_pos += count; |
589 | 589 | ||
590 | up(&dev->fileop_lock); | 590 | mutex_unlock(&dev->fileop_lock); |
591 | 591 | ||
592 | return count; | 592 | return count; |
593 | } | 593 | } |
@@ -601,7 +601,7 @@ static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait) | |||
601 | unsigned int mask = 0; | 601 | unsigned int mask = 0; |
602 | struct em28xx *dev = filp->private_data; | 602 | struct em28xx *dev = filp->private_data; |
603 | 603 | ||
604 | if (down_interruptible(&dev->fileop_lock)) | 604 | if (mutex_lock_interruptible(&dev->fileop_lock)) |
605 | return POLLERR; | 605 | return POLLERR; |
606 | 606 | ||
607 | if (dev->state & DEV_DISCONNECTED) { | 607 | if (dev->state & DEV_DISCONNECTED) { |
@@ -627,13 +627,13 @@ static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait) | |||
627 | if (!list_empty(&dev->outqueue)) | 627 | if (!list_empty(&dev->outqueue)) |
628 | mask |= POLLIN | POLLRDNORM; | 628 | mask |= POLLIN | POLLRDNORM; |
629 | 629 | ||
630 | up(&dev->fileop_lock); | 630 | mutex_unlock(&dev->fileop_lock); |
631 | 631 | ||
632 | return mask; | 632 | return mask; |
633 | } | 633 | } |
634 | } | 634 | } |
635 | 635 | ||
636 | up(&dev->fileop_lock); | 636 | mutex_unlock(&dev->fileop_lock); |
637 | return POLLERR; | 637 | return POLLERR; |
638 | } | 638 | } |
639 | 639 | ||
@@ -673,25 +673,25 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
673 | 673 | ||
674 | struct em28xx *dev = filp->private_data; | 674 | struct em28xx *dev = filp->private_data; |
675 | 675 | ||
676 | if (down_interruptible(&dev->fileop_lock)) | 676 | if (mutex_lock_interruptible(&dev->fileop_lock)) |
677 | return -ERESTARTSYS; | 677 | return -ERESTARTSYS; |
678 | 678 | ||
679 | if (dev->state & DEV_DISCONNECTED) { | 679 | if (dev->state & DEV_DISCONNECTED) { |
680 | em28xx_videodbg("mmap: device not present\n"); | 680 | em28xx_videodbg("mmap: device not present\n"); |
681 | up(&dev->fileop_lock); | 681 | mutex_unlock(&dev->fileop_lock); |
682 | return -ENODEV; | 682 | return -ENODEV; |
683 | } | 683 | } |
684 | 684 | ||
685 | if (dev->state & DEV_MISCONFIGURED) { | 685 | if (dev->state & DEV_MISCONFIGURED) { |
686 | em28xx_videodbg ("mmap: Device is misconfigured; close and " | 686 | em28xx_videodbg ("mmap: Device is misconfigured; close and " |
687 | "open it again\n"); | 687 | "open it again\n"); |
688 | up(&dev->fileop_lock); | 688 | mutex_unlock(&dev->fileop_lock); |
689 | return -EIO; | 689 | return -EIO; |
690 | } | 690 | } |
691 | 691 | ||
692 | if (dev->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) || | 692 | if (dev->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) || |
693 | size != PAGE_ALIGN(dev->frame[0].buf.length)) { | 693 | size != PAGE_ALIGN(dev->frame[0].buf.length)) { |
694 | up(&dev->fileop_lock); | 694 | mutex_unlock(&dev->fileop_lock); |
695 | return -EINVAL; | 695 | return -EINVAL; |
696 | } | 696 | } |
697 | 697 | ||
@@ -701,7 +701,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
701 | } | 701 | } |
702 | if (i == dev->num_frames) { | 702 | if (i == dev->num_frames) { |
703 | em28xx_videodbg("mmap: user supplied mapping address is out of range\n"); | 703 | em28xx_videodbg("mmap: user supplied mapping address is out of range\n"); |
704 | up(&dev->fileop_lock); | 704 | mutex_unlock(&dev->fileop_lock); |
705 | return -EINVAL; | 705 | return -EINVAL; |
706 | } | 706 | } |
707 | 707 | ||
@@ -713,7 +713,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
713 | while (size > 0) { /* size is page-aligned */ | 713 | while (size > 0) { /* size is page-aligned */ |
714 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { | 714 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { |
715 | em28xx_videodbg("mmap: vm_insert_page failed\n"); | 715 | em28xx_videodbg("mmap: vm_insert_page failed\n"); |
716 | up(&dev->fileop_lock); | 716 | mutex_unlock(&dev->fileop_lock); |
717 | return -EAGAIN; | 717 | return -EAGAIN; |
718 | } | 718 | } |
719 | start += PAGE_SIZE; | 719 | start += PAGE_SIZE; |
@@ -725,7 +725,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
725 | vma->vm_private_data = &dev->frame[i]; | 725 | vma->vm_private_data = &dev->frame[i]; |
726 | 726 | ||
727 | em28xx_vm_open(vma); | 727 | em28xx_vm_open(vma); |
728 | up(&dev->fileop_lock); | 728 | mutex_unlock(&dev->fileop_lock); |
729 | return 0; | 729 | return 0; |
730 | } | 730 | } |
731 | 731 | ||
@@ -1125,7 +1125,7 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
1125 | if (i == TVNORMS) | 1125 | if (i == TVNORMS) |
1126 | return -EINVAL; | 1126 | return -EINVAL; |
1127 | 1127 | ||
1128 | down(&dev->lock); | 1128 | mutex_lock(&dev->lock); |
1129 | dev->tvnorm = &tvnorms[i]; | 1129 | dev->tvnorm = &tvnorms[i]; |
1130 | 1130 | ||
1131 | em28xx_set_norm(dev, dev->width, dev->height); | 1131 | em28xx_set_norm(dev, dev->width, dev->height); |
@@ -1135,7 +1135,7 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
1135 | em28xx_i2c_call_clients(dev, VIDIOC_S_STD, | 1135 | em28xx_i2c_call_clients(dev, VIDIOC_S_STD, |
1136 | &dev->tvnorm->id); | 1136 | &dev->tvnorm->id); |
1137 | 1137 | ||
1138 | up(&dev->lock); | 1138 | mutex_unlock(&dev->lock); |
1139 | 1139 | ||
1140 | return 0; | 1140 | return 0; |
1141 | } | 1141 | } |
@@ -1189,9 +1189,9 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
1189 | if (0 == INPUT(*index)->type) | 1189 | if (0 == INPUT(*index)->type) |
1190 | return -EINVAL; | 1190 | return -EINVAL; |
1191 | 1191 | ||
1192 | down(&dev->lock); | 1192 | mutex_lock(&dev->lock); |
1193 | video_mux(dev, *index); | 1193 | video_mux(dev, *index); |
1194 | up(&dev->lock); | 1194 | mutex_unlock(&dev->lock); |
1195 | 1195 | ||
1196 | return 0; | 1196 | return 0; |
1197 | } | 1197 | } |
@@ -1338,10 +1338,10 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
1338 | /* t->signal = 0xffff;*/ | 1338 | /* t->signal = 0xffff;*/ |
1339 | /* em28xx_i2c_call_clients(dev,VIDIOC_G_TUNER,t);*/ | 1339 | /* em28xx_i2c_call_clients(dev,VIDIOC_G_TUNER,t);*/ |
1340 | /* No way to get signal strength? */ | 1340 | /* No way to get signal strength? */ |
1341 | down(&dev->lock); | 1341 | mutex_lock(&dev->lock); |
1342 | em28xx_i2c_call_clients(dev, DECODER_GET_STATUS, | 1342 | em28xx_i2c_call_clients(dev, DECODER_GET_STATUS, |
1343 | &status); | 1343 | &status); |
1344 | up(&dev->lock); | 1344 | mutex_unlock(&dev->lock); |
1345 | t->signal = | 1345 | t->signal = |
1346 | (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; | 1346 | (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; |
1347 | 1347 | ||
@@ -1363,10 +1363,10 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
1363 | t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */ | 1363 | t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */ |
1364 | /* t->signal = 0xffff; */ | 1364 | /* t->signal = 0xffff; */ |
1365 | /* No way to get signal strength? */ | 1365 | /* No way to get signal strength? */ |
1366 | down(&dev->lock); | 1366 | mutex_lock(&dev->lock); |
1367 | em28xx_i2c_call_clients(dev, DECODER_GET_STATUS, | 1367 | em28xx_i2c_call_clients(dev, DECODER_GET_STATUS, |
1368 | &status); | 1368 | &status); |
1369 | up(&dev->lock); | 1369 | mutex_unlock(&dev->lock); |
1370 | t->signal = | 1370 | t->signal = |
1371 | (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; | 1371 | (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; |
1372 | 1372 | ||
@@ -1394,10 +1394,10 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
1394 | if (V4L2_TUNER_ANALOG_TV != f->type) | 1394 | if (V4L2_TUNER_ANALOG_TV != f->type) |
1395 | return -EINVAL; | 1395 | return -EINVAL; |
1396 | 1396 | ||
1397 | down(&dev->lock); | 1397 | mutex_lock(&dev->lock); |
1398 | dev->ctl_freq = f->frequency; | 1398 | dev->ctl_freq = f->frequency; |
1399 | em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f); | 1399 | em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f); |
1400 | up(&dev->lock); | 1400 | mutex_unlock(&dev->lock); |
1401 | return 0; | 1401 | return 0; |
1402 | } | 1402 | } |
1403 | case VIDIOC_CROPCAP: | 1403 | case VIDIOC_CROPCAP: |
@@ -1660,25 +1660,25 @@ static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp, | |||
1660 | int ret = 0; | 1660 | int ret = 0; |
1661 | struct em28xx *dev = filp->private_data; | 1661 | struct em28xx *dev = filp->private_data; |
1662 | 1662 | ||
1663 | if (down_interruptible(&dev->fileop_lock)) | 1663 | if (mutex_lock_interruptible(&dev->fileop_lock)) |
1664 | return -ERESTARTSYS; | 1664 | return -ERESTARTSYS; |
1665 | 1665 | ||
1666 | if (dev->state & DEV_DISCONNECTED) { | 1666 | if (dev->state & DEV_DISCONNECTED) { |
1667 | em28xx_errdev("v4l2 ioctl: device not present\n"); | 1667 | em28xx_errdev("v4l2 ioctl: device not present\n"); |
1668 | up(&dev->fileop_lock); | 1668 | mutex_unlock(&dev->fileop_lock); |
1669 | return -ENODEV; | 1669 | return -ENODEV; |
1670 | } | 1670 | } |
1671 | 1671 | ||
1672 | if (dev->state & DEV_MISCONFIGURED) { | 1672 | if (dev->state & DEV_MISCONFIGURED) { |
1673 | em28xx_errdev | 1673 | em28xx_errdev |
1674 | ("v4l2 ioctl: device is misconfigured; close and open it again\n"); | 1674 | ("v4l2 ioctl: device is misconfigured; close and open it again\n"); |
1675 | up(&dev->fileop_lock); | 1675 | mutex_unlock(&dev->fileop_lock); |
1676 | return -EIO; | 1676 | return -EIO; |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | ret = video_usercopy(inode, filp, cmd, arg, em28xx_video_do_ioctl); | 1679 | ret = video_usercopy(inode, filp, cmd, arg, em28xx_video_do_ioctl); |
1680 | 1680 | ||
1681 | up(&dev->fileop_lock); | 1681 | mutex_unlock(&dev->fileop_lock); |
1682 | 1682 | ||
1683 | return ret; | 1683 | return ret; |
1684 | } | 1684 | } |
@@ -1712,7 +1712,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1712 | 1712 | ||
1713 | dev->udev = udev; | 1713 | dev->udev = udev; |
1714 | dev->model = model; | 1714 | dev->model = model; |
1715 | init_MUTEX(&dev->lock); | 1715 | mutex_init(&dev->lock); |
1716 | init_waitqueue_head(&dev->open); | 1716 | init_waitqueue_head(&dev->open); |
1717 | 1717 | ||
1718 | dev->em28xx_write_regs = em28xx_write_regs; | 1718 | dev->em28xx_write_regs = em28xx_write_regs; |
@@ -1788,7 +1788,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1788 | return -ENOMEM; | 1788 | return -ENOMEM; |
1789 | } | 1789 | } |
1790 | 1790 | ||
1791 | down(&dev->lock); | 1791 | mutex_lock(&dev->lock); |
1792 | /* register i2c bus */ | 1792 | /* register i2c bus */ |
1793 | em28xx_i2c_register(dev); | 1793 | em28xx_i2c_register(dev); |
1794 | 1794 | ||
@@ -1798,7 +1798,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1798 | /* configure the device */ | 1798 | /* configure the device */ |
1799 | em28xx_config_i2c(dev); | 1799 | em28xx_config_i2c(dev); |
1800 | 1800 | ||
1801 | up(&dev->lock); | 1801 | mutex_unlock(&dev->lock); |
1802 | 1802 | ||
1803 | errCode = em28xx_config(dev); | 1803 | errCode = em28xx_config(dev); |
1804 | 1804 | ||
@@ -1849,12 +1849,12 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1849 | list_add_tail(&dev->devlist,&em28xx_devlist); | 1849 | list_add_tail(&dev->devlist,&em28xx_devlist); |
1850 | 1850 | ||
1851 | /* register v4l2 device */ | 1851 | /* register v4l2 device */ |
1852 | down(&dev->lock); | 1852 | mutex_lock(&dev->lock); |
1853 | if ((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, | 1853 | if ((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, |
1854 | video_nr[dev->devno]))) { | 1854 | video_nr[dev->devno]))) { |
1855 | em28xx_errdev("unable to register video device (error=%i).\n", | 1855 | em28xx_errdev("unable to register video device (error=%i).\n", |
1856 | retval); | 1856 | retval); |
1857 | up(&dev->lock); | 1857 | mutex_unlock(&dev->lock); |
1858 | list_del(&dev->devlist); | 1858 | list_del(&dev->devlist); |
1859 | video_device_release(dev->vdev); | 1859 | video_device_release(dev->vdev); |
1860 | kfree(dev); | 1860 | kfree(dev); |
@@ -1865,7 +1865,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1865 | if (video_register_device(dev->vbi_dev, VFL_TYPE_VBI, | 1865 | if (video_register_device(dev->vbi_dev, VFL_TYPE_VBI, |
1866 | vbi_nr[dev->devno]) < 0) { | 1866 | vbi_nr[dev->devno]) < 0) { |
1867 | printk("unable to register vbi device\n"); | 1867 | printk("unable to register vbi device\n"); |
1868 | up(&dev->lock); | 1868 | mutex_unlock(&dev->lock); |
1869 | list_del(&dev->devlist); | 1869 | list_del(&dev->devlist); |
1870 | video_device_release(dev->vbi_dev); | 1870 | video_device_release(dev->vbi_dev); |
1871 | video_device_release(dev->vdev); | 1871 | video_device_release(dev->vdev); |
@@ -1886,7 +1886,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1886 | } | 1886 | } |
1887 | video_mux(dev, 0); | 1887 | video_mux(dev, 0); |
1888 | 1888 | ||
1889 | up(&dev->lock); | 1889 | mutex_unlock(&dev->lock); |
1890 | 1890 | ||
1891 | em28xx_info("V4L2 device registered as /dev/video%d and /dev/vbi%d\n", | 1891 | em28xx_info("V4L2 device registered as /dev/video%d and /dev/vbi%d\n", |
1892 | dev->vdev->minor-MINOR_VFL_TYPE_GRABBER_MIN, | 1892 | dev->vdev->minor-MINOR_VFL_TYPE_GRABBER_MIN, |
@@ -2035,7 +2035,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) | |||
2035 | 2035 | ||
2036 | down_write(&em28xx_disconnect); | 2036 | down_write(&em28xx_disconnect); |
2037 | 2037 | ||
2038 | down(&dev->lock); | 2038 | mutex_lock(&dev->lock); |
2039 | 2039 | ||
2040 | em28xx_info("disconnecting %s\n", dev->vdev->name); | 2040 | em28xx_info("disconnecting %s\n", dev->vdev->name); |
2041 | 2041 | ||
@@ -2057,7 +2057,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) | |||
2057 | em28xx_release_resources(dev); | 2057 | em28xx_release_resources(dev); |
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | up(&dev->lock); | 2060 | mutex_unlock(&dev->lock); |
2061 | 2061 | ||
2062 | if (!dev->users) { | 2062 | if (!dev->users) { |
2063 | kfree(dev->alt_max_pkt_size); | 2063 | kfree(dev->alt_max_pkt_size); |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index ddf06c520e99..4e2fe62b7350 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/videodev.h> | 28 | #include <linux/videodev.h> |
29 | #include <linux/i2c.h> | 29 | #include <linux/i2c.h> |
30 | #include <linux/mutex.h> | ||
30 | #include <media/ir-kbd-i2c.h> | 31 | #include <media/ir-kbd-i2c.h> |
31 | 32 | ||
32 | /* Boards supported by driver */ | 33 | /* Boards supported by driver */ |
@@ -260,7 +261,7 @@ struct em28xx { | |||
260 | enum em28xx_stream_state stream; | 261 | enum em28xx_stream_state stream; |
261 | enum em28xx_io_method io; | 262 | enum em28xx_io_method io; |
262 | /* locks */ | 263 | /* locks */ |
263 | struct semaphore lock, fileop_lock; | 264 | struct mutex lock, fileop_lock; |
264 | spinlock_t queue_lock; | 265 | spinlock_t queue_lock; |
265 | struct list_head inqueue, outqueue; | 266 | struct list_head inqueue, outqueue; |
266 | wait_queue_head_t open, wait_frame, wait_stream; | 267 | wait_queue_head_t open, wait_frame, wait_stream; |