*参照元 [#k81d1f25]
#backlinks

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

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


**引数 [#x9ef103d]
-struct ion_device *dev
--
--[[linux-4.4.1/ion_device]]
-struct ion_heap *heap
--
--[[linux-4.4.1/ion_heap]]


**返り値 [#jfbb7f55]
-なし


**参考 [#u03a713f]


*実装 [#offc3eb2]
 void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
 {
         struct dentry *debug_file;
 
         if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma ||
             !heap->ops->unmap_dma)
                 pr_err("%s: can not add heap with invalid ops struct.\n",
                        __func__);
 
-最低限必要な操作(allocate, free, map_dma, unmap_dma)を定義していなければエラー。
--heap->ops は struct ion_heap_ops * 型の変数
--[[linux-4.4.1/ion_heap_ops]]
--[[linux-4.4.1/pr_err()]]

         spin_lock_init(&heap->free_lock);
         heap->free_list_size = 0;
 
-
--[[linux-4.4.1/spin_lock_init()]]

         if (heap->flags & ION_HEAP_FLAG_DEFER_FREE)
                 ion_heap_init_deferred_free(heap);
 
-
--[[linux-4.4.1/ION_HEAP_FLAG_DEFER_FREE]]
--[[linux-4.4.1/ion_heap_init_deferred_free()]]

         if ((heap->flags & ION_HEAP_FLAG_DEFER_FREE) || heap->ops->shrink)
                 ion_heap_init_shrinker(heap);
 
-
--[[linux-4.4.1/ion_heap_init_shrinker()]]

         heap->dev = dev;
         down_write(&dev->lock);
-
--[[linux-4.4.1/down_write()]]

         /*
          * use negative heap->id to reverse the priority -- when traversing
          * the list later attempt higher id numbers first
          */
         plist_node_init(&heap->node, -heap->id);
         plist_add(&heap->node, &dev->heaps);
         debug_file = debugfs_create_file(heap->name, 0664,
                                         dev->heaps_debug_root, heap,
                                         &debug_heap_fops);
 
-
--[[linux-4.4.1/plist_node_init()]]
--[[linux-4.4.1/plist_add()]]
--[[linux-4.4.1/debugfs_create_file()]]

         if (!debug_file) {
                 char buf[256], *path;
 
                 path = dentry_path(dev->heaps_debug_root, buf, 256);
                 pr_err("Failed to create heap debugfs at %s/%s\n",
                         path, heap->name);
-
--[[linux-4.4.1/dentry_path()]]

         }
 
         if (heap->shrinker.count_objects && heap->shrinker.scan_objects) {
                 char debug_name[64];
 
                 snprintf(debug_name, 64, "%s_shrink", heap->name);
                 debug_file = debugfs_create_file(
                         debug_name, 0644, dev->heaps_debug_root, heap,
                         &debug_shrink_fops);
-
--[[linux-4.4.1/snprintf()]]
--[[linux-4.4.1/debugfs_create_file()]]
--[[linux-4.4.1/debug_shrink_fops(global)]]

                 if (!debug_file) {
                         char buf[256], *path;
 
                         path = dentry_path(dev->heaps_debug_root, buf, 256);
                         pr_err("Failed to create heap shrinker debugfs at %s/%s\n",
                                 path, debug_name);
-
--[[linux-4.4.1/dentry_path()]]

                 }
         }
 
         up_write(&dev->lock);
-
--[[linux-4.4.1/up_write()]]

 }
 EXPORT_SYMBOL(ion_device_add_heap);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]


*コメント [#w731c83a]

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