diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /drivers/media/video/pms.c | |
parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'drivers/media/video/pms.c')
-rw-r--r-- | drivers/media/video/pms.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 51b1461d8fb6..994807818aa2 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <asm/io.h> | 30 | #include <asm/io.h> |
31 | #include <linux/videodev.h> | 31 | #include <linux/videodev.h> |
32 | #include <media/v4l2-common.h> | 32 | #include <media/v4l2-common.h> |
33 | #include <media/v4l2-ioctl.h> | ||
33 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
34 | 35 | ||
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
@@ -46,6 +47,7 @@ struct pms_device | |||
46 | struct video_picture picture; | 47 | struct video_picture picture; |
47 | int height; | 48 | int height; |
48 | int width; | 49 | int width; |
50 | unsigned long in_use; | ||
49 | struct mutex lock; | 51 | struct mutex lock; |
50 | }; | 52 | }; |
51 | 53 | ||
@@ -880,10 +882,27 @@ static ssize_t pms_read(struct file *file, char __user *buf, | |||
880 | return len; | 882 | return len; |
881 | } | 883 | } |
882 | 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 | |||
883 | static const struct file_operations pms_fops = { | 902 | static const struct file_operations pms_fops = { |
884 | .owner = THIS_MODULE, | 903 | .owner = THIS_MODULE, |
885 | .open = video_exclusive_open, | 904 | .open = pms_exclusive_open, |
886 | .release = video_exclusive_release, | 905 | .release = pms_exclusive_release, |
887 | .ioctl = pms_ioctl, | 906 | .ioctl = pms_ioctl, |
888 | #ifdef CONFIG_COMPAT | 907 | #ifdef CONFIG_COMPAT |
889 | .compat_ioctl = v4l_compat_ioctl32, | 908 | .compat_ioctl = v4l_compat_ioctl32, |
@@ -894,10 +913,9 @@ static const struct file_operations pms_fops = { | |||
894 | 913 | ||
895 | static struct video_device pms_template= | 914 | static struct video_device pms_template= |
896 | { | 915 | { |
897 | .owner = THIS_MODULE, | ||
898 | .name = "Mediavision PMS", | 916 | .name = "Mediavision PMS", |
899 | .type = VID_TYPE_CAPTURE, | ||
900 | .fops = &pms_fops, | 917 | .fops = &pms_fops, |
918 | .release = video_device_release_empty, | ||
901 | }; | 919 | }; |
902 | 920 | ||
903 | static struct pms_device pms_device; | 921 | static struct pms_device pms_device; |
@@ -1020,10 +1038,23 @@ static int init_mediavision(void) | |||
1020 | * Initialization and module stuff | 1038 | * Initialization and module stuff |
1021 | */ | 1039 | */ |
1022 | 1040 | ||
1041 | #ifndef MODULE | ||
1042 | static int enable; | ||
1043 | module_param(enable, int, 0); | ||
1044 | #endif | ||
1045 | |||
1023 | static int __init init_pms_cards(void) | 1046 | static int __init init_pms_cards(void) |
1024 | { | 1047 | { |
1025 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); | 1048 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); |
1026 | 1049 | ||
1050 | #ifndef MODULE | ||
1051 | if (!enable) { | ||
1052 | printk(KERN_INFO "PMS: not enabled, use pms.enable=1 to " | ||
1053 | "probe\n"); | ||
1054 | return -ENODEV; | ||
1055 | } | ||
1056 | #endif | ||
1057 | |||
1027 | data_port = io_port +1; | 1058 | data_port = io_port +1; |
1028 | 1059 | ||
1029 | if(init_mediavision()) | 1060 | if(init_mediavision()) |