|
@@ -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_ctx[plane] ? : &q->dev,
|
|
|
q->dma_attrs, size, dma_dir, q->gfp_flags);
|
|
|
if (IS_ERR_OR_NULL(mem_priv))
|
|
|
goto free;
|
|
@@ -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_ctx[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_ctx[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);
|