参照元

説明

引数

返り値

参考

実装

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;
        if (dbuf->size < size)
                return ERR_PTR(-EFAULT);
        buf = kzalloc(sizeof(*buf), GFP_KERNEL);
        if (!buf)
                return ERR_PTR(-ENOMEM);
        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;
        }
        buf->dma_dir = dma_dir;
        buf->size = size;
        buf->db_attach = dba;

        return buf;
}

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-02-08 (月) 11:20:20