diff options
Diffstat (limited to 'drivers/media/usb/pwc/pwc-if.c')
-rw-r--r-- | drivers/media/usb/pwc/pwc-if.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index 702267e208ba..3f5395a7fafe 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c | |||
@@ -240,9 +240,9 @@ static void pwc_frame_complete(struct pwc_device *pdev) | |||
240 | PWC_DEBUG_FLOW("Frame buffer underflow (%d bytes);" | 240 | PWC_DEBUG_FLOW("Frame buffer underflow (%d bytes);" |
241 | " discarded.\n", fbuf->filled); | 241 | " discarded.\n", fbuf->filled); |
242 | } else { | 242 | } else { |
243 | fbuf->vb.v4l2_buf.field = V4L2_FIELD_NONE; | 243 | fbuf->vb.field = V4L2_FIELD_NONE; |
244 | fbuf->vb.v4l2_buf.sequence = pdev->vframe_count; | 244 | fbuf->vb.sequence = pdev->vframe_count; |
245 | vb2_buffer_done(&fbuf->vb, VB2_BUF_STATE_DONE); | 245 | vb2_buffer_done(&fbuf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
246 | pdev->fill_buf = NULL; | 246 | pdev->fill_buf = NULL; |
247 | pdev->vsync = 0; | 247 | pdev->vsync = 0; |
248 | } | 248 | } |
@@ -287,7 +287,7 @@ static void pwc_isoc_handler(struct urb *urb) | |||
287 | { | 287 | { |
288 | PWC_ERROR("Too many ISOC errors, bailing out.\n"); | 288 | PWC_ERROR("Too many ISOC errors, bailing out.\n"); |
289 | if (pdev->fill_buf) { | 289 | if (pdev->fill_buf) { |
290 | vb2_buffer_done(&pdev->fill_buf->vb, | 290 | vb2_buffer_done(&pdev->fill_buf->vb.vb2_buf, |
291 | VB2_BUF_STATE_ERROR); | 291 | VB2_BUF_STATE_ERROR); |
292 | pdev->fill_buf = NULL; | 292 | pdev->fill_buf = NULL; |
293 | } | 293 | } |
@@ -317,7 +317,7 @@ static void pwc_isoc_handler(struct urb *urb) | |||
317 | 317 | ||
318 | if (pdev->vsync == 1) { | 318 | if (pdev->vsync == 1) { |
319 | v4l2_get_timestamp( | 319 | v4l2_get_timestamp( |
320 | &fbuf->vb.v4l2_buf.timestamp); | 320 | &fbuf->vb.timestamp); |
321 | pdev->vsync = 2; | 321 | pdev->vsync = 2; |
322 | } | 322 | } |
323 | 323 | ||
@@ -520,7 +520,7 @@ static void pwc_cleanup_queued_bufs(struct pwc_device *pdev, | |||
520 | buf = list_entry(pdev->queued_bufs.next, struct pwc_frame_buf, | 520 | buf = list_entry(pdev->queued_bufs.next, struct pwc_frame_buf, |
521 | list); | 521 | list); |
522 | list_del(&buf->list); | 522 | list_del(&buf->list); |
523 | vb2_buffer_done(&buf->vb, state); | 523 | vb2_buffer_done(&buf->vb.vb2_buf, state); |
524 | } | 524 | } |
525 | spin_unlock_irqrestore(&pdev->queued_bufs_lock, flags); | 525 | spin_unlock_irqrestore(&pdev->queued_bufs_lock, flags); |
526 | } | 526 | } |
@@ -594,7 +594,9 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, | |||
594 | 594 | ||
595 | static int buffer_init(struct vb2_buffer *vb) | 595 | static int buffer_init(struct vb2_buffer *vb) |
596 | { | 596 | { |
597 | struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); | 597 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); |
598 | struct pwc_frame_buf *buf = | ||
599 | container_of(vbuf, struct pwc_frame_buf, vb); | ||
598 | 600 | ||
599 | /* need vmalloc since frame buffer > 128K */ | 601 | /* need vmalloc since frame buffer > 128K */ |
600 | buf->data = vzalloc(PWC_FRAME_SIZE); | 602 | buf->data = vzalloc(PWC_FRAME_SIZE); |
@@ -618,7 +620,9 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
618 | static void buffer_finish(struct vb2_buffer *vb) | 620 | static void buffer_finish(struct vb2_buffer *vb) |
619 | { | 621 | { |
620 | struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); | 622 | struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); |
621 | struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); | 623 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); |
624 | struct pwc_frame_buf *buf = | ||
625 | container_of(vbuf, struct pwc_frame_buf, vb); | ||
622 | 626 | ||
623 | if (vb->state == VB2_BUF_STATE_DONE) { | 627 | if (vb->state == VB2_BUF_STATE_DONE) { |
624 | /* | 628 | /* |
@@ -633,7 +637,9 @@ static void buffer_finish(struct vb2_buffer *vb) | |||
633 | 637 | ||
634 | static void buffer_cleanup(struct vb2_buffer *vb) | 638 | static void buffer_cleanup(struct vb2_buffer *vb) |
635 | { | 639 | { |
636 | struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); | 640 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); |
641 | struct pwc_frame_buf *buf = | ||
642 | container_of(vbuf, struct pwc_frame_buf, vb); | ||
637 | 643 | ||
638 | vfree(buf->data); | 644 | vfree(buf->data); |
639 | } | 645 | } |
@@ -641,12 +647,14 @@ static void buffer_cleanup(struct vb2_buffer *vb) | |||
641 | static void buffer_queue(struct vb2_buffer *vb) | 647 | static void buffer_queue(struct vb2_buffer *vb) |
642 | { | 648 | { |
643 | struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); | 649 | struct pwc_device *pdev = vb2_get_drv_priv(vb->vb2_queue); |
644 | struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb); | 650 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); |
651 | struct pwc_frame_buf *buf = | ||
652 | container_of(vbuf, struct pwc_frame_buf, vb); | ||
645 | unsigned long flags = 0; | 653 | unsigned long flags = 0; |
646 | 654 | ||
647 | /* Check the device has not disconnected between prep and queuing */ | 655 | /* Check the device has not disconnected between prep and queuing */ |
648 | if (!pdev->udev) { | 656 | if (!pdev->udev) { |
649 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); | 657 | vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); |
650 | return; | 658 | return; |
651 | } | 659 | } |
652 | 660 | ||
@@ -695,7 +703,8 @@ static void stop_streaming(struct vb2_queue *vq) | |||
695 | 703 | ||
696 | pwc_cleanup_queued_bufs(pdev, VB2_BUF_STATE_ERROR); | 704 | pwc_cleanup_queued_bufs(pdev, VB2_BUF_STATE_ERROR); |
697 | if (pdev->fill_buf) | 705 | if (pdev->fill_buf) |
698 | vb2_buffer_done(&pdev->fill_buf->vb, VB2_BUF_STATE_ERROR); | 706 | vb2_buffer_done(&pdev->fill_buf->vb.vb2_buf, |
707 | VB2_BUF_STATE_ERROR); | ||
699 | mutex_unlock(&pdev->v4l2_lock); | 708 | mutex_unlock(&pdev->v4l2_lock); |
700 | } | 709 | } |
701 | 710 | ||