]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/media/pci/cx25821/cx25821-video.c
[media] media: videobuf2: Restructure vb2_buffer
[mirror_ubuntu-artful-kernel.git] / drivers / media / pci / cx25821 / cx25821-video.c
index 7bc495e4ece259ddc0a23b4248c7d774a41744a1..f1deb8fd271ca009acb787ce2a26033fe4289e60 100644 (file)
@@ -130,10 +130,10 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
                        buf = list_entry(dmaq->active.next,
                                         struct cx25821_buffer, queue);
 
-                       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-                       buf->vb.v4l2_buf.sequence = dmaq->count++;
+                       v4l2_get_timestamp(&buf->vb.timestamp);
+                       buf->vb.sequence = dmaq->count++;
                        list_del(&buf->queue);
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+                       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
                }
                spin_unlock(&dev->slock);
                handled++;
@@ -159,10 +159,11 @@ static int cx25821_queue_setup(struct vb2_queue *q, const struct v4l2_format *fm
 
 static int cx25821_buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        u32 line0_offset;
        int bpl_local = LINE_SIZE_D1;
@@ -176,7 +177,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
        if (vb2_plane_size(vb, 0) < chan->height * buf->bpl)
                return -EINVAL;
        vb2_set_plane_payload(vb, 0, chan->height * buf->bpl);
-       buf->vb.v4l2_buf.field = chan->field;
+       buf->vb.field = chan->field;
 
        if (chan->pixel_formats == PIXEL_FRMT_411) {
                bpl_local = buf->bpl;
@@ -231,7 +232,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
        }
 
        dprintk(2, "[%p/%d] buffer_prep - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
-               buf, buf->vb.v4l2_buf.index, chan->width, chan->height,
+               buf, buf->vb.vb2_buf.index, chan->width, chan->height,
                chan->fmt->depth, chan->fmt->name,
                (unsigned long)buf->risc.dma);
 
@@ -240,8 +241,9 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
 
 static void cx25821_buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
 
@@ -250,8 +252,9 @@ static void cx25821_buffer_finish(struct vb2_buffer *vb)
 
 static void cx25821_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
        struct cx25821_buffer *prev;
@@ -300,7 +303,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q)
                        struct cx25821_buffer, queue);
 
                list_del(&buf->queue);
-               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);
 }