diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:03:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:03:59 -0400 |
commit | cf2fa66055d718ae13e62451bb546505f63906a2 (patch) | |
tree | e206d3f04e74a34e9aa88d21af6c26eea21d4121 /drivers/media/video/w9966.c | |
parent | 4501a466f28788485604ee42641d7a5fe7258d16 (diff) | |
parent | 57f51dbc45f65f7ee1e8c8f77200bb8000e3e271 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (313 commits)
V4L/DVB (9186): Added support for Prof 7300 DVB-S/S2 cards
V4L/DVB (9185): S2API: Ensure we have a reasonable ROLLOFF default
V4L/DVB (9184): cx24116: Change the default SNR units back to percentage by default.
V4L/DVB (9183): S2API: Return error of the caller provides 0 commands.
V4L/DVB (9182): S2API: Added support for DTV_HIERARCHY
V4L/DVB (9181): S2API: Add support fot DTV_GUARD_INTERVAL and DTV_TRANSMISSION_MODE
V4L/DVB (9180): S2API: Added support for DTV_CODE_RATE_HP/LP
V4L/DVB (9179): S2API: frontend.h cleanup
V4L/DVB (9178): cx24116: Add module parameter to return SNR as ESNO.
V4L/DVB (9177): S2API: Change _8PSK / _16APSK to PSK_8 and APSK_16
V4L/DVB (9176): Add support for DvbWorld USB cards with STV0288 demodulator.
V4L/DVB (9175): Remove NULL pointer in stb6000 driver.
V4L/DVB (9174): Allow custom inittab for ST STV0288 demodulator.
V4L/DVB (9173): S2API: Remove the hardcoded command limit during validation
V4L/DVB (9172): S2API: Bugfix related to DVB-S / DVB-S2 tuning for the legacy API.
V4L/DVB (9171): S2API: Stop an OOPS if illegal commands are dumped in S2API.
V4L/DVB (9170): cx24116: Sanity checking to data input via S2API to the cx24116 demod.
V4L/DVB (9169): uvcvideo: Support two new Bison Electronics webcams.
V4L/DVB (9168): Add support for MSI TV@nywhere Plus remote
V4L/DVB: v4l2-dev: remove duplicated #include
...
Diffstat (limited to 'drivers/media/video/w9966.c')
-rw-r--r-- | drivers/media/video/w9966.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 2ff00bc5ad64..b2dbe48a92bb 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
@@ -113,6 +113,7 @@ struct w9966_dev { | |||
113 | signed char contrast; | 113 | signed char contrast; |
114 | signed char color; | 114 | signed char color; |
115 | signed char hue; | 115 | signed char hue; |
116 | unsigned long in_use; | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | /* | 119 | /* |
@@ -184,10 +185,25 @@ static int w9966_v4l_ioctl(struct inode *inode, struct file *file, | |||
184 | static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | 185 | static ssize_t w9966_v4l_read(struct file *file, char __user *buf, |
185 | size_t count, loff_t *ppos); | 186 | size_t count, loff_t *ppos); |
186 | 187 | ||
188 | static int w9966_exclusive_open(struct inode *inode, struct file *file) | ||
189 | { | ||
190 | struct w9966_dev *cam = video_drvdata(file); | ||
191 | |||
192 | return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0; | ||
193 | } | ||
194 | |||
195 | static int w9966_exclusive_release(struct inode *inode, struct file *file) | ||
196 | { | ||
197 | struct w9966_dev *cam = video_drvdata(file); | ||
198 | |||
199 | clear_bit(0, &cam->in_use); | ||
200 | return 0; | ||
201 | } | ||
202 | |||
187 | static const struct file_operations w9966_fops = { | 203 | static const struct file_operations w9966_fops = { |
188 | .owner = THIS_MODULE, | 204 | .owner = THIS_MODULE, |
189 | .open = video_exclusive_open, | 205 | .open = w9966_exclusive_open, |
190 | .release = video_exclusive_release, | 206 | .release = w9966_exclusive_release, |
191 | .ioctl = w9966_v4l_ioctl, | 207 | .ioctl = w9966_v4l_ioctl, |
192 | #ifdef CONFIG_COMPAT | 208 | #ifdef CONFIG_COMPAT |
193 | .compat_ioctl = v4l_compat_ioctl32, | 209 | .compat_ioctl = v4l_compat_ioctl32, |
@@ -198,6 +214,7 @@ static const struct file_operations w9966_fops = { | |||
198 | static struct video_device w9966_template = { | 214 | static struct video_device w9966_template = { |
199 | .name = W9966_DRIVERNAME, | 215 | .name = W9966_DRIVERNAME, |
200 | .fops = &w9966_fops, | 216 | .fops = &w9966_fops, |
217 | .release = video_device_release_empty, | ||
201 | }; | 218 | }; |
202 | 219 | ||
203 | /* | 220 | /* |
@@ -332,7 +349,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
332 | 349 | ||
333 | // Fill in the video_device struct and register us to v4l | 350 | // Fill in the video_device struct and register us to v4l |
334 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); | 351 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); |
335 | cam->vdev.priv = cam; | 352 | video_set_drvdata(&cam->vdev, cam); |
336 | 353 | ||
337 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) | 354 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) |
338 | return -1; | 355 | return -1; |
@@ -713,8 +730,7 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data) | |||
713 | static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | 730 | static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, |
714 | unsigned int cmd, void *arg) | 731 | unsigned int cmd, void *arg) |
715 | { | 732 | { |
716 | struct video_device *vdev = video_devdata(file); | 733 | struct w9966_dev *cam = video_drvdata(file); |
717 | struct w9966_dev *cam = vdev->priv; | ||
718 | 734 | ||
719 | switch(cmd) | 735 | switch(cmd) |
720 | { | 736 | { |
@@ -872,8 +888,7 @@ static int w9966_v4l_ioctl(struct inode *inode, struct file *file, | |||
872 | static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | 888 | static ssize_t w9966_v4l_read(struct file *file, char __user *buf, |
873 | size_t count, loff_t *ppos) | 889 | size_t count, loff_t *ppos) |
874 | { | 890 | { |
875 | struct video_device *vdev = video_devdata(file); | 891 | struct w9966_dev *cam = video_drvdata(file); |
876 | struct w9966_dev *cam = vdev->priv; | ||
877 | unsigned char addr = 0xa0; // ECP, read, CCD-transfer, 00000 | 892 | unsigned char addr = 0xa0; // ECP, read, CCD-transfer, 00000 |
878 | unsigned char __user *dest = (unsigned char __user *)buf; | 893 | unsigned char __user *dest = (unsigned char __user *)buf; |
879 | unsigned long dleft = count; | 894 | unsigned long dleft = count; |