Merge remote-tracking branch 'staging/staging-next'
[deliverable/linux.git] / drivers / staging / android / ion / ion_carveout_heap.c
index 1fb0d81556da80dbea52e0ac9f6ac36f8384322c..c4f0795fb62e086d41a7d64b753710f46cad075b 100644 (file)
@@ -25,6 +25,8 @@
 #include "ion.h"
 #include "ion_priv.h"
 
+#define ION_CARVEOUT_ALLOCATE_FAIL     -1
+
 struct ion_carveout_heap {
        struct ion_heap heap;
        struct gen_pool *pool;
@@ -56,19 +58,6 @@ void ion_carveout_free(struct ion_heap *heap, ion_phys_addr_t addr,
        gen_pool_free(carveout_heap->pool, addr, size);
 }
 
-static int ion_carveout_heap_phys(struct ion_heap *heap,
-                                 struct ion_buffer *buffer,
-                                 ion_phys_addr_t *addr, size_t *len)
-{
-       struct sg_table *table = buffer->priv_virt;
-       struct page *page = sg_page(table->sgl);
-       ion_phys_addr_t paddr = PFN_PHYS(page_to_pfn(page));
-
-       *addr = paddr;
-       *len = buffer->size;
-       return 0;
-}
-
 static int ion_carveout_heap_allocate(struct ion_heap *heap,
                                      struct ion_buffer *buffer,
                                      unsigned long size, unsigned long align,
@@ -95,7 +84,7 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap,
        }
 
        sg_set_page(table->sgl, pfn_to_page(PFN_DOWN(paddr)), size, 0);
-       buffer->priv_virt = table;
+       buffer->sg_table = table;
 
        return 0;
 
@@ -109,7 +98,7 @@ err_free:
 static void ion_carveout_heap_free(struct ion_buffer *buffer)
 {
        struct ion_heap *heap = buffer->heap;
-       struct sg_table *table = buffer->priv_virt;
+       struct sg_table *table = buffer->sg_table;
        struct page *page = sg_page(table->sgl);
        ion_phys_addr_t paddr = PFN_PHYS(page_to_pfn(page));
 
@@ -124,23 +113,9 @@ static void ion_carveout_heap_free(struct ion_buffer *buffer)
        kfree(table);
 }
 
-static struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap,
-                                                 struct ion_buffer *buffer)
-{
-       return buffer->priv_virt;
-}
-
-static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
-                                       struct ion_buffer *buffer)
-{
-}
-
 static struct ion_heap_ops carveout_heap_ops = {
        .allocate = ion_carveout_heap_allocate,
        .free = ion_carveout_heap_free,
-       .phys = ion_carveout_heap_phys,
-       .map_dma = ion_carveout_heap_map_dma,
-       .unmap_dma = ion_carveout_heap_unmap_dma,
        .map_user = ion_heap_map_user,
        .map_kernel = ion_heap_map_kernel,
        .unmap_kernel = ion_heap_unmap_kernel,
This page took 0.026957 seconds and 5 git commands to generate.