*参照元 [#ea483fad] #backlinks *説明 [#wa16ab62] -パス: [[linux-4.4.1/drivers/staging/android/ion/ion.c]] -FIXME: これは何? --説明 **引数 [#l090860e] -long (*custom_ioctl)(struct ion_client *client, unsigned int cmd, unsigned long arg) -- --[[linux-4.4.1/ion_client]] **返り値 [#sf898a9b] -struct ion_device * -- --[[linux-4.4.1/ion_device]] **参考 [#gf7d6c20] *実装 [#z48ee22f] 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); - --[[linux-4.4.1/kzalloc()]] --[[linux-4.4.1/ERR_PTR()]] 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); } - --[[linux-4.4.1/MISC_DYNAMIC_MINOR]] --[[linux-4.4.1/ion_fops(global)]] --[[linux-4.4.1/misc_register()]] --[[linux-4.4.1/pr_err()]] --[[linux-4.4.1/kfree()]] 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; } - --[[linux-4.4.1/debugfs_create_dir()]] 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; - --[[linux-4.4.1/RB_ROOT]] mutex_init(&idev->buffer_lock); init_rwsem(&idev->lock); plist_head_init(&idev->heaps); - --[[linux-4.4.1/mutex_init()]] --[[linux-4.4.1/init_rwsem()]] --[[linux-4.4.1/plist_head_init()]] idev->clients = RB_ROOT; return idev; } EXPORT_SYMBOL(ion_device_create); - --[[linux-4.4.1/EXPORT_SYMBOL()]] *コメント [#g5428ce8]