staging: android: ion: Drop ion_phys interface
authorLaura Abbott <labbott@redhat.com>
Mon, 8 Aug 2016 16:52:55 +0000 (09:52 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 14:38:43 +0000 (16:38 +0200)
ion_phys was an interface used for older legacy behavior. sg_tables
are the standard now. Get rid of it.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion.c
drivers/staging/android/ion/ion.h
drivers/staging/android/ion/ion_carveout_heap.c
drivers/staging/android/ion/ion_cma_heap.c
drivers/staging/android/ion/ion_priv.h
drivers/staging/android/ion/ion_system_heap.c

index 95b18acc8695a1c9593e0e6cfdd026157f8f7f95..bcf113f60fb2535bfc8f26df000ceb11a8ff6f7e 100644 (file)
@@ -576,32 +576,6 @@ void ion_free(struct ion_client *client, struct ion_handle *handle)
 }
 EXPORT_SYMBOL(ion_free);
 
-int ion_phys(struct ion_client *client, struct ion_handle *handle,
-            ion_phys_addr_t *addr, size_t *len)
-{
-       struct ion_buffer *buffer;
-       int ret;
-
-       mutex_lock(&client->lock);
-       if (!ion_handle_validate(client, handle)) {
-               mutex_unlock(&client->lock);
-               return -EINVAL;
-       }
-
-       buffer = handle->buffer;
-
-       if (!buffer->heap->ops->phys) {
-               pr_err("%s: ion_phys is not implemented by this heap (name=%s, type=%d).\n",
-                       __func__, buffer->heap->name, buffer->heap->type);
-               mutex_unlock(&client->lock);
-               return -ENODEV;
-       }
-       mutex_unlock(&client->lock);
-       ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
-       return ret;
-}
-EXPORT_SYMBOL(ion_phys);
-
 static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
 {
        void *vaddr;
index 225c34a20c67f251667c8fbb5480a532ca7a79ce..97eb7a72fa86f713452be866074b77a7ac2db279 100644 (file)
@@ -129,25 +129,6 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
  */
 void ion_free(struct ion_client *client, struct ion_handle *handle);
 
-/**
- * ion_phys - returns the physical address and len of a handle
- * @client:    the client
- * @handle:    the handle
- * @addr:      a pointer to put the address in
- * @len:       a pointer to put the length in
- *
- * This function queries the heap for a particular handle to get the
- * handle's physical address.  It't output is only correct if
- * a heap returns physically contiguous memory -- in other cases
- * this api should not be implemented -- ion_sg_table should be used
- * instead.  Returns -EINVAL if the handle is invalid.  This has
- * no implications on the reference counting of the handle --
- * the returned value may not be valid if the caller is not
- * holding a reference.
- */
-int ion_phys(struct ion_client *client, struct ion_handle *handle,
-            ion_phys_addr_t *addr, size_t *len);
-
 /**
  * ion_map_kernel - create mapping for the given handle
  * @client:    the client
index 1fb0d81556da80dbea52e0ac9f6ac36f8384322c..25b969bc140d7abd56ac361622519e9455bd739a 100644 (file)
@@ -56,19 +56,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,
@@ -138,7 +125,6 @@ static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
 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,
index a3446da4fdc2a6b70a8fb95a8686895156c781c4..0828e333f2e70a0ca43102b064fcdf3371c8c1e0 100644 (file)
@@ -105,23 +105,6 @@ static void ion_cma_free(struct ion_buffer *buffer)
        kfree(info);
 }
 
-/* return physical address in addr */
-static int ion_cma_phys(struct ion_heap *heap, struct ion_buffer *buffer,
-                       ion_phys_addr_t *addr, size_t *len)
-{
-       struct ion_cma_heap *cma_heap = to_cma_heap(buffer->heap);
-       struct device *dev = cma_heap->dev;
-       struct ion_cma_buffer_info *info = buffer->priv_virt;
-
-       dev_dbg(dev, "Return buffer %p physical address %pa\n", buffer,
-               &info->handle);
-
-       *addr = info->handle;
-       *len = buffer->size;
-
-       return 0;
-}
-
 static struct sg_table *ion_cma_heap_map_dma(struct ion_heap *heap,
                                             struct ion_buffer *buffer)
 {
@@ -164,7 +147,6 @@ static struct ion_heap_ops ion_cma_ops = {
        .free = ion_cma_free,
        .map_dma = ion_cma_heap_map_dma,
        .unmap_dma = ion_cma_heap_unmap_dma,
-       .phys = ion_cma_phys,
        .map_user = ion_cma_mmap,
        .map_kernel = ion_cma_map_kernel,
        .unmap_kernel = ion_cma_unmap_kernel,
index 0239883bffb72a82c0ffb05bc9aaaf0ee52f32aa..141fb0d7b4cd3507c21c4c1ab36bdad4c9304e5d 100644 (file)
@@ -42,8 +42,6 @@ struct ion_buffer *ion_handle_buffer(struct ion_handle *handle);
  * @size:              size of the buffer
  * @priv_virt:         private data to the buffer representable as
  *                     a void *
- * @priv_phys:         private data to the buffer representable as
- *                     an ion_phys_addr_t (and someday a phys_addr_t)
  * @lock:              protects the buffers cnt fields
  * @kmap_cnt:          number of times the buffer is mapped to the kernel
  * @vaddr:             the kernel mapping if kmap_cnt is not zero
@@ -69,10 +67,7 @@ struct ion_buffer {
        unsigned long flags;
        unsigned long private_flags;
        size_t size;
-       union {
-               void *priv_virt;
-               ion_phys_addr_t priv_phys;
-       };
+       void *priv_virt;
        struct mutex lock;
        int kmap_cnt;
        void *vaddr;
@@ -91,8 +86,6 @@ void ion_buffer_destroy(struct ion_buffer *buffer);
  * struct ion_heap_ops - ops to operate on a given heap
  * @allocate:          allocate memory
  * @free:              free memory
- * @phys               get physical address of a buffer (only define on
- *                     physically contiguous heaps)
  * @map_dma            map the memory for dma to a scatterlist
  * @unmap_dma          unmap the memory for dma
  * @map_kernel         map memory to the kernel
@@ -111,8 +104,6 @@ struct ion_heap_ops {
                        struct ion_buffer *buffer, unsigned long len,
                        unsigned long align, unsigned long flags);
        void (*free)(struct ion_buffer *buffer);
-       int (*phys)(struct ion_heap *heap, struct ion_buffer *buffer,
-                   ion_phys_addr_t *addr, size_t *len);
        struct sg_table * (*map_dma)(struct ion_heap *heap,
                                     struct ion_buffer *buffer);
        void (*unmap_dma)(struct ion_heap *heap, struct ion_buffer *buffer);
index b69dfc706440ebbd25d509d837ed471e2e9a99ba..02bae94018af02efc5b78ba1db58c1c752c269f9 100644 (file)
@@ -386,17 +386,6 @@ static void ion_system_contig_heap_free(struct ion_buffer *buffer)
        kfree(table);
 }
 
-static int ion_system_contig_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);
-       *addr = page_to_phys(page);
-       *len = buffer->size;
-       return 0;
-}
-
 static struct sg_table *ion_system_contig_heap_map_dma(struct ion_heap *heap,
                                                struct ion_buffer *buffer)
 {
@@ -411,7 +400,6 @@ static void ion_system_contig_heap_unmap_dma(struct ion_heap *heap,
 static struct ion_heap_ops kmalloc_ops = {
        .allocate = ion_system_contig_heap_allocate,
        .free = ion_system_contig_heap_free,
-       .phys = ion_system_contig_heap_phys,
        .map_dma = ion_system_contig_heap_map_dma,
        .unmap_dma = ion_system_contig_heap_unmap_dma,
        .map_kernel = ion_heap_map_kernel,