参照元

説明

引数

返り値

参考

実装

struct dma_buf *ion_share_dma_buf(struct ion_client *client,
                                                struct ion_handle *handle)
{
        DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
        struct ion_buffer *buffer;
        struct dma_buf *dmabuf;
        bool valid_handle;
        mutex_lock(&client->lock);
        valid_handle = ion_handle_validate(client, handle);
        if (!valid_handle) {
                WARN(1, "%s: invalid handle passed to share.\n", __func__);
                mutex_unlock(&client->lock);
                return ERR_PTR(-EINVAL);
        }
        buffer = handle->buffer;
        ion_buffer_get(buffer);
        mutex_unlock(&client->lock);
        exp_info.ops = &dma_buf_ops;
        exp_info.size = buffer->size;
        exp_info.flags = O_RDWR;
        exp_info.priv = buffer;
        dmabuf = dma_buf_export(&exp_info);
        if (IS_ERR(dmabuf)) {
                ion_buffer_put(buffer);
                return dmabuf;
        }
        return dmabuf;
}
EXPORT_SYMBOL(ion_share_dma_buf);

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-10-27 (木) 17:45:21