diff options
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cafe_ccic.c | 1 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-dvb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 9 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-gpio.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 5 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-irq.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-queue.c | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-yuv.c | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtvfb.c | 3 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_driver.c | 9 | ||||
-rw-r--r-- | drivers/media/video/uvc/uvc_video.c | 2 | ||||
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 45 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 28 |
13 files changed, 76 insertions, 40 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 5f582726985d..c4d181dde1ca 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -774,6 +774,7 @@ static int cafe_cam_init(struct cafe_camera *cam) | |||
774 | ret = __cafe_cam_reset(cam); | 774 | ret = __cafe_cam_reset(cam); |
775 | if (ret) | 775 | if (ret) |
776 | goto out; | 776 | goto out; |
777 | chip.ident = V4L2_IDENT_NONE; | ||
777 | chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; | 778 | chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; |
778 | chip.match.addr = cam->sensor_addr; | 779 | chip.match.addr = cam->sensor_addr; |
779 | ret = sensor_call(cam, core, g_chip_ident, &chip); | 780 | ret = sensor_call(cam, core, g_chip_ident, &chip); |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 0c49a98213c4..1dc070da8652 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -472,7 +472,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
472 | static struct xc2028_ctrl ctl = { | 472 | static struct xc2028_ctrl ctl = { |
473 | .fname = XC2028_DEFAULT_FIRMWARE, | 473 | .fname = XC2028_DEFAULT_FIRMWARE, |
474 | .max_len = 64, | 474 | .max_len = 64, |
475 | .scode_table = XC3028_FE_OREN538, | 475 | .demod = XC3028_FE_OREN538, |
476 | }; | 476 | }; |
477 | 477 | ||
478 | fe = dvb_attach(xc2028_attach, | 478 | fe = dvb_attach(xc2028_attach, |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index b0195e8ee4d1..db2ac9a99acd 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -305,14 +305,17 @@ int ivtv_waitq(wait_queue_head_t *waitq) | |||
305 | /* Generic utility functions */ | 305 | /* Generic utility functions */ |
306 | int ivtv_msleep_timeout(unsigned int msecs, int intr) | 306 | int ivtv_msleep_timeout(unsigned int msecs, int intr) |
307 | { | 307 | { |
308 | int ret; | ||
309 | int timeout = msecs_to_jiffies(msecs); | 308 | int timeout = msecs_to_jiffies(msecs); |
310 | 309 | ||
311 | do { | 310 | do { |
312 | set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); | 311 | set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); |
313 | timeout = schedule_timeout(timeout); | 312 | timeout = schedule_timeout(timeout); |
314 | if (intr && (ret = signal_pending(current))) | 313 | if (intr) { |
315 | return ret; | 314 | int ret = signal_pending(current); |
315 | |||
316 | if (ret) | ||
317 | return ret; | ||
318 | } | ||
316 | } while (timeout); | 319 | } while (timeout); |
317 | return 0; | 320 | return 0; |
318 | } | 321 | } |
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c index ceb05bdcaf62..85ac707228e7 100644 --- a/drivers/media/video/ivtv/ivtv-gpio.c +++ b/drivers/media/video/ivtv/ivtv-gpio.c | |||
@@ -190,8 +190,8 @@ static int subdev_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) | |||
190 | 190 | ||
191 | mask = itv->card->gpio_audio_detect.mask; | 191 | mask = itv->card->gpio_audio_detect.mask; |
192 | if (mask == 0 || (read_reg(IVTV_REG_GPIO_IN) & mask)) | 192 | if (mask == 0 || (read_reg(IVTV_REG_GPIO_IN) & mask)) |
193 | vt->rxsubchans = V4L2_TUNER_MODE_STEREO | | 193 | vt->rxsubchans = V4L2_TUNER_SUB_STEREO | |
194 | V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; | 194 | V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
195 | else | 195 | else |
196 | vt->rxsubchans = V4L2_TUNER_SUB_MONO; | 196 | vt->rxsubchans = V4L2_TUNER_SUB_MONO; |
197 | return 0; | 197 | return 0; |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 4a2d464f055e..c342a9fe983e 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -180,7 +180,7 @@ int ivtv_set_speed(struct ivtv *itv, int speed) | |||
180 | 180 | ||
181 | /* Wait for any DMA to finish */ | 181 | /* Wait for any DMA to finish */ |
182 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); | 182 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); |
183 | while (itv->i_flags & IVTV_F_I_DMA) { | 183 | while (test_bit(IVTV_F_I_DMA, &itv->i_flags)) { |
184 | got_sig = signal_pending(current); | 184 | got_sig = signal_pending(current); |
185 | if (got_sig) | 185 | if (got_sig) |
186 | break; | 186 | break; |
@@ -1710,7 +1710,8 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1710 | we are waiting unlock first and later lock again. */ | 1710 | we are waiting unlock first and later lock again. */ |
1711 | mutex_unlock(&itv->serialize_lock); | 1711 | mutex_unlock(&itv->serialize_lock); |
1712 | prepare_to_wait(&itv->event_waitq, &wait, TASK_INTERRUPTIBLE); | 1712 | prepare_to_wait(&itv->event_waitq, &wait, TASK_INTERRUPTIBLE); |
1713 | if ((itv->i_flags & (IVTV_F_I_EV_DEC_STOPPED|IVTV_F_I_EV_VSYNC)) == 0) | 1713 | if (!test_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags) && |
1714 | !test_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags)) | ||
1714 | schedule(); | 1715 | schedule(); |
1715 | finish_wait(&itv->event_waitq, &wait); | 1716 | finish_wait(&itv->event_waitq, &wait); |
1716 | mutex_lock(&itv->serialize_lock); | 1717 | mutex_lock(&itv->serialize_lock); |
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index 01c14d2b381a..cd9db0bf33bf 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c | |||
@@ -196,7 +196,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA | |||
196 | bytes_needed, s->name); | 196 | bytes_needed, s->name); |
197 | return -1; | 197 | return -1; |
198 | } | 198 | } |
199 | if (rc && !s->buffers_stolen && (s->s_flags & IVTV_F_S_APPL_IO)) { | 199 | if (rc && !s->buffers_stolen && test_bit(IVTV_F_S_APPL_IO, &s->s_flags)) { |
200 | IVTV_WARN("All %s stream buffers are full. Dropping data.\n", s->name); | 200 | IVTV_WARN("All %s stream buffers are full. Dropping data.\n", s->name); |
201 | IVTV_WARN("Cause: the application is not reading fast enough.\n"); | 201 | IVTV_WARN("Cause: the application is not reading fast enough.\n"); |
202 | } | 202 | } |
diff --git a/drivers/media/video/ivtv/ivtv-queue.c b/drivers/media/video/ivtv/ivtv-queue.c index ff7b7deded4f..7fde36e6d227 100644 --- a/drivers/media/video/ivtv/ivtv-queue.c +++ b/drivers/media/video/ivtv/ivtv-queue.c | |||
@@ -230,7 +230,8 @@ int ivtv_stream_alloc(struct ivtv_stream *s) | |||
230 | return -ENOMEM; | 230 | return -ENOMEM; |
231 | } | 231 | } |
232 | if (ivtv_might_use_dma(s)) { | 232 | if (ivtv_might_use_dma(s)) { |
233 | s->sg_handle = pci_map_single(itv->pdev, s->sg_dma, sizeof(struct ivtv_sg_element), s->dma); | 233 | s->sg_handle = pci_map_single(itv->pdev, s->sg_dma, |
234 | sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE); | ||
234 | ivtv_stream_sync_for_cpu(s); | 235 | ivtv_stream_sync_for_cpu(s); |
235 | } | 236 | } |
236 | 237 | ||
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c index 7912ed6b72ee..c0875378acc2 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.c +++ b/drivers/media/video/ivtv/ivtv-yuv.c | |||
@@ -1063,7 +1063,8 @@ static int ivtv_yuv_udma_frame(struct ivtv *itv, struct ivtv_dma_frame *args) | |||
1063 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); | 1063 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); |
1064 | /* if no UDMA is pending and no UDMA is in progress, then the DMA | 1064 | /* if no UDMA is pending and no UDMA is in progress, then the DMA |
1065 | is finished */ | 1065 | is finished */ |
1066 | while (itv->i_flags & (IVTV_F_I_UDMA_PENDING | IVTV_F_I_UDMA)) { | 1066 | while (test_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags) || |
1067 | test_bit(IVTV_F_I_UDMA, &itv->i_flags)) { | ||
1067 | /* don't interrupt if the DMA is in progress but break off | 1068 | /* don't interrupt if the DMA is in progress but break off |
1068 | a still pending DMA. */ | 1069 | a still pending DMA. */ |
1069 | got_sig = signal_pending(current); | 1070 | got_sig = signal_pending(current); |
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 66e6eb513076..fa6bb85cb4b0 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c | |||
@@ -298,7 +298,8 @@ static int ivtvfb_prep_dec_dma_to_device(struct ivtv *itv, | |||
298 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); | 298 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); |
299 | /* if no UDMA is pending and no UDMA is in progress, then the DMA | 299 | /* if no UDMA is pending and no UDMA is in progress, then the DMA |
300 | is finished */ | 300 | is finished */ |
301 | while (itv->i_flags & (IVTV_F_I_UDMA_PENDING | IVTV_F_I_UDMA)) { | 301 | while (test_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags) || |
302 | test_bit(IVTV_F_I_UDMA, &itv->i_flags)) { | ||
302 | /* don't interrupt if the DMA is in progress but break off | 303 | /* don't interrupt if the DMA is in progress but break off |
303 | a still pending DMA. */ | 304 | a still pending DMA. */ |
304 | got_sig = signal_pending(current); | 305 | got_sig = signal_pending(current); |
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 399412d7f020..507dc85646b2 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -1726,14 +1726,17 @@ static int uvc_suspend(struct usb_interface *intf, pm_message_t message) | |||
1726 | static int __uvc_resume(struct usb_interface *intf, int reset) | 1726 | static int __uvc_resume(struct usb_interface *intf, int reset) |
1727 | { | 1727 | { |
1728 | struct uvc_device *dev = usb_get_intfdata(intf); | 1728 | struct uvc_device *dev = usb_get_intfdata(intf); |
1729 | int ret; | ||
1730 | 1729 | ||
1731 | uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n", | 1730 | uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n", |
1732 | intf->cur_altsetting->desc.bInterfaceNumber); | 1731 | intf->cur_altsetting->desc.bInterfaceNumber); |
1733 | 1732 | ||
1734 | if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) { | 1733 | if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) { |
1735 | if (reset && (ret = uvc_ctrl_resume_device(dev)) < 0) | 1734 | if (reset) { |
1736 | return ret; | 1735 | int ret = uvc_ctrl_resume_device(dev); |
1736 | |||
1737 | if (ret < 0) | ||
1738 | return ret; | ||
1739 | } | ||
1737 | 1740 | ||
1738 | return uvc_status_resume(dev); | 1741 | return uvc_status_resume(dev); |
1739 | } | 1742 | } |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index a95e17329c5b..6ce974d7362f 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -742,7 +742,7 @@ static int uvc_alloc_urb_buffers(struct uvc_video_device *video, | |||
742 | 742 | ||
743 | /* Buffers are already allocated, bail out. */ | 743 | /* Buffers are already allocated, bail out. */ |
744 | if (video->urb_size) | 744 | if (video->urb_size) |
745 | return 0; | 745 | return video->urb_size / psize; |
746 | 746 | ||
747 | /* Compute the number of packets. Bulk endpoints might transfer UVC | 747 | /* Compute the number of packets. Bulk endpoints might transfer UVC |
748 | * payloads accross multiple URBs. | 748 | * payloads accross multiple URBs. |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 88f10d6cbc92..be64a502ea27 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -42,6 +42,12 @@ | |||
42 | printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\ | 42 | printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\ |
43 | } while (0) | 43 | } while (0) |
44 | 44 | ||
45 | /* Zero out the end of the struct pointed to by p. Everthing after, but | ||
46 | * not including, the specified field is cleared. */ | ||
47 | #define CLEAR_AFTER_FIELD(p, field) \ | ||
48 | memset((u8 *)(p) + offsetof(typeof(*(p)), field) + sizeof((p)->field), \ | ||
49 | 0, sizeof(*(p)) - offsetof(typeof(*(p)), field) - sizeof((p)->field)) | ||
50 | |||
45 | struct std_descr { | 51 | struct std_descr { |
46 | v4l2_std_id std; | 52 | v4l2_std_id std; |
47 | const char *descr; | 53 | const char *descr; |
@@ -544,39 +550,39 @@ static int check_fmt(const struct v4l2_ioctl_ops *ops, enum v4l2_buf_type type) | |||
544 | 550 | ||
545 | switch (type) { | 551 | switch (type) { |
546 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 552 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
547 | if (ops->vidioc_try_fmt_vid_cap) | 553 | if (ops->vidioc_g_fmt_vid_cap) |
548 | return 0; | 554 | return 0; |
549 | break; | 555 | break; |
550 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 556 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
551 | if (ops->vidioc_try_fmt_vid_overlay) | 557 | if (ops->vidioc_g_fmt_vid_overlay) |
552 | return 0; | 558 | return 0; |
553 | break; | 559 | break; |
554 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: | 560 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: |
555 | if (ops->vidioc_try_fmt_vid_out) | 561 | if (ops->vidioc_g_fmt_vid_out) |
556 | return 0; | 562 | return 0; |
557 | break; | 563 | break; |
558 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: | 564 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
559 | if (ops->vidioc_try_fmt_vid_out_overlay) | 565 | if (ops->vidioc_g_fmt_vid_out_overlay) |
560 | return 0; | 566 | return 0; |
561 | break; | 567 | break; |
562 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 568 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
563 | if (ops->vidioc_try_fmt_vbi_cap) | 569 | if (ops->vidioc_g_fmt_vbi_cap) |
564 | return 0; | 570 | return 0; |
565 | break; | 571 | break; |
566 | case V4L2_BUF_TYPE_VBI_OUTPUT: | 572 | case V4L2_BUF_TYPE_VBI_OUTPUT: |
567 | if (ops->vidioc_try_fmt_vbi_out) | 573 | if (ops->vidioc_g_fmt_vbi_out) |
568 | return 0; | 574 | return 0; |
569 | break; | 575 | break; |
570 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: | 576 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: |
571 | if (ops->vidioc_try_fmt_sliced_vbi_cap) | 577 | if (ops->vidioc_g_fmt_sliced_vbi_cap) |
572 | return 0; | 578 | return 0; |
573 | break; | 579 | break; |
574 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: | 580 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: |
575 | if (ops->vidioc_try_fmt_sliced_vbi_out) | 581 | if (ops->vidioc_g_fmt_sliced_vbi_out) |
576 | return 0; | 582 | return 0; |
577 | break; | 583 | break; |
578 | case V4L2_BUF_TYPE_PRIVATE: | 584 | case V4L2_BUF_TYPE_PRIVATE: |
579 | if (ops->vidioc_try_fmt_type_private) | 585 | if (ops->vidioc_g_fmt_type_private) |
580 | return 0; | 586 | return 0; |
581 | break; | 587 | break; |
582 | } | 588 | } |
@@ -782,44 +788,53 @@ static long __video_do_ioctl(struct file *file, | |||
782 | 788 | ||
783 | switch (f->type) { | 789 | switch (f->type) { |
784 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 790 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
791 | CLEAR_AFTER_FIELD(f, fmt.pix); | ||
785 | v4l_print_pix_fmt(vfd, &f->fmt.pix); | 792 | v4l_print_pix_fmt(vfd, &f->fmt.pix); |
786 | if (ops->vidioc_s_fmt_vid_cap) | 793 | if (ops->vidioc_s_fmt_vid_cap) |
787 | ret = ops->vidioc_s_fmt_vid_cap(file, fh, f); | 794 | ret = ops->vidioc_s_fmt_vid_cap(file, fh, f); |
788 | break; | 795 | break; |
789 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 796 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
797 | CLEAR_AFTER_FIELD(f, fmt.win); | ||
790 | if (ops->vidioc_s_fmt_vid_overlay) | 798 | if (ops->vidioc_s_fmt_vid_overlay) |
791 | ret = ops->vidioc_s_fmt_vid_overlay(file, | 799 | ret = ops->vidioc_s_fmt_vid_overlay(file, |
792 | fh, f); | 800 | fh, f); |
793 | break; | 801 | break; |
794 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: | 802 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: |
803 | CLEAR_AFTER_FIELD(f, fmt.pix); | ||
795 | v4l_print_pix_fmt(vfd, &f->fmt.pix); | 804 | v4l_print_pix_fmt(vfd, &f->fmt.pix); |
796 | if (ops->vidioc_s_fmt_vid_out) | 805 | if (ops->vidioc_s_fmt_vid_out) |
797 | ret = ops->vidioc_s_fmt_vid_out(file, fh, f); | 806 | ret = ops->vidioc_s_fmt_vid_out(file, fh, f); |
798 | break; | 807 | break; |
799 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: | 808 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
809 | CLEAR_AFTER_FIELD(f, fmt.win); | ||
800 | if (ops->vidioc_s_fmt_vid_out_overlay) | 810 | if (ops->vidioc_s_fmt_vid_out_overlay) |
801 | ret = ops->vidioc_s_fmt_vid_out_overlay(file, | 811 | ret = ops->vidioc_s_fmt_vid_out_overlay(file, |
802 | fh, f); | 812 | fh, f); |
803 | break; | 813 | break; |
804 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 814 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
815 | CLEAR_AFTER_FIELD(f, fmt.vbi); | ||
805 | if (ops->vidioc_s_fmt_vbi_cap) | 816 | if (ops->vidioc_s_fmt_vbi_cap) |
806 | ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f); | 817 | ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f); |
807 | break; | 818 | break; |
808 | case V4L2_BUF_TYPE_VBI_OUTPUT: | 819 | case V4L2_BUF_TYPE_VBI_OUTPUT: |
820 | CLEAR_AFTER_FIELD(f, fmt.vbi); | ||
809 | if (ops->vidioc_s_fmt_vbi_out) | 821 | if (ops->vidioc_s_fmt_vbi_out) |
810 | ret = ops->vidioc_s_fmt_vbi_out(file, fh, f); | 822 | ret = ops->vidioc_s_fmt_vbi_out(file, fh, f); |
811 | break; | 823 | break; |
812 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: | 824 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: |
825 | CLEAR_AFTER_FIELD(f, fmt.sliced); | ||
813 | if (ops->vidioc_s_fmt_sliced_vbi_cap) | 826 | if (ops->vidioc_s_fmt_sliced_vbi_cap) |
814 | ret = ops->vidioc_s_fmt_sliced_vbi_cap(file, | 827 | ret = ops->vidioc_s_fmt_sliced_vbi_cap(file, |
815 | fh, f); | 828 | fh, f); |
816 | break; | 829 | break; |
817 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: | 830 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: |
831 | CLEAR_AFTER_FIELD(f, fmt.sliced); | ||
818 | if (ops->vidioc_s_fmt_sliced_vbi_out) | 832 | if (ops->vidioc_s_fmt_sliced_vbi_out) |
819 | ret = ops->vidioc_s_fmt_sliced_vbi_out(file, | 833 | ret = ops->vidioc_s_fmt_sliced_vbi_out(file, |
820 | fh, f); | 834 | fh, f); |
821 | break; | 835 | break; |
822 | case V4L2_BUF_TYPE_PRIVATE: | 836 | case V4L2_BUF_TYPE_PRIVATE: |
837 | /* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */ | ||
823 | if (ops->vidioc_s_fmt_type_private) | 838 | if (ops->vidioc_s_fmt_type_private) |
824 | ret = ops->vidioc_s_fmt_type_private(file, | 839 | ret = ops->vidioc_s_fmt_type_private(file, |
825 | fh, f); | 840 | fh, f); |
@@ -836,46 +851,55 @@ static long __video_do_ioctl(struct file *file, | |||
836 | v4l2_type_names)); | 851 | v4l2_type_names)); |
837 | switch (f->type) { | 852 | switch (f->type) { |
838 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 853 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
854 | CLEAR_AFTER_FIELD(f, fmt.pix); | ||
839 | if (ops->vidioc_try_fmt_vid_cap) | 855 | if (ops->vidioc_try_fmt_vid_cap) |
840 | ret = ops->vidioc_try_fmt_vid_cap(file, fh, f); | 856 | ret = ops->vidioc_try_fmt_vid_cap(file, fh, f); |
841 | if (!ret) | 857 | if (!ret) |
842 | v4l_print_pix_fmt(vfd, &f->fmt.pix); | 858 | v4l_print_pix_fmt(vfd, &f->fmt.pix); |
843 | break; | 859 | break; |
844 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 860 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
861 | CLEAR_AFTER_FIELD(f, fmt.win); | ||
845 | if (ops->vidioc_try_fmt_vid_overlay) | 862 | if (ops->vidioc_try_fmt_vid_overlay) |
846 | ret = ops->vidioc_try_fmt_vid_overlay(file, | 863 | ret = ops->vidioc_try_fmt_vid_overlay(file, |
847 | fh, f); | 864 | fh, f); |
848 | break; | 865 | break; |
849 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: | 866 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: |
867 | CLEAR_AFTER_FIELD(f, fmt.pix); | ||
850 | if (ops->vidioc_try_fmt_vid_out) | 868 | if (ops->vidioc_try_fmt_vid_out) |
851 | ret = ops->vidioc_try_fmt_vid_out(file, fh, f); | 869 | ret = ops->vidioc_try_fmt_vid_out(file, fh, f); |
852 | if (!ret) | 870 | if (!ret) |
853 | v4l_print_pix_fmt(vfd, &f->fmt.pix); | 871 | v4l_print_pix_fmt(vfd, &f->fmt.pix); |
854 | break; | 872 | break; |
855 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: | 873 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
874 | CLEAR_AFTER_FIELD(f, fmt.win); | ||
856 | if (ops->vidioc_try_fmt_vid_out_overlay) | 875 | if (ops->vidioc_try_fmt_vid_out_overlay) |
857 | ret = ops->vidioc_try_fmt_vid_out_overlay(file, | 876 | ret = ops->vidioc_try_fmt_vid_out_overlay(file, |
858 | fh, f); | 877 | fh, f); |
859 | break; | 878 | break; |
860 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 879 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
880 | CLEAR_AFTER_FIELD(f, fmt.vbi); | ||
861 | if (ops->vidioc_try_fmt_vbi_cap) | 881 | if (ops->vidioc_try_fmt_vbi_cap) |
862 | ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f); | 882 | ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f); |
863 | break; | 883 | break; |
864 | case V4L2_BUF_TYPE_VBI_OUTPUT: | 884 | case V4L2_BUF_TYPE_VBI_OUTPUT: |
885 | CLEAR_AFTER_FIELD(f, fmt.vbi); | ||
865 | if (ops->vidioc_try_fmt_vbi_out) | 886 | if (ops->vidioc_try_fmt_vbi_out) |
866 | ret = ops->vidioc_try_fmt_vbi_out(file, fh, f); | 887 | ret = ops->vidioc_try_fmt_vbi_out(file, fh, f); |
867 | break; | 888 | break; |
868 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: | 889 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: |
890 | CLEAR_AFTER_FIELD(f, fmt.sliced); | ||
869 | if (ops->vidioc_try_fmt_sliced_vbi_cap) | 891 | if (ops->vidioc_try_fmt_sliced_vbi_cap) |
870 | ret = ops->vidioc_try_fmt_sliced_vbi_cap(file, | 892 | ret = ops->vidioc_try_fmt_sliced_vbi_cap(file, |
871 | fh, f); | 893 | fh, f); |
872 | break; | 894 | break; |
873 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: | 895 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: |
896 | CLEAR_AFTER_FIELD(f, fmt.sliced); | ||
874 | if (ops->vidioc_try_fmt_sliced_vbi_out) | 897 | if (ops->vidioc_try_fmt_sliced_vbi_out) |
875 | ret = ops->vidioc_try_fmt_sliced_vbi_out(file, | 898 | ret = ops->vidioc_try_fmt_sliced_vbi_out(file, |
876 | fh, f); | 899 | fh, f); |
877 | break; | 900 | break; |
878 | case V4L2_BUF_TYPE_PRIVATE: | 901 | case V4L2_BUF_TYPE_PRIVATE: |
902 | /* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */ | ||
879 | if (ops->vidioc_try_fmt_type_private) | 903 | if (ops->vidioc_try_fmt_type_private) |
880 | ret = ops->vidioc_try_fmt_type_private(file, | 904 | ret = ops->vidioc_try_fmt_type_private(file, |
881 | fh, f); | 905 | fh, f); |
@@ -898,6 +922,9 @@ static long __video_do_ioctl(struct file *file, | |||
898 | if (ret) | 922 | if (ret) |
899 | break; | 923 | break; |
900 | 924 | ||
925 | if (p->type < V4L2_BUF_TYPE_PRIVATE) | ||
926 | CLEAR_AFTER_FIELD(p, memory); | ||
927 | |||
901 | ret = ops->vidioc_reqbufs(file, fh, p); | 928 | ret = ops->vidioc_reqbufs(file, fh, p); |
902 | dbgarg(cmd, "count=%d, type=%s, memory=%s\n", | 929 | dbgarg(cmd, "count=%d, type=%s, memory=%s\n", |
903 | p->count, | 930 | p->count, |
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 092333b1c34f..643cccaa1aab 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -1863,22 +1863,20 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability | |||
1863 | 1863 | ||
1864 | static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag) | 1864 | static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag) |
1865 | { | 1865 | { |
1866 | int num = -1, i; | 1866 | unsigned int num, i; |
1867 | 1867 | ||
1868 | for (i = 0; i < NUM_FORMATS; i++) { | 1868 | for (num = i = 0; i < NUM_FORMATS; i++) { |
1869 | if (zoran_formats[i].flags & flag) | 1869 | if (zoran_formats[i].flags & flag && num++ == fmt->index) { |
1870 | num++; | 1870 | strncpy(fmt->description, zoran_formats[i].name, |
1871 | if (num == fmt->index) | 1871 | sizeof(fmt->description) - 1); |
1872 | break; | 1872 | /* fmt struct pre-zeroed, so adding '\0' not neeed */ |
1873 | fmt->pixelformat = zoran_formats[i].fourcc; | ||
1874 | if (zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED) | ||
1875 | fmt->flags |= V4L2_FMT_FLAG_COMPRESSED; | ||
1876 | return 0; | ||
1877 | } | ||
1873 | } | 1878 | } |
1874 | if (fmt->index < 0 /* late, but not too late */ || i == NUM_FORMATS) | 1879 | return -EINVAL; |
1875 | return -EINVAL; | ||
1876 | |||
1877 | strncpy(fmt->description, zoran_formats[i].name, sizeof(fmt->description)-1); | ||
1878 | fmt->pixelformat = zoran_formats[i].fourcc; | ||
1879 | if (zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED) | ||
1880 | fmt->flags |= V4L2_FMT_FLAG_COMPRESSED; | ||
1881 | return 0; | ||
1882 | } | 1880 | } |
1883 | 1881 | ||
1884 | static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh, | 1882 | static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh, |