summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/c-qcam.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-23 10:31:47 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2008-08-23 10:31:47 +0200
commitebc50a51f87d69d522b94d64ec8d7da4df5bbb93 (patch)
treeda962ff624057233e60d7c090a7b18cb8aa9461d /linux/drivers/media/video/c-qcam.c
parentb5f5df65c8c54f89b3064a41b369a44f1883af0e (diff)
downloadmediapointer-dvb-s2-ebc50a51f87d69d522b94d64ec8d7da4df5bbb93.tar.gz
mediapointer-dvb-s2-ebc50a51f87d69d522b94d64ec8d7da4df5bbb93.tar.bz2
v4l: replace the last uses of video_exclusive_open/release
From: Hans Verkuil <hverkuil@xs4all.nl> Handle the video_exclusive_open/release functionality inside the driver. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/c-qcam.c')
-rw-r--r--linux/drivers/media/video/c-qcam.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/linux/drivers/media/video/c-qcam.c b/linux/drivers/media/video/c-qcam.c
index cfb269a0c..9d1587007 100644
--- a/linux/drivers/media/video/c-qcam.c
+++ b/linux/drivers/media/video/c-qcam.c
@@ -52,6 +52,7 @@ struct qcam_device {
int contrast, brightness, whitebal;
int top, left;
unsigned int bidirectional;
+ unsigned long in_use;
struct mutex lock;
};
@@ -688,11 +689,28 @@ 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;
+}
+
/* video device template */
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,