X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fpms.c;h=994807818aa26eacd2ffc09920445d2cc69f58d9;hb=9ca59f4c3d28df14a1545a1e2832f34a0a50e3ed;hp=7c84f795db54bcb188d39b541cb0f1f673246c8c;hpb=b6825d2df55aa7d7341c715b577b73a6a03dc944;p=linux-2.6-omap-h63xx.git diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 7c84f795db5..994807818aa 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, @@ -897,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;