gpu: ion: Add IS_CACHED macro

Add a proper IS_CACHED macro for detecting whether or not
flags indicated a cached mapping.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
Fix-up last commit
gpu: ion: Add cache flushing APIs

Add ioctl to support flushing the caches of ion
buffers from userspace.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
Kbuild: Add ion header file

Make sure the header file for Ion gets exported to userspace.
Also make sure userspace can actually use the header.

Change-Id: I44f436005a6a503811c85d4fb0f89264ba160571
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Fix bug in ion_buffer_add

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Remove incorrect error message

The function name is wrong here, and this function may
sometimes be called to see if a value passed from userspace
is an ion handle.  Since it's not really an error when it
fails, remove the log message.

Change-Id: I7bee0e7ffb72b4c4768774a3586f97e306700c21
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Fix bug in ion_client_create

If a process already had a client, ion_client_create
would loop forever.

Change-Id: I723207b5872dfc11be04ca27d38a3cf39c4a1426
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Fix bug in ion client destroy

ion_client_destroy kernel api should only delete the client
if it's refcount has gone to zero.

Change-Id: Iaa662bd82d67279a9807e01f9a24aebe3d21c17d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Remove redunant code from ion_open

ion_client_create now does a lookup, so this need not
also be done from ion_open

Change-Id: Icb101bbf514bf2e40b4b5d9b320130bf185349aa
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Fix possible memory leak

Change-Id: I66f5ad2c95513dfab9f4fc5ae2fcb1316f486d34
Signed-off-by: Choi, Jong-Hwan <jhbird.choi@samsung.com>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Fix deferencing ERR_PTR

Change-Id: I986c380d75591571890f1a2cba1405e66789b25c
Signed-off-by: Choi, Jong-Hwan <jhbird.choi@samsung.com>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
gpu: ion: Validate handles passed via the kernel api
gpu: ion: check return value from gen_pool_add

Check the return value from gen_pool_add and handle
any error gracefully.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>