diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-08-23 04:31:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:53 -0400 |
commit | 7d43cd53c851e3cf04d73108d4e7e25a1104c6f5 (patch) | |
tree | 4fcf2e3148065f1727b630deefef9612610bf789 /drivers/media/video/pms.c | |
parent | 2f3d00250ae5b1d2727e2723da805290ec408503 (diff) |
V4L/DVB (8780): v4l: replace the last uses of video_exclusive_open/release
Handle the video_exclusive_open/release functionality inside the
driver.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pms.c')
-rw-r--r-- | drivers/media/video/pms.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 7c84f795db54..b39794f0baf5 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
@@ -47,6 +47,7 @@ struct pms_device | |||
47 | struct video_picture picture; | 47 | struct video_picture picture; |
48 | int height; | 48 | int height; |
49 | int width; | 49 | int width; |
50 | unsigned long in_use; | ||
50 | struct mutex lock; | 51 | struct mutex lock; |
51 | }; | 52 | }; |
52 | 53 | ||
@@ -881,10 +882,27 @@ static ssize_t pms_read(struct file *file, char __user *buf, | |||
881 | return len; | 882 | return len; |
882 | } | 883 | } |
883 | 884 | ||
885 | static int pms_exclusive_open(struct inode *inode, struct file *file) | ||
886 | { | ||
887 | struct video_device *v = video_devdata(file); | ||
888 | struct pms_device *pd = (struct pms_device *)v; | ||
889 | |||
890 | return test_and_set_bit(0, &pd->in_use) ? -EBUSY : 0; | ||
891 | } | ||
892 | |||
893 | static int pms_exclusive_release(struct inode *inode, struct file *file) | ||
894 | { | ||
895 | struct video_device *v = video_devdata(file); | ||
896 | struct pms_device *pd = (struct pms_device *)v; | ||
897 | |||
898 | clear_bit(0, &pd->in_use); | ||
899 | return 0; | ||
900 | } | ||
901 | |||
884 | static const struct file_operations pms_fops = { | 902 | static const struct file_operations pms_fops = { |
885 | .owner = THIS_MODULE, | 903 | .owner = THIS_MODULE, |
886 | .open = video_exclusive_open, | 904 | .open = pms_exclusive_open, |
887 | .release = video_exclusive_release, | 905 | .release = pms_exclusive_release, |
888 | .ioctl = pms_ioctl, | 906 | .ioctl = pms_ioctl, |
889 | #ifdef CONFIG_COMPAT | 907 | #ifdef CONFIG_COMPAT |
890 | .compat_ioctl = v4l_compat_ioctl32, | 908 | .compat_ioctl = v4l_compat_ioctl32, |