static void __exit godbox_ion_exit(void) { if (godbox_ion_device) ion_device_destroy(godbox_ion_device); platform_driver_unregister(&godbox_ion_driver); }
int dev_ion_remove(struct platform_device *pdev) { struct ion_device *idev = platform_get_drvdata(pdev); int i; ion_device_destroy(idev); for (i = 0; i < num_heaps; i++) ion_heap_destroy(heaps[i]); kfree(heaps); return 0; }
int sunxi_ion_remove(struct platform_device *pdev) { struct ion_device *dev = platform_get_drvdata(pdev); while(num_heaps--) ion_heap_destroy(pheap[num_heaps]); kfree(pheap); ion_device_destroy(dev); return 0; }
static int pxa_ion_probe(struct platform_device *pdev) { struct ion_platform_data *pdata = pdev->dev.platform_data; struct pxa_ion_info *info; int err, i; if (!pdata) return -EINVAL; info = devm_kzalloc(&pdev->dev, sizeof(struct pxa_ion_info), GFP_KERNEL); if (!info) return -ENOMEM; info->heaps = devm_kzalloc(&pdev->dev, sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL); if (!info->heaps) { devm_kfree(&pdev->dev, info); return -ENOMEM; } info->heap_cnt = pdata->nr; info->idev = ion_device_create(pxa_ion_ioctl); if (IS_ERR_OR_NULL(info->idev)) { devm_kfree(&pdev->dev, info->heaps); devm_kfree(&pdev->dev, info); return PTR_ERR(info->idev); } pxa_ion_dev = info->idev; /* create the heaps as specified in the board file */ for (i = 0; i < pdata->nr; i++) { struct ion_platform_heap *heap_data = &pdata->heaps[i]; info->heaps[i] = ion_heap_create(heap_data); if (IS_ERR_OR_NULL(info->heaps[i])) { err = PTR_ERR(info->heaps[i]); goto err_heap; } ion_device_add_heap(info->idev, info->heaps[i]); } platform_set_drvdata(pdev, info); return 0; err_heap: for (; i > 0; i--) ion_heap_destroy(info->heaps[i]); ion_device_destroy(info->idev); devm_kfree(&pdev->dev, info->heaps); devm_kfree(&pdev->dev, info); return err; }
static int pxa_ion_remove(struct platform_device *pdev) { struct pxa_ion_info *info = platform_get_drvdata(pdev); int i; if (info) { for (i = 0; i < info->heap_cnt; i++) ion_heap_destroy(info->heaps[i]); ion_device_destroy(info->idev); platform_set_drvdata(pdev, NULL); } return 0; }
int omap_ion_remove(struct platform_device *pdev) { struct ion_device *idev = platform_get_drvdata(pdev); int i; ion_device_destroy(idev); for (i = 0; i < num_heaps; i++) if (heaps[i]->type == OMAP_ION_HEAP_TYPE_TILER) omap_tiler_heap_destroy(heaps[i]); else ion_heap_destroy(heaps[i]); kfree(heaps); return 0; }
IMG_VOID IonDeinit(IMG_VOID) { int uiHeapCount = generic_config.nr; int i; for (i = 0; i < uiHeapCount; i++) { if (apsIonHeaps[i]) { ion_heap_destroy(apsIonHeaps[i]); } } kfree(apsIonHeaps); ion_device_destroy(psIonDev); }
PVRSRV_ERROR IonInit(void *phPrivateData) { int uiHeapCount = generic_config.nr; int uiError; int i; PVR_UNREFERENCED_PARAMETER(phPrivateData); g_apsIonHeaps = kzalloc(sizeof(struct ion_heap *) * uiHeapCount, GFP_KERNEL); /* Create the ion devicenode */ g_psIonDev = ion_device_create(NULL); if (IS_ERR_OR_NULL(g_psIonDev)) { kfree(g_apsIonHeaps); return PVRSRV_ERROR_OUT_OF_MEMORY; } /* Register all the heaps */ for (i = 0; i < generic_config.nr; i++) { struct ion_platform_heap *psPlatHeapData = &generic_config.heaps[i]; g_apsIonHeaps[i] = ion_heap_create(psPlatHeapData); if (IS_ERR_OR_NULL(g_apsIonHeaps[i])) { uiError = PTR_ERR(g_apsIonHeaps[i]); goto failHeapCreate; } ion_device_add_heap(g_psIonDev, g_apsIonHeaps[i]); } return PVRSRV_OK; failHeapCreate: for (i = 0; i < uiHeapCount; i++) { if (g_apsIonHeaps[i]) { ion_heap_destroy(g_apsIonHeaps[i]); } } kfree(g_apsIonHeaps); ion_device_destroy(g_psIonDev); return PVRSRV_ERROR_OUT_OF_MEMORY; }
static void __exit ion_dummy_exit(void) { int i; ion_device_destroy(idev); for (i = 0; i < dummy_ion_pdata.nr; i++) ion_heap_destroy(heaps[i]); kfree(heaps); if (carveout_ptr) { free_pages_exact(carveout_ptr, dummy_heaps[ION_HEAP_TYPE_CARVEOUT].size); carveout_ptr = NULL; } if (chunk_ptr) { free_pages_exact(chunk_ptr, dummy_heaps[ION_HEAP_TYPE_CHUNK].size); chunk_ptr = NULL; } }
int sunxi_ion_probe(struct platform_device *pdev) { struct ion_platform_data *pdata = pdev->dev.platform_data; struct ion_platform_heap *heaps_desc; int i, ret = 0; pheap = kzalloc(sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL); idev = ion_device_create(sunxi_ion_ioctl); if(IS_ERR_OR_NULL(idev)) { kfree(pheap); return PTR_ERR(idev); } for(i = 0; i < pdata->nr; i++) { heaps_desc = &pdata->heaps[i]; if(heaps_desc->type == ION_HEAP_TYPE_CARVEOUT) { heaps_desc->base = ion_mem.start; heaps_desc->size = ion_mem.size; } pheap[i] = ion_heap_create(heaps_desc); if(IS_ERR_OR_NULL(pheap[i])) { ret = PTR_ERR(pheap[i]); goto err; } ion_device_add_heap(idev, pheap[i]); if(heaps_desc->type == ION_HEAP_TYPE_CARVEOUT) carveout_heap = pheap[i]; } num_heaps = i; platform_set_drvdata(pdev, idev); return 0; err: while(i--) ion_heap_destroy(pheap[i]); ion_device_destroy(idev); kfree(pheap); return ret; }