summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pms.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/pms.c')
-rw-r--r--linux/drivers/media/video/pms.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/linux/drivers/media/video/pms.c b/linux/drivers/media/video/pms.c
index 31d8a929f..00b623e00 100644
--- a/linux/drivers/media/video/pms.c
+++ b/linux/drivers/media/video/pms.c
@@ -48,6 +48,7 @@ struct pms_device
struct video_picture picture;
int height;
int width;
+ unsigned long in_use;
struct mutex lock;
};
@@ -882,10 +883,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,
@@ -896,10 +914,9 @@ static const struct file_operations pms_fops = {
static struct video_device pms_template=
{
- .owner = THIS_MODULE,
.name = "Mediavision PMS",
- .type = VID_TYPE_CAPTURE,
.fops = &pms_fops,
+ .release = video_device_release_empty,
};
static struct pms_device pms_device;
@@ -1022,10 +1039,23 @@ static int init_mediavision(void)
* Initialization and module stuff
*/
+#ifndef MODULE
+static int enable;
+module_param(enable, int, 0);
+#endif
+
static int __init init_pms_cards(void)
{
printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n");
+#ifndef MODULE
+ if (!enable) {
+ printk(KERN_INFO "PMS: not enabled, use pms.enable=1 to "
+ "probe\n");
+ return -ENODEV;
+ }
+#endif
+
data_port = io_port +1;
if(init_mediavision())