[media] media: videobuf2: Restructure vb2_buffer
[sfrench/cifs-2.6.git] / drivers / media / pci / tw68 / tw68-video.c
index 8355e55b4e8ed75fa94d0f087f5908b95e78e12c..323721439b8e82a91de70cba81a9b9023763d618 100644 (file)
@@ -423,9 +423,10 @@ static int tw68_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
  */
 static void tw68_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct tw68_dev *dev = vb2_get_drv_priv(vq);
-       struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
+       struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
        struct tw68_buf *prev;
        unsigned long flags;
 
@@ -457,9 +458,10 @@ static void tw68_buf_queue(struct vb2_buffer *vb)
  */
 static int tw68_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct tw68_dev *dev = vb2_get_drv_priv(vq);
-       struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
+       struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
        struct sg_table *dma = vb2_dma_sg_plane_desc(vb, 0);
        unsigned size, bpl;
 
@@ -499,9 +501,10 @@ static int tw68_buf_prepare(struct vb2_buffer *vb)
 
 static void tw68_buf_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct tw68_dev *dev = vb2_get_drv_priv(vq);
-       struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
+       struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
 
        pci_free_consistent(dev->pci, buf->size, buf->cpu, buf->dma);
 }
@@ -528,7 +531,7 @@ static void tw68_stop_streaming(struct vb2_queue *q)
                        container_of(dev->active.next, struct tw68_buf, 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);
        }
 }
 
@@ -1012,10 +1015,10 @@ void tw68_irq_video_done(struct tw68_dev *dev, unsigned long status)
                buf = list_entry(dev->active.next, struct tw68_buf, list);
                list_del(&buf->list);
                spin_unlock(&dev->slock);
-               v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-               buf->vb.v4l2_buf.field = dev->field;
-               buf->vb.v4l2_buf.sequence = dev->seqnr++;
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+               v4l2_get_timestamp(&buf->vb.timestamp);
+               buf->vb.field = dev->field;
+               buf->vb.sequence = dev->seqnr++;
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
                status &= ~(TW68_DMAPI);
                if (0 == status)
                        return;