*参照元 [#k824a534]
#backlinks

*説明 [#f16fb2de]
-パス: [[linux-4.4.1/drivers/staging/android/ion/ion.c]]

-FIXME: これは何?
--説明


**引数 [#dcb736aa]
-struct ion_client *client
--
--[[linux-4.4.1/ion_client]]
-int fd
--


**返り値 [#ma7010a4]
-struct ion_handle *
--
--[[linux-4.4.1/ion_handle]]


**参考 [#l02a60cb]


*実装 [#qa53831b]
 struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd)
 {
         struct dma_buf *dmabuf;
         struct ion_buffer *buffer;
         struct ion_handle *handle;
         int ret;
 
-
--[[linux-4.4.1/dma_buf]]
--[[linux-4.4.1/ion_buffer]]
--[[linux-4.4.1/ion_handle]]

         dmabuf = dma_buf_get(fd);
         if (IS_ERR(dmabuf))
                 return ERR_CAST(dmabuf);
         /* if this memory came from ion */
 
-
--[[linux-4.4.1/dma_buf_get()]]
--[[linux-4.4.1/IS_ERR()]]
--[[linux-4.4.1/ERR_CAST()]]

         if (dmabuf->ops != &dma_buf_ops) {
                 pr_err("%s: can not import dmabuf from another exporter\n",
                        __func__);
                 dma_buf_put(dmabuf);
                 return ERR_PTR(-EINVAL);
         }
         buffer = dmabuf->priv;
 
-
--[[linux-4.4.1/dma_buf_ops(global)]]
--[[linux-4.4.1/dma_buf_put()]]
--[[linux-4.4.1/ERR_PTR()]]

         mutex_lock(&client->lock);
         /* if a handle exists for this buffer just take a reference to it */
         handle = ion_handle_lookup(client, buffer);
         if (!IS_ERR(handle)) {
                 ion_handle_get(handle);
                 mutex_unlock(&client->lock);
                 goto end;
         }
 
-
--[[linux-4.4.1/mutex_lock()]]
--[[linux-4.4.1/ion_handle_lookup()]]
--[[linux-4.4.1/ion_handle_get()]]
--[[linux-4.4.1/mutex_unlock()]]

         handle = ion_handle_create(client, buffer);
         if (IS_ERR(handle)) {
                 mutex_unlock(&client->lock);
                 goto end;
         }
 
-
--[[linux-4.4.1/ion_handle_create()]]

         ret = ion_handle_add(client, handle);
         mutex_unlock(&client->lock);
         if (ret) {
                 ion_handle_put(handle);
                 handle = ERR_PTR(ret);
         }
 
-
--[[linux-4.4.1/ion_handle_add()]]

 end:
         dma_buf_put(dmabuf);
         return handle;
 }
 EXPORT_SYMBOL(ion_import_dma_buf);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]


*コメント [#e29db677]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS