Merge tag 'armsoc-arm64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[cascardo/linux.git] / drivers / media / v4l2-core / videobuf2-core.c
index 36f4392..ca8ffeb 100644 (file)
@@ -206,7 +206,8 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
        for (plane = 0; plane < vb->num_planes; ++plane) {
                unsigned long size = PAGE_ALIGN(vb->planes[plane].length);
 
-               mem_priv = call_ptr_memop(vb, alloc, q->alloc_ctx[plane],
+               mem_priv = call_ptr_memop(vb, alloc,
+                               q->alloc_devs[plane] ? : q->dev,
                                q->dma_attrs, size, dma_dir, q->gfp_flags);
                if (IS_ERR_OR_NULL(mem_priv))
                        goto free;
@@ -737,7 +738,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
         */
        num_buffers = min_t(unsigned int, *count, VB2_MAX_FRAME);
        num_buffers = max_t(unsigned int, num_buffers, q->min_buffers_needed);
-       memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
+       memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
        q->memory = memory;
 
        /*
@@ -745,7 +746,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
         * Driver also sets the size and allocator context for each plane.
         */
        ret = call_qop(q, queue_setup, q, &num_buffers, &num_planes,
-                      plane_sizes, q->alloc_ctx);
+                      plane_sizes, q->alloc_devs);
        if (ret)
                return ret;
 
@@ -778,7 +779,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
                num_planes = 0;
 
                ret = call_qop(q, queue_setup, q, &num_buffers,
-                              &num_planes, plane_sizes, q->alloc_ctx);
+                              &num_planes, plane_sizes, q->alloc_devs);
 
                if (!ret && allocated_buffers < num_buffers)
                        ret = -ENOMEM;
@@ -844,7 +845,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
        }
 
        if (!q->num_buffers) {
-               memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
+               memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
                q->memory = memory;
                q->waiting_for_buffers = !q->is_output;
        }
@@ -861,7 +862,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
         * buffer and their sizes are acceptable
         */
        ret = call_qop(q, queue_setup, q, &num_buffers,
-                      &num_planes, plane_sizes, q->alloc_ctx);
+                      &num_planes, plane_sizes, q->alloc_devs);
        if (ret)
                return ret;
 
@@ -884,7 +885,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
                 * queue driver has set up
                 */
                ret = call_qop(q, queue_setup, q, &num_buffers,
-                              &num_planes, plane_sizes, q->alloc_ctx);
+                              &num_planes, plane_sizes, q->alloc_devs);
 
                if (!ret && allocated_buffers < num_buffers)
                        ret = -ENOMEM;
@@ -1131,9 +1132,10 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const void *pb)
                vb->planes[plane].data_offset = 0;
 
                /* Acquire each plane's memory */
-               mem_priv = call_ptr_memop(vb, get_userptr, q->alloc_ctx[plane],
-                                     planes[plane].m.userptr,
-                                     planes[plane].length, dma_dir);
+               mem_priv = call_ptr_memop(vb, get_userptr,
+                               q->alloc_devs[plane] ? : q->dev,
+                               planes[plane].m.userptr,
+                               planes[plane].length, dma_dir);
                if (IS_ERR_OR_NULL(mem_priv)) {
                        dprintk(1, "failed acquiring userspace "
                                                "memory for plane %d\n", plane);
@@ -1256,8 +1258,8 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb)
 
                /* Acquire each plane's memory */
                mem_priv = call_ptr_memop(vb, attach_dmabuf,
-                       q->alloc_ctx[plane], dbuf, planes[plane].length,
-                       dma_dir);
+                               q->alloc_devs[plane] ? : q->dev,
+                               dbuf, planes[plane].length, dma_dir);
                if (IS_ERR(mem_priv)) {
                        dprintk(1, "failed to attach dmabuf\n");
                        ret = PTR_ERR(mem_priv);
@@ -1845,7 +1847,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
         * Make sure to call buf_finish for any queued buffers. Normally
         * that's done in dqbuf, but that's not going to happen when we
         * cancel the whole queue. Note: this code belongs here, not in
-        * __vb2_dqbuf() since in vb2_internal_dqbuf() there is a critical
+        * __vb2_dqbuf() since in vb2_core_dqbuf() there is a critical
         * call to __fill_user_buffer() after buf_finish(). That order can't
         * be changed, so we can't move the buf_finish() to __vb2_dqbuf().
         */