aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/c-qcam.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/c-qcam.c')
-rw-r--r--drivers/media/video/c-qcam.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index 7f6c6b4bec10..17aa0adb3467 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -51,6 +51,7 @@ struct qcam_device {
51 int contrast, brightness, whitebal; 51 int contrast, brightness, whitebal;
52 int top, left; 52 int top, left;
53 unsigned int bidirectional; 53 unsigned int bidirectional;
54 unsigned long in_use;
54 struct mutex lock; 55 struct mutex lock;
55}; 56};
56 57
@@ -687,11 +688,28 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
687 return len; 688 return len;
688} 689}
689 690
691static int qcam_exclusive_open(struct inode *inode, struct file *file)
692{
693 struct video_device *dev = video_devdata(file);
694 struct qcam_device *qcam = (struct qcam_device *)dev;
695
696 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0;
697}
698
699static int qcam_exclusive_release(struct inode *inode, struct file *file)
700{
701 struct video_device *dev = video_devdata(file);
702 struct qcam_device *qcam = (struct qcam_device *)dev;
703
704 clear_bit(0, &qcam->in_use);
705 return 0;
706}
707
690/* video device template */ 708/* video device template */
691static const struct file_operations qcam_fops = { 709static const struct file_operations qcam_fops = {
692 .owner = THIS_MODULE, 710 .owner = THIS_MODULE,
693 .open = video_exclusive_open, 711 .open = qcam_exclusive_open,
694 .release = video_exclusive_release, 712 .release = qcam_exclusive_release,
695 .ioctl = qcam_ioctl, 713 .ioctl = qcam_ioctl,
696#ifdef CONFIG_COMPAT 714#ifdef CONFIG_COMPAT
697 .compat_ioctl = v4l_compat_ioctl32, 715 .compat_ioctl = v4l_compat_ioctl32,
@@ -704,6 +722,7 @@ static struct video_device qcam_template=
704{ 722{
705 .name = "Colour QuickCam", 723 .name = "Colour QuickCam",
706 .fops = &qcam_fops, 724 .fops = &qcam_fops,
725 .release = video_device_release_empty,
707}; 726};
708 727
709/* Initialize the QuickCam driver control structure. */ 728/* Initialize the QuickCam driver control structure. */