Commit 1d9735ef authored by Laura Abbott's avatar Laura Abbott Committed by Greg Kroah-Hartman

staging: android: ion: Remove alignment from allocation field

The align field was supposed to be used to specify the alignment of
the allocation. Nobody actually does anything with it except to check
if the alignment specified is out of bounds. Since this has no effect
on the actual allocation, just remove it.
Signed-off-by: default avatarLaura Abbott <labbott@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9c4e5271
...@@ -95,7 +95,6 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -95,7 +95,6 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
struct ion_handle *handle; struct ion_handle *handle;
handle = ion_alloc(client, data.allocation.len, handle = ion_alloc(client, data.allocation.len,
data.allocation.align,
data.allocation.heap_id_mask, data.allocation.heap_id_mask,
data.allocation.flags); data.allocation.flags);
if (IS_ERR(handle)) if (IS_ERR(handle))
......
...@@ -103,7 +103,6 @@ static void ion_buffer_add(struct ion_device *dev, ...@@ -103,7 +103,6 @@ static void ion_buffer_add(struct ion_device *dev,
static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
struct ion_device *dev, struct ion_device *dev,
unsigned long len, unsigned long len,
unsigned long align,
unsigned long flags) unsigned long flags)
{ {
struct ion_buffer *buffer; struct ion_buffer *buffer;
...@@ -119,15 +118,14 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, ...@@ -119,15 +118,14 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
buffer->flags = flags; buffer->flags = flags;
kref_init(&buffer->ref); kref_init(&buffer->ref);
ret = heap->ops->allocate(heap, buffer, len, align, flags); ret = heap->ops->allocate(heap, buffer, len, flags);
if (ret) { if (ret) {
if (!(heap->flags & ION_HEAP_FLAG_DEFER_FREE)) if (!(heap->flags & ION_HEAP_FLAG_DEFER_FREE))
goto err2; goto err2;
ion_heap_freelist_drain(heap, 0); ion_heap_freelist_drain(heap, 0);
ret = heap->ops->allocate(heap, buffer, len, align, ret = heap->ops->allocate(heap, buffer, len, flags);
flags);
if (ret) if (ret)
goto err2; goto err2;
} }
...@@ -401,7 +399,7 @@ static int ion_handle_add(struct ion_client *client, struct ion_handle *handle) ...@@ -401,7 +399,7 @@ static int ion_handle_add(struct ion_client *client, struct ion_handle *handle)
} }
struct ion_handle *ion_alloc(struct ion_client *client, size_t len, struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
size_t align, unsigned int heap_id_mask, unsigned int heap_id_mask,
unsigned int flags) unsigned int flags)
{ {
struct ion_handle *handle; struct ion_handle *handle;
...@@ -410,8 +408,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len, ...@@ -410,8 +408,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
struct ion_heap *heap; struct ion_heap *heap;
int ret; int ret;
pr_debug("%s: len %zu align %zu heap_id_mask %u flags %x\n", __func__, pr_debug("%s: len %zu heap_id_mask %u flags %x\n", __func__,
len, align, heap_id_mask, flags); len, heap_id_mask, flags);
/* /*
* traverse the list of heaps available in this system in priority * traverse the list of heaps available in this system in priority
* order. If the heap type is supported by the client, and matches the * order. If the heap type is supported by the client, and matches the
...@@ -428,7 +426,7 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len, ...@@ -428,7 +426,7 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
/* if the caller didn't specify this heap id */ /* if the caller didn't specify this heap id */
if (!((1 << heap->id) & heap_id_mask)) if (!((1 << heap->id) & heap_id_mask))
continue; continue;
buffer = ion_buffer_create(heap, dev, len, align, flags); buffer = ion_buffer_create(heap, dev, len, flags);
if (!IS_ERR(buffer)) if (!IS_ERR(buffer))
break; break;
} }
......
...@@ -45,7 +45,6 @@ struct ion_buffer; ...@@ -45,7 +45,6 @@ struct ion_buffer;
* @name: used for debug purposes * @name: used for debug purposes
* @base: base address of heap in physical memory if applicable * @base: base address of heap in physical memory if applicable
* @size: size of the heap in bytes if applicable * @size: size of the heap in bytes if applicable
* @align: required alignment in physical memory if applicable
* @priv: private info passed from the board file * @priv: private info passed from the board file
* *
* Provided by the board file. * Provided by the board file.
...@@ -93,8 +92,6 @@ void ion_client_destroy(struct ion_client *client); ...@@ -93,8 +92,6 @@ void ion_client_destroy(struct ion_client *client);
* ion_alloc - allocate ion memory * ion_alloc - allocate ion memory
* @client: the client * @client: the client
* @len: size of the allocation * @len: size of the allocation
* @align: requested allocation alignment, lots of hardware blocks
* have alignment requirements of some kind
* @heap_id_mask: mask of heaps to allocate from, if multiple bits are set * @heap_id_mask: mask of heaps to allocate from, if multiple bits are set
* heaps will be tried in order from highest to lowest * heaps will be tried in order from highest to lowest
* id * id
...@@ -106,7 +103,7 @@ void ion_client_destroy(struct ion_client *client); ...@@ -106,7 +103,7 @@ void ion_client_destroy(struct ion_client *client);
* an opaque handle to it. * an opaque handle to it.
*/ */
struct ion_handle *ion_alloc(struct ion_client *client, size_t len, struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
size_t align, unsigned int heap_id_mask, unsigned int heap_id_mask,
unsigned int flags); unsigned int flags);
/** /**
......
...@@ -34,8 +34,7 @@ struct ion_carveout_heap { ...@@ -34,8 +34,7 @@ struct ion_carveout_heap {
}; };
static ion_phys_addr_t ion_carveout_allocate(struct ion_heap *heap, static ion_phys_addr_t ion_carveout_allocate(struct ion_heap *heap,
unsigned long size, unsigned long size)
unsigned long align)
{ {
struct ion_carveout_heap *carveout_heap = struct ion_carveout_heap *carveout_heap =
container_of(heap, struct ion_carveout_heap, heap); container_of(heap, struct ion_carveout_heap, heap);
...@@ -60,16 +59,13 @@ static void ion_carveout_free(struct ion_heap *heap, ion_phys_addr_t addr, ...@@ -60,16 +59,13 @@ static void ion_carveout_free(struct ion_heap *heap, ion_phys_addr_t addr,
static int ion_carveout_heap_allocate(struct ion_heap *heap, static int ion_carveout_heap_allocate(struct ion_heap *heap,
struct ion_buffer *buffer, struct ion_buffer *buffer,
unsigned long size, unsigned long align, unsigned long size,
unsigned long flags) unsigned long flags)
{ {
struct sg_table *table; struct sg_table *table;
ion_phys_addr_t paddr; ion_phys_addr_t paddr;
int ret; int ret;
if (align > PAGE_SIZE)
return -EINVAL;
table = kmalloc(sizeof(*table), GFP_KERNEL); table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table) if (!table)
return -ENOMEM; return -ENOMEM;
...@@ -77,7 +73,7 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap, ...@@ -77,7 +73,7 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap,
if (ret) if (ret)
goto err_free; goto err_free;
paddr = ion_carveout_allocate(heap, size, align); paddr = ion_carveout_allocate(heap, size);
if (paddr == ION_CARVEOUT_ALLOCATE_FAIL) { if (paddr == ION_CARVEOUT_ALLOCATE_FAIL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_free_table; goto err_free_table;
......
...@@ -35,7 +35,7 @@ struct ion_chunk_heap { ...@@ -35,7 +35,7 @@ struct ion_chunk_heap {
static int ion_chunk_heap_allocate(struct ion_heap *heap, static int ion_chunk_heap_allocate(struct ion_heap *heap,
struct ion_buffer *buffer, struct ion_buffer *buffer,
unsigned long size, unsigned long align, unsigned long size,
unsigned long flags) unsigned long flags)
{ {
struct ion_chunk_heap *chunk_heap = struct ion_chunk_heap *chunk_heap =
...@@ -46,9 +46,6 @@ static int ion_chunk_heap_allocate(struct ion_heap *heap, ...@@ -46,9 +46,6 @@ static int ion_chunk_heap_allocate(struct ion_heap *heap,
unsigned long num_chunks; unsigned long num_chunks;
unsigned long allocated_size; unsigned long allocated_size;
if (align > chunk_heap->chunk_size)
return -EINVAL;
allocated_size = ALIGN(size, chunk_heap->chunk_size); allocated_size = ALIGN(size, chunk_heap->chunk_size);
num_chunks = allocated_size / chunk_heap->chunk_size; num_chunks = allocated_size / chunk_heap->chunk_size;
...@@ -160,8 +157,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data) ...@@ -160,8 +157,8 @@ struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data)
chunk_heap->heap.ops = &chunk_heap_ops; chunk_heap->heap.ops = &chunk_heap_ops;
chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK; chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE; chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
pr_debug("%s: base %lu size %zu align %ld\n", __func__, pr_debug("%s: base %lu size %zu \n", __func__,
chunk_heap->base, heap_data->size, heap_data->align); chunk_heap->base, heap_data->size);
return &chunk_heap->heap; return &chunk_heap->heap;
......
...@@ -40,7 +40,7 @@ struct ion_cma_buffer_info { ...@@ -40,7 +40,7 @@ struct ion_cma_buffer_info {
/* ION CMA heap operations functions */ /* ION CMA heap operations functions */
static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
unsigned long len, unsigned long align, unsigned long len,
unsigned long flags) unsigned long flags)
{ {
struct ion_cma_heap *cma_heap = to_cma_heap(heap); struct ion_cma_heap *cma_heap = to_cma_heap(heap);
...@@ -52,9 +52,6 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer, ...@@ -52,9 +52,6 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
if (buffer->flags & ION_FLAG_CACHED) if (buffer->flags & ION_FLAG_CACHED)
return -EINVAL; return -EINVAL;
if (align > PAGE_SIZE)
return -EINVAL;
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
......
...@@ -172,7 +172,7 @@ struct ion_handle { ...@@ -172,7 +172,7 @@ struct ion_handle {
struct ion_heap_ops { struct ion_heap_ops {
int (*allocate)(struct ion_heap *heap, int (*allocate)(struct ion_heap *heap,
struct ion_buffer *buffer, unsigned long len, struct ion_buffer *buffer, unsigned long len,
unsigned long align, unsigned long flags); unsigned long flags);
void (*free)(struct ion_buffer *buffer); void (*free)(struct ion_buffer *buffer);
void * (*map_kernel)(struct ion_heap *heap, struct ion_buffer *buffer); void * (*map_kernel)(struct ion_heap *heap, struct ion_buffer *buffer);
void (*unmap_kernel)(struct ion_heap *heap, struct ion_buffer *buffer); void (*unmap_kernel)(struct ion_heap *heap, struct ion_buffer *buffer);
......
...@@ -129,7 +129,7 @@ static struct page *alloc_largest_available(struct ion_system_heap *heap, ...@@ -129,7 +129,7 @@ static struct page *alloc_largest_available(struct ion_system_heap *heap,
static int ion_system_heap_allocate(struct ion_heap *heap, static int ion_system_heap_allocate(struct ion_heap *heap,
struct ion_buffer *buffer, struct ion_buffer *buffer,
unsigned long size, unsigned long align, unsigned long size,
unsigned long flags) unsigned long flags)
{ {
struct ion_system_heap *sys_heap = container_of(heap, struct ion_system_heap *sys_heap = container_of(heap,
...@@ -143,9 +143,6 @@ static int ion_system_heap_allocate(struct ion_heap *heap, ...@@ -143,9 +143,6 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
unsigned long size_remaining = PAGE_ALIGN(size); unsigned long size_remaining = PAGE_ALIGN(size);
unsigned int max_order = orders[0]; unsigned int max_order = orders[0];
if (align > PAGE_SIZE)
return -EINVAL;
if (size / PAGE_SIZE > totalram_pages / 2) if (size / PAGE_SIZE > totalram_pages / 2)
return -ENOMEM; return -ENOMEM;
...@@ -372,7 +369,6 @@ void ion_system_heap_destroy(struct ion_heap *heap) ...@@ -372,7 +369,6 @@ void ion_system_heap_destroy(struct ion_heap *heap)
static int ion_system_contig_heap_allocate(struct ion_heap *heap, static int ion_system_contig_heap_allocate(struct ion_heap *heap,
struct ion_buffer *buffer, struct ion_buffer *buffer,
unsigned long len, unsigned long len,
unsigned long align,
unsigned long flags) unsigned long flags)
{ {
int order = get_order(len); int order = get_order(len);
...@@ -381,9 +377,6 @@ static int ion_system_contig_heap_allocate(struct ion_heap *heap, ...@@ -381,9 +377,6 @@ static int ion_system_contig_heap_allocate(struct ion_heap *heap,
unsigned long i; unsigned long i;
int ret; int ret;
if (align > (PAGE_SIZE << order))
return -EINVAL;
page = alloc_pages(low_order_gfp_flags, order); page = alloc_pages(low_order_gfp_flags, order);
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment