参照元

説明

引数

返り値

参考

実装

struct ion_device *ion_device_create(long (*custom_ioctl)
                                     (struct ion_client *client,
                                      unsigned int cmd,
                                      unsigned long arg))
{
        struct ion_device *idev;
        int ret;

        idev = kzalloc(sizeof(struct ion_device), GFP_KERNEL);
        if (!idev)
                return ERR_PTR(-ENOMEM);
        idev->dev.minor = MISC_DYNAMIC_MINOR;
        idev->dev.name = "ion";
        idev->dev.fops = &ion_fops;
        idev->dev.parent = NULL;
        ret = misc_register(&idev->dev);
        if (ret) {
                pr_err("ion: failed to register misc device.\n");
                kfree(idev);
                return ERR_PTR(ret);
        }
        idev->debug_root = debugfs_create_dir("ion", NULL);
        if (!idev->debug_root) {
                pr_err("ion: failed to create debugfs root directory.\n");
                goto debugfs_done;
        }
        idev->heaps_debug_root = debugfs_create_dir("heaps", idev->debug_root);
        if (!idev->heaps_debug_root) {
                pr_err("ion: failed to create debugfs heaps directory.\n");
                goto debugfs_done;
        }
        idev->clients_debug_root = debugfs_create_dir("clients",
                                                idev->debug_root);
        if (!idev->clients_debug_root)
                pr_err("ion: failed to create debugfs clients directory.\n");

debugfs_done:

        idev->custom_ioctl = custom_ioctl;
        idev->buffers = RB_ROOT;
        mutex_init(&idev->buffer_lock);
        init_rwsem(&idev->lock);
        plist_head_init(&idev->heaps);
        idev->clients = RB_ROOT;
        return idev;
}
EXPORT_SYMBOL(ion_device_create);

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-03-09 (水) 12:40:15