aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/dabusb.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/media/video/dabusb.c b/drivers/media/video/dabusb.c
index 5b176bd7afdb..f3e25e91366d 100644
--- a/drivers/media/video/dabusb.c
+++ b/drivers/media/video/dabusb.c
@@ -32,7 +32,6 @@
32#include <linux/list.h> 32#include <linux/list.h>
33#include <linux/vmalloc.h> 33#include <linux/vmalloc.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/smp_lock.h>
36#include <linux/init.h> 35#include <linux/init.h>
37#include <asm/uaccess.h> 36#include <asm/uaccess.h>
38#include <asm/atomic.h> 37#include <asm/atomic.h>
@@ -621,7 +620,6 @@ static int dabusb_open (struct inode *inode, struct file *file)
621 if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB)) 620 if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
622 return -EIO; 621 return -EIO;
623 622
624 lock_kernel();
625 s = &dabusb[devnum - DABUSB_MINOR]; 623 s = &dabusb[devnum - DABUSB_MINOR];
626 624
627 dbg("dabusb_open"); 625 dbg("dabusb_open");
@@ -630,21 +628,17 @@ static int dabusb_open (struct inode *inode, struct file *file)
630 while (!s->usbdev || s->opened) { 628 while (!s->usbdev || s->opened) {
631 mutex_unlock(&s->mutex); 629 mutex_unlock(&s->mutex);
632 630
633 if (file->f_flags & O_NONBLOCK) { 631 if (file->f_flags & O_NONBLOCK)
634 return -EBUSY; 632 return -EBUSY;
635 }
636 msleep_interruptible(500); 633 msleep_interruptible(500);
637 634
638 if (signal_pending (current)) { 635 if (signal_pending (current))
639 unlock_kernel();
640 return -EAGAIN; 636 return -EAGAIN;
641 }
642 mutex_lock(&s->mutex); 637 mutex_lock(&s->mutex);
643 } 638 }
644 if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) { 639 if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
645 mutex_unlock(&s->mutex); 640 mutex_unlock(&s->mutex);
646 dev_err(&s->usbdev->dev, "set_interface failed\n"); 641 dev_err(&s->usbdev->dev, "set_interface failed\n");
647 unlock_kernel();
648 return -EINVAL; 642 return -EINVAL;
649 } 643 }
650 s->opened = 1; 644 s->opened = 1;
@@ -654,7 +648,6 @@ static int dabusb_open (struct inode *inode, struct file *file)
654 file->private_data = s; 648 file->private_data = s;
655 649
656 r = nonseekable_open(inode, file); 650 r = nonseekable_open(inode, file);
657 unlock_kernel();
658 return r; 651 return r;
659} 652}
660 653
@@ -689,17 +682,13 @@ static long dabusb_ioctl (struct file *file, unsigned int cmd, unsigned long arg
689 682
690 dbg("dabusb_ioctl"); 683 dbg("dabusb_ioctl");
691 684
692 lock_kernel(); 685 if (s->remove_pending)
693 if (s->remove_pending) {
694 unlock_kernel();
695 return -EIO; 686 return -EIO;
696 }
697 687
698 mutex_lock(&s->mutex); 688 mutex_lock(&s->mutex);
699 689
700 if (!s->usbdev) { 690 if (!s->usbdev) {
701 mutex_unlock(&s->mutex); 691 mutex_unlock(&s->mutex);
702 unlock_kernel();
703 return -EIO; 692 return -EIO;
704 } 693 }
705 694
@@ -735,7 +724,6 @@ static long dabusb_ioctl (struct file *file, unsigned int cmd, unsigned long arg
735 break; 724 break;
736 } 725 }
737 mutex_unlock(&s->mutex); 726 mutex_unlock(&s->mutex);
738 unlock_kernel();
739 return ret; 727 return ret;
740} 728}
741 729