*参照元 [#eddca753] #backlinks *説明 [#k6c441a1] -パス: [[linux-4.4.1/drivers/media/v4l2-core/videobuf2-dma-contig.c]] -FIXME: これは何? --説明 **引数 [#a5805557] -void *alloc_ctx -- -struct dma_buf *dbuf -- --[[linux-4.4.1/dma_buf]] -unsigned long size -- -enum dma_data_direction dma_dir -- --[[linux-4.4.1/dma_data_direction]] **返り値 [#je5db321] -void * -- **参考 [#tdb452fb] *実装 [#u40cbd2e] static void *vb2_dc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf, unsigned long size, enum dma_data_direction dma_dir) { struct vb2_dc_conf *conf = alloc_ctx; struct vb2_dc_buf *buf; struct dma_buf_attachment *dba; - --[[linux-4.4.1/vb2_dc_conf]] --[[linux-4.4.1/vb2_dc_buf]] --[[linux-4.4.1/dma_buf_attachment]] if (dbuf->size < size) return ERR_PTR(-EFAULT); - --[[linux-4.4.1/ERR_PTR()]] buf = kzalloc(sizeof(*buf), GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); - --[[linux-4.4.1/kzalloc()]] buf->dev = conf->dev; /* create attachment for the dmabuf with the user device */ dba = dma_buf_attach(dbuf, buf->dev); if (IS_ERR(dba)) { pr_err("failed to attach dmabuf\n"); kfree(buf); return dba; } - --[[linux-4.4.1/dma_buf_attach()]] --[[linux-4.4.1/IS_ERR()]] --[[linux-4.4.1/pr_err()]] --[[linux-4.4.1/kfree()]] buf->dma_dir = dma_dir; buf->size = size; buf->db_attach = dba; return buf; } *コメント [#me7e2523]