From 7d43cd53c851e3cf04d73108d4e7e25a1104c6f5 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 05:31:47 -0300 Subject: 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pms.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'drivers/media/video/pms.c') 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 struct video_picture picture; int height; int width; + unsigned long in_use; struct mutex lock; }; @@ -881,10 +882,27 @@ static ssize_t pms_read(struct file *file, char __user *buf, return len; } +static int pms_exclusive_open(struct inode *inode, struct file *file) +{ + struct video_device *v = video_devdata(file); + struct pms_device *pd = (struct pms_device *)v; + + return test_and_set_bit(0, &pd->in_use) ? -EBUSY : 0; +} + +static int pms_exclusive_release(struct inode *inode, struct file *file) +{ + struct video_device *v = video_devdata(file); + struct pms_device *pd = (struct pms_device *)v; + + clear_bit(0, &pd->in_use); + return 0; +} + static const struct file_operations pms_fops = { .owner = THIS_MODULE, - .open = video_exclusive_open, - .release = video_exclusive_release, + .open = pms_exclusive_open, + .release = pms_exclusive_release, .ioctl = pms_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = v4l_compat_ioctl32, -- cgit v1.2.2 From aa5e90af7d78d1711f8f4275ce3638817c0023dc Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 06:23:55 -0300 Subject: V4L/DVB (8783): v4l: add all missing video_device release callbacks All drivers that call video_device_register where checked to see if they set the release callback of struct video_device. Where that callback was missing it was added. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pms.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media/video/pms.c') diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index b39794f0baf5..994807818aa2 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c @@ -915,6 +915,7 @@ static struct video_device pms_template= { .name = "Mediavision PMS", .fops = &pms_fops, + .release = video_device_release_empty, }; static struct pms_device pms_device; -- cgit v1.2.2