These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / media / usb / au0828 / au0828-video.c
index 1a362a0..45c622e 100644 (file)
@@ -302,20 +302,20 @@ static inline void buffer_filled(struct au0828_dev *dev,
                                 struct au0828_dmaqueue *dma_q,
                                 struct au0828_buffer *buf)
 {
-       struct vb2_buffer *vb = &buf->vb;
-       struct vb2_queue *q = vb->vb2_queue;
+       struct vb2_v4l2_buffer *vb = &buf->vb;
+       struct vb2_queue *q = vb->vb2_buf.vb2_queue;
 
        /* Advice that buffer was filled */
        au0828_isocdbg("[%p/%d] wakeup\n", buf, buf->top_field);
 
        if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-               vb->v4l2_buf.sequence = dev->frame_count++;
+               vb->sequence = dev->frame_count++;
        else
-               vb->v4l2_buf.sequence = dev->vbi_frame_count++;
+               vb->sequence = dev->vbi_frame_count++;
 
-       vb->v4l2_buf.field = V4L2_FIELD_INTERLACED;
-       v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
-       vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
+       vb->field = V4L2_FIELD_INTERLACED;
+       v4l2_get_timestamp(&vb->timestamp);
+       vb2_buffer_done(&vb->vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 /*
@@ -531,11 +531,11 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb)
 
        buf = dev->isoc_ctl.buf;
        if (buf != NULL)
-               outp = vb2_plane_vaddr(&buf->vb, 0);
+               outp = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
 
        vbi_buf = dev->isoc_ctl.vbi_buf;
        if (vbi_buf != NULL)
-               vbioutp = vb2_plane_vaddr(&vbi_buf->vb, 0);
+               vbioutp = vb2_plane_vaddr(&vbi_buf->vb.vb2_buf, 0);
 
        for (i = 0; i < urb->number_of_packets; i++) {
                int status = urb->iso_frame_desc[i].status;
@@ -574,7 +574,7 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb)
                                        vbioutp = NULL;
                                else
                                        vbioutp = vb2_plane_vaddr(
-                                               &vbi_buf->vb, 0);
+                                               &vbi_buf->vb.vb2_buf, 0);
 
                                /* Video */
                                if (buf != NULL)
@@ -583,7 +583,8 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb)
                                if (buf == NULL)
                                        outp = NULL;
                                else
-                                       outp = vb2_plane_vaddr(&buf->vb, 0);
+                                       outp = vb2_plane_vaddr(
+                                               &buf->vb.vb2_buf, 0);
 
                                /* As long as isoc traffic is arriving, keep
                                   resetting the timer */
@@ -637,10 +638,11 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb)
        return rc;
 }
 
-static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+static int queue_setup(struct vb2_queue *vq, const void *parg,
                       unsigned int *nbuffers, unsigned int *nplanes,
                       unsigned int sizes[], void *alloc_ctxs[])
 {
+       const struct v4l2_format *fmt = parg;
        struct au0828_dev *dev = vb2_get_drv_priv(vq);
        unsigned long img_size = dev->height * dev->bytesperline;
        unsigned long size;
@@ -658,7 +660,9 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
 static int
 buffer_prepare(struct vb2_buffer *vb)
 {
-       struct au0828_buffer *buf = container_of(vb, struct au0828_buffer, vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct au0828_buffer *buf = container_of(vbuf,
+                               struct au0828_buffer, vb);
        struct au0828_dev    *dev = vb2_get_drv_priv(vb->vb2_queue);
 
        buf->length = dev->height * dev->bytesperline;
@@ -668,14 +672,15 @@ buffer_prepare(struct vb2_buffer *vb)
                        __func__, vb2_plane_size(vb, 0), buf->length);
                return -EINVAL;
        }
-       vb2_set_plane_payload(&buf->vb, 0, buf->length);
+       vb2_set_plane_payload(&buf->vb.vb2_buf, 0, buf->length);
        return 0;
 }
 
 static void
 buffer_queue(struct vb2_buffer *vb)
 {
-       struct au0828_buffer    *buf     = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct au0828_buffer    *buf     = container_of(vbuf,
                                                        struct au0828_buffer,
                                                        vb);
        struct au0828_dev       *dev     = vb2_get_drv_priv(vb->vb2_queue);
@@ -826,14 +831,15 @@ static void au0828_stop_streaming(struct vb2_queue *vq)
 
        spin_lock_irqsave(&dev->slock, flags);
        if (dev->isoc_ctl.buf != NULL) {
-               vb2_buffer_done(&dev->isoc_ctl.buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&dev->isoc_ctl.buf->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
                dev->isoc_ctl.buf = NULL;
        }
        while (!list_empty(&vidq->active)) {
                struct au0828_buffer *buf;
 
                buf = list_entry(vidq->active.next, struct au0828_buffer, list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                list_del(&buf->list);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
@@ -853,7 +859,7 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq)
 
        spin_lock_irqsave(&dev->slock, flags);
        if (dev->isoc_ctl.vbi_buf != NULL) {
-               vb2_buffer_done(&dev->isoc_ctl.vbi_buf->vb,
+               vb2_buffer_done(&dev->isoc_ctl.vbi_buf->vb.vb2_buf,
                                VB2_BUF_STATE_ERROR);
                dev->isoc_ctl.vbi_buf = NULL;
        }
@@ -862,7 +868,7 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq)
 
                buf = list_entry(vbiq->active.next, struct au0828_buffer, list);
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 
@@ -911,7 +917,7 @@ static void au0828_vid_buffer_timeout(unsigned long data)
 
        buf = dev->isoc_ctl.buf;
        if (buf != NULL) {
-               vid_data = vb2_plane_vaddr(&buf->vb, 0);
+               vid_data = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
                memset(vid_data, 0x00, buf->length); /* Blank green frame */
                buffer_filled(dev, dma_q, buf);
        }
@@ -935,7 +941,7 @@ static void au0828_vbi_buffer_timeout(unsigned long data)
 
        buf = dev->isoc_ctl.vbi_buf;
        if (buf != NULL) {
-               vbi_data = vb2_plane_vaddr(&buf->vb, 0);
+               vbi_data = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
                memset(vbi_data, 0x00, buf->length);
                buffer_filled(dev, dma_q, buf);
        }