]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/media/pci/cobalt/cobalt-v4l2.c
[media] media: videobuf2: Restructure vb2_buffer
[mirror_ubuntu-artful-kernel.git] / drivers / media / pci / cobalt / cobalt-v4l2.c
index 9756fd3e8af5e78428a7e5ad1c7d8e34418f9653..7d331a4c33a2b15304b5aa1887ff03906966f212 100644 (file)
@@ -75,7 +75,7 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
        const size_t bytes =
                COBALT_MAX_HEIGHT * max_pages_per_line * 0x20;
        const size_t audio_bytes = ((1920 * 4) / PAGE_SIZE + 1) * 0x20;
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
        struct sg_table *sg_desc = vb2_dma_sg_plane_desc(vb, 0);
        unsigned size;
        int ret;
@@ -105,17 +105,18 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
 static void cobalt_buf_cleanup(struct vb2_buffer *vb)
 {
        struct cobalt_stream *s = vb->vb2_queue->drv_priv;
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
 
        descriptor_list_free(desc);
 }
 
 static int cobalt_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cobalt_stream *s = vb->vb2_queue->drv_priv;
 
        vb2_set_plane_payload(vb, 0, s->stride * s->height);
-       vb->v4l2_buf.field = V4L2_FIELD_NONE;
+       vbuf->field = V4L2_FIELD_NONE;
        return 0;
 }
 
@@ -128,7 +129,7 @@ static void chain_all_buffers(struct cobalt_stream *s)
 
        list_for_each(p, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
-               desc[i] = &s->dma_desc_info[cb->vb.v4l2_buf.index];
+               desc[i] = &s->dma_desc_info[cb->vb.vb2_buf.index];
                if (i > 0)
                        descriptor_list_chain(desc[i-1], desc[i]);
                i++;
@@ -137,10 +138,11 @@ static void chain_all_buffers(struct cobalt_stream *s)
 
 static void cobalt_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *q = vb->vb2_queue;
        struct cobalt_stream *s = q->drv_priv;
-       struct cobalt_buffer *cb = to_cobalt_buffer(vb);
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct cobalt_buffer *cb = to_cobalt_buffer(vbuf);
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
        unsigned long flags;
 
        /* Prepare new buffer */
@@ -284,7 +286,7 @@ static void cobalt_dma_start_streaming(struct cobalt_stream *s)
                          &vo->control);
        }
        cb = list_first_entry(&s->bufs, struct cobalt_buffer, list);
-       omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.v4l2_buf.index]);
+       omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.vb2_buf.index]);
        spin_unlock_irqrestore(&s->irqlock, flags);
 }
 
@@ -381,7 +383,7 @@ static void cobalt_dma_stop_streaming(struct cobalt_stream *s)
        spin_lock_irqsave(&s->irqlock, flags);
        list_for_each(p, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
-               desc = &s->dma_desc_info[cb->vb.v4l2_buf.index];
+               desc = &s->dma_desc_info[cb->vb.vb2_buf.index];
                /* Stop DMA after this descriptor chain */
                descriptor_list_end_of_chain(desc);
        }
@@ -416,7 +418,7 @@ static void cobalt_stop_streaming(struct vb2_queue *q)
        list_for_each_safe(p, safe, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
                list_del(&cb->list);
-               vb2_buffer_done(&cb->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&cb->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&s->irqlock, flags);