*参照元 [#oa09b28d] #backlinks *説明 [#wa99c8f4] -パス: [[linux-4.4.1/drivers/media/v4l2-core/videobuf2-dma-contig.c]] -FIXME: これは何? --説明 **引数 [#o73f0d74] -void *mem_priv -- **返り値 [#y016afee] -int -- **参考 [#p33f815a] *実装 [#vd4c7cb9] static int vb2_dc_map_dmabuf(void *mem_priv) { struct vb2_dc_buf *buf = mem_priv; struct sg_table *sgt; unsigned long contig_size; - --[[linux-4.4.1/vb2_dc_buf]] --[[linux-4.4.1/sg_table()]] if (WARN_ON(!buf->db_attach)) { pr_err("trying to pin a non attached buffer\n"); return -EINVAL; } if (WARN_ON(buf->dma_sgt)) { pr_err("dmabuf buffer is already pinned\n"); return 0; } - --[[linux-4.4.1/WARN_ON()]] --[[linux-4.4.1/pr_err()]] /* get the associated scatterlist for this buffer */ sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir); if (IS_ERR(sgt)) { pr_err("Error getting dmabuf scatterlist\n"); return -EINVAL; } - --[[linux-4.4.1/dma_buf_map_attachment()]] /* checking if dmabuf is big enough to store contiguous chunk */ contig_size = vb2_dc_get_contiguous_size(sgt); if (contig_size < buf->size) { pr_err("contiguous chunk is too small %lu/%lu b\n", contig_size, buf->size); dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir); return -EFAULT; } - --[[linux-4.4.1/vb2_dc_get_contiguous_size()]] --[[linux-4.4.1/dma_buf_unmap_attachment()]] buf->dma_addr = sg_dma_address(sgt->sgl); buf->dma_sgt = sgt; buf->vaddr = NULL; - --[[linux-4.4.1/sg_dma_address()]] return 0; } *コメント [#df44be5a]