Clean up the code in inline functions that deal with page and
range addresses. Use bool instead of int for boolean return
types and remove superfluous brackets.
Signed-off-by: Guillaume Tucker <guillaume.tucker@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This resolves a merge issue with
drivers/staging/iio/accel/sca3000_core.c and we want the fixes all in
here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If the copy_to_user() fails we should unlock and return directly without
updating "cnt". Also the return value should be -EFAULT instead of the
number of bytes remaining.
Fixes: 02b23803c6 ("staging: android: ion: Add ioctl to query available heaps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch add const qualifier at the declaration of the structure.
The structure become a read-only data, this increase the security.
Found with Coccinelle:
@r disable optional_qualifier@
identifier s,i;
@@
* static struct s i ={...};
Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The dma_buf_ops structure is stored in the ops field of a
dma_buf_export_info structure and also used as a condition inside the
if() statement. The if condition does not modify its value and the
ops field is of type const struct *dma_buf_ops, so dma_buf_ops
structures having this property can be declared as const.
File size before:
text data bss dec hex filename
14471 819 224 15514 3c9a
drivers/staging/android/ion/ion.o
File size after:
text data bss dec hex filename
14599 707 224 15530 3caa
drivers/staging/android/ion/ion.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
We're testing "pdev" but we intended to test "heap_pdev". This is a
static checker fix and it's unlikely that anyone is affected by this
bug.
Fixes: 13439479c7 ('staging: ion: Add files for parsing the devicetree')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cleanup extra line found by checkpatch.pl
Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks
Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the following blank line issues:
CHECK: Please don't use multiple blank lines
CHECK: Please use a blank line after function/struct/union/enum declarations
+}
+RESERVEDMEM_OF_DECLARE(ion, "ion-region", rmem_ion_setup);
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the following whitespace issues:
CHECK: Alignment should match open parenthesis
+ pr_info("%s: id %d type %d name %s align %lx\n", __func__,
+ heap->id, heap->type, heap->name, heap->align);
CHECK: Alignment should match open parenthesis
+struct ion_platform_data *ion_parse_dt(struct platform_device *pdev,
+ struct ion_of_heap *compatible)
CHECK: Alignment should match open parenthesis
+ heaps = devm_kzalloc(&pdev->dev,
+ sizeof(struct ion_platform_heap)*num_heaps,
CHECK: Alignment should match open parenthesis
+ data = devm_kzalloc(&pdev->dev, sizeof(struct ion_platform_data),
+ GFP_KERNEL);
CHECK: Alignment should match open parenthesis
+ heap_pdev = of_platform_device_create(node, heaps[i].name,
+ &pdev->dev);
CHECK: Alignment should match open parenthesis
+ pr_debug("%s: heap %s base %pa size %pa dev %p\n", __func__,
+ heap->name, &rmem->base, &rmem->size, dev);
CHECK: Alignment should match open parenthesis
+static void rmem_ion_device_release(struct reserved_mem *rmem,
+ struct device *dev)
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the following comparison with NULL issues:
CHECK: Comparison to NULL could be written "compatible[i].name"
+ for (i = 0; compatible[i].name != NULL; i++) {
CHECK: Comparison to NULL could be written "!compatible[i].name"
+ if (compatible[i].name == NULL)
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixed a coding style issue. Changed symbolic permissions to octal.
Signed-off-by: Eric Salem <ericsalem@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The preferred indentation for cases and switches has the cases at
the same level as the switch.
Signed-off-by: Christopher H. Pezley <chris@pezley.net>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the alignment of an allocation flag block comment
and moves the comments before each #define.
Signed-off-by: Antti Keränen <detegr@gmail.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
We get 4 warnings when building kernel with W=1:
drivers/staging/android/ion/ion_carveout_heap.c:36:17: warning: no previous prototype for 'ion_carveout_allocate' [-Wmissing-prototypes]
drivers/staging/android/ion/ion_carveout_heap.c:50:6: warning: no previous prototype for 'ion_carveout_free' [-Wmissing-prototypes]
drivers/staging/android/ion/ion_of.c:28:5: warning: no previous prototype for 'ion_parse_dt_heap_common' [-Wmissing-prototypes]
drivers/staging/android/ion/ion_of.c:54:5: warning: no previous prototype for 'ion_setup_heap_common' [-Wmissing-prototypes]
In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The newly added Hi6220 Ion code fails to build when the ION_OF helpers
are not present:
drivers/staging/android/ion/hisilicon/hi6220_ion.o: In function `hi6220_ion_remove':
hi6220_ion.c:(.text.hi6220_ion_remove+0x4c): undefined reference to `ion_destroy_platform_data'
drivers/staging/android/ion/hisilicon/hi6220_ion.o: In function `hi6220_ion_probe':
hi6220_ion.c:(.text.hi6220_ion_probe+0x5c): undefined reference to `ion_parse_dt'
hi6220_ion.c:(.text.hi6220_ion_probe+0xf8): undefined reference to `ion_destroy_platform_data'
This selects the symbol when needed.
Fixes: 2b40182a19 ("staging: android: ion: Add ion driver for Hi6220 SoC platform")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Laura Abbott <labbott@redhat.com>
Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In case of error, the function ion_device_create() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The Ion platform code uses of_platform_device_create which has
dependencies on OF_ADDRESS. Depending on OF is not sufficient
Building sparc64:allmodconfig ... failed
--------------
Error log:
...
drivers/built-in.o: In function `ion_parse_dt':
(.text+0x11aa2c): undefined reference to `of_platform_device_create'
Add a dependency on OF_ADDRESS
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Now that we have common devicetree bindings, convert hisilicon
platform to use the binding and parsing methods.
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Devicetree is the preferred mechanism for platform definition
these days. Add a set of files for supporting Ion with devicetree.
This includes a set of bindings for heaps common across all
devices and parsing methods. Clients may use the standard
bindings or they can call the parsing functions along with
their own parsing for platform specific heaps.
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This adds a base set of devicetree bindings for the Ion memory
manager. This supports setting up the generic set of heaps and
their properties.
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ion clients currently lack a good method to determine what
heaps are available and what ids they map to. This leads
to tight coupling between user and kernel space and headaches.
Add a query ioctl to let userspace know the availability of
heaps.
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The number of Ion ioctls may continue to grow along with necessary
validation. Pull it out into a separate file for easier management
and review.
Signed-off-by: Laura Abbott <labbott@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There is no advantage to having heap types be a mask. The ion client has
long since dropped the mask. Drop the notion of heap type masks as well.
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix checkpatch.pl warning about "Alignment should match open parenthesis".
Signed-off-by: Didik Setiawan <ds@didiksetiawan.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove the function ion_handle_buffer since it is not used anywhere.
Signed-off-by: Johanna Abrahamsson <johanna@mjao.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
It is not necessary to save the return value of kref_put since it is directly
returned.
Signed-off-by: Johanna Abrahamsson <johanna@mjao.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This fixes remaining checkpatch.pl "Alignment should match open
parenthesis" issues.
Signed-off-by: Ben LeMasurier <ben@crypt.ly>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alignment should match open parenthesis as per checkpatch.pl.
Signed-off-by: Johanna Abrahamsson <johanna@mjao.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
It is not neccessary to save the value of ion_handle_validate since it
is only used once.
Signed-off-by: Johanna Abrahamsson <johanna@mjao.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The ion_free_nolock() function should not BUG on a handle client mismatch.
Signed-off-by: Johanna Abrahamsson <johanna@mjao.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
It's useful to show the current memory in detail when alloc failed.
And, there may be a lot of high order alloc failed, just show memory
when an order 0 alloc failed.
Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add ion cached pool in system heap. This patch add a cached pool
in system heap. It has a great improvement of alloc for cached
buffer.
With memory pressue alloc test 800MB in userspace used iontest.
The result avg is 577ms. Without patch it's avg is about 883ms.
v1: Makes the cached buffer zeroed before going to pool
v2: Add cached param in pool to distinguish wheather need to flush
cache at a fresh alloc.
Rework the shrink function.
Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Xia Qing <saberlily.xia@hisilicon.com>
Reviewed-by: Fu Jun <oliver.fu@hisilicon.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This fixes the checkpatch.pl "Alignment should match open parenthesis"
issues in ion_test.c.
Signed-off-by: Ben LeMasurier <ben@crypt.ly>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This fixes the checkpatch.pl "Alignment should match open parenthesis"
issues in ion_heap.c.
Signed-off-by: Ben LeMasurier <ben@crypt.ly>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
SW_SYNC allows to run tests on the sync_file framework via debugfs on
<debugfs>/sync/sw_sync
Opening and closing the file triggers creation and release of a sync
timeline. To create fences on this timeline the SW_SYNC_IOC_CREATE_FENCE
ioctl should be used. To increment the timeline value use SW_SYNC_IOC_INC.
Also it exports Sync information on
<debugfs>/sync/info
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This interface is hidden from kernel headers and it is intended for use
only for testing. So testers would have to add the ioctl information
internally. This is to prevent misuse of this feature.
v2: take in Eric suggestions for the Documentation
v3: really take in Eric suggestions
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
remove file paths in the comments and add short description about each
file.
v2: remove file paths instead of just change them.
v3: improve header description as sugggested by Eric
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The common behaviour for trace headers is to have them in the same folder
they are used, instead of creating a special trace/ directory.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Closing the timeline without waiting all fences to signal is not
a critical failure, it is just bad usage from userspace so avoid
calling WARN_ON in this case.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ion_reserve was supposed to be used to reserve memory in board files.
These days, board files are no more and there are other more controlled
mechanisms for reserving memory. Get rid of this function.
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>
ion_carveout_allocate and ion_carveout_free aren't used outside of the
carveout heap. Get rid of the definitions.
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>
The map_dma API interface was designed to generate an sg_table.
Currently, every client just creates the table at allocation time and
then returns the one table. Nothing happens on unmap_dma either.
Just get rid of the API and assign the sg_table directly.
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>