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/arv.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/arv.c')
-rw-r--r-- | drivers/media/video/arv.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 9e436ad3d34b..0d4f9b683459 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c | |||
@@ -116,6 +116,7 @@ struct ar_device { | |||
116 | int width, height; | 116 | int width, height; |
117 | int frame_bytes, line_bytes; | 117 | int frame_bytes, line_bytes; |
118 | wait_queue_head_t wait; | 118 | wait_queue_head_t wait; |
119 | unsigned long in_use; | ||
119 | struct mutex lock; | 120 | struct mutex lock; |
120 | }; | 121 | }; |
121 | 122 | ||
@@ -742,10 +743,23 @@ void ar_release(struct video_device *vfd) | |||
742 | * Video4Linux Module functions | 743 | * Video4Linux Module functions |
743 | * | 744 | * |
744 | ****************************************************************************/ | 745 | ****************************************************************************/ |
746 | static struct ar_device ardev; | ||
747 | |||
748 | static int ar_exclusive_open(struct inode *inode, struct file *file) | ||
749 | { | ||
750 | return test_and_set_bit(0, &ardev.in_use) ? -EBUSY : 0; | ||
751 | } | ||
752 | |||
753 | static int ar_exclusive_release(struct inode *inode, struct file *file) | ||
754 | { | ||
755 | clear_bit(0, &ardev.in_use); | ||
756 | return 0; | ||
757 | } | ||
758 | |||
745 | static const struct file_operations ar_fops = { | 759 | static const struct file_operations ar_fops = { |
746 | .owner = THIS_MODULE, | 760 | .owner = THIS_MODULE, |
747 | .open = video_exclusive_open, | 761 | .open = ar_exclusive_open, |
748 | .release = video_exclusive_release, | 762 | .release = ar_exclusive_release, |
749 | .read = ar_read, | 763 | .read = ar_read, |
750 | .ioctl = ar_ioctl, | 764 | .ioctl = ar_ioctl, |
751 | #ifdef CONFIG_COMPAT | 765 | #ifdef CONFIG_COMPAT |
@@ -762,7 +776,6 @@ static struct video_device ar_template = { | |||
762 | }; | 776 | }; |
763 | 777 | ||
764 | #define ALIGN4(x) ((((int)(x)) & 0x3) == 0) | 778 | #define ALIGN4(x) ((((int)(x)) & 0x3) == 0) |
765 | static struct ar_device ardev; | ||
766 | 779 | ||
767 | static int __init ar_init(void) | 780 | static int __init ar_init(void) |
768 | { | 781 | { |