mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 13:27:06 +09:00
ODROID-XU4: videobuf2-dc: Move vb2_dc_get_base_sgt() above mmap callbacks
This patch moves vb2_dc_get_base_sgt() function above mmap buffers callbacks, particularly vb2_dc_alloc() and vb2_dc_mmap() from where it will be called for cacheable MMAP support introduced in the next patch. Change-Id: Ia504fbc1f0b3741986e8fff1ad329215b6e2db2e Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Signed-off-by: memeka <mihailescu2m@gmail.com>
This commit is contained in:
committed by
Dongjin Kim
parent
55be24bbfd
commit
364d062efe
@@ -62,6 +62,28 @@ static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
|
||||
return size;
|
||||
}
|
||||
|
||||
static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)
|
||||
{
|
||||
int ret;
|
||||
struct sg_table *sgt;
|
||||
|
||||
sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
|
||||
if (!sgt) {
|
||||
dev_err(buf->dev, "failed to alloc sg table\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = dma_get_sgtable_attrs(buf->dev, sgt, buf->cookie, buf->dma_addr,
|
||||
buf->size, buf->attrs);
|
||||
if (ret < 0) {
|
||||
dev_err(buf->dev, "failed to get scatterlist from DMA API\n");
|
||||
kfree(sgt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sgt;
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
/* callbacks for all buffers */
|
||||
/*********************************************/
|
||||
@@ -366,28 +388,6 @@ static const struct dma_buf_ops vb2_dc_dmabuf_ops = {
|
||||
.release = vb2_dc_dmabuf_ops_release,
|
||||
};
|
||||
|
||||
static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)
|
||||
{
|
||||
int ret;
|
||||
struct sg_table *sgt;
|
||||
|
||||
sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);
|
||||
if (!sgt) {
|
||||
dev_err(buf->dev, "failed to alloc sg table\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = dma_get_sgtable_attrs(buf->dev, sgt, buf->cookie, buf->dma_addr,
|
||||
buf->size, buf->attrs);
|
||||
if (ret < 0) {
|
||||
dev_err(buf->dev, "failed to get scatterlist from DMA API\n");
|
||||
kfree(sgt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sgt;
|
||||
}
|
||||
|
||||
static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, unsigned long flags)
|
||||
{
|
||||
struct vb2_dc_buf *buf = buf_priv;
|
||||
|
||||
Reference in New Issue
Block a user