summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/bw-qcam.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-08-29 18:35:43 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-08-29 18:35:43 -0300
commite8beadde87198bcede646d9a96042f017d115d7b (patch)
tree49621d71d57cff7daacae777f234f62e00f6dd5a /linux/drivers/media/video/bw-qcam.c
parentb411ce2ea34831c61d02f0ce0278f525abd2e3c3 (diff)
parentfcf7b1133c054c011cd1cb75ac466333f61812f8 (diff)
downloadmediapointer-dvb-s2-e8beadde87198bcede646d9a96042f017d115d7b.tar.gz
mediapointer-dvb-s2-e8beadde87198bcede646d9a96042f017d115d7b.tar.bz2
merge? http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-empress
From: Mauro Carvalho Chehab <mchehab@infradead.org> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/bw-qcam.c')
-rw-r--r--linux/drivers/media/video/bw-qcam.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/linux/drivers/media/video/bw-qcam.c b/linux/drivers/media/video/bw-qcam.c
index 393113875..ca8fabdf3 100644
--- a/linux/drivers/media/video/bw-qcam.c
+++ b/linux/drivers/media/video/bw-qcam.c
@@ -895,10 +895,27 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
return len;
}
+static int qcam_exclusive_open(struct inode *inode, struct file *file)
+{
+ struct video_device *dev = video_devdata(file);
+ struct qcam_device *qcam = (struct qcam_device *)dev;
+
+ return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0;
+}
+
+static int qcam_exclusive_release(struct inode *inode, struct file *file)
+{
+ struct video_device *dev = video_devdata(file);
+ struct qcam_device *qcam = (struct qcam_device *)dev;
+
+ clear_bit(0, &qcam->in_use);
+ return 0;
+}
+
static const struct file_operations qcam_fops = {
.owner = THIS_MODULE,
- .open = video_exclusive_open,
- .release = video_exclusive_release,
+ .open = qcam_exclusive_open,
+ .release = qcam_exclusive_release,
.ioctl = qcam_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = v4l_compat_ioctl32,
@@ -910,6 +927,7 @@ static struct video_device qcam_template=
{
.name = "Connectix Quickcam",
.fops = &qcam_fops,
+ .release = video_device_release_empty,
};
#define MAX_CAMS 4
@@ -947,8 +965,7 @@ static int init_bwqcam(struct parport *port)
printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name);
- if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)
- {
+ if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) {
parport_unregister_device(qcam->pdev);
kfree(qcam);
return -ENODEV;