summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2011-08-09 14:42:08 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:38:58 -0800
commit69b246de276c58e1de0bd8d0095adb83ca12cbc8 (patch)
tree05b96e198de2f6c0cf2b194ee9ae07912883cca8 /drivers/gpu
parent2b2f237feabf4f162525c77e597e088bdd41c632 (diff)
ion: minor clean up
-- init rb nodes in ion_handle_create -- in ion_handle_destroy, check that a node belongs to a tree before removing it (safety check, does not happen right now) -- mark as static functions used only inside ion.c -- update comments to ion_share() with a relevant blurb from the implementation -- other minor updates/typo fixes to comments Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/ion/ion.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index 9cb5b25bb110..37b23af0550b 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -131,7 +131,7 @@ static void ion_buffer_add(struct ion_device *dev,
}
/* this function should only be called while dev->lock is held */
-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,
unsigned long len,
unsigned long align,
@@ -181,7 +181,7 @@ static int ion_buffer_put(struct ion_buffer *buffer)
return kref_put(&buffer->ref, ion_buffer_destroy);
}
-struct ion_handle *ion_handle_create(struct ion_client *client,
+static struct ion_handle *ion_handle_create(struct ion_client *client,
struct ion_buffer *buffer)
{
struct ion_handle *handle;
@@ -190,6 +190,7 @@ struct ion_handle *ion_handle_create(struct ion_client *client,
if (!handle)
return ERR_PTR(-ENOMEM);
kref_init(&handle->ref);
+ rb_init_node(&handle->node);
handle->client = client;
ion_buffer_get(buffer);
handle->buffer = buffer;
@@ -205,7 +206,8 @@ static void ion_handle_destroy(struct kref *kref)
*/
ion_buffer_put(handle->buffer);
mutex_lock(&handle->client->lock);
- rb_erase(&handle->node, &handle->client->handles);
+ if (!RB_EMPTY_NODE(&handle->node))
+ rb_erase(&handle->node, &handle->client->handles);
mutex_unlock(&handle->client->lock);
kfree(handle);
}
@@ -239,7 +241,7 @@ static struct ion_handle *ion_handle_lookup(struct ion_client *client,
return NULL;
}
-bool ion_handle_validate(struct ion_client *client, struct ion_handle *handle)
+static bool ion_handle_validate(struct ion_client *client, struct ion_handle *handle)
{
struct rb_node *n = client->handles.rb_node;
@@ -351,7 +353,7 @@ void ion_free(struct ion_client *client, struct ion_handle *handle)
static void ion_client_get(struct ion_client *client);
static int ion_client_put(struct ion_client *client);
-bool _ion_map(int *buffer_cnt, int *handle_cnt)
+static bool _ion_map(int *buffer_cnt, int *handle_cnt)
{
bool map;
@@ -367,7 +369,7 @@ bool _ion_map(int *buffer_cnt, int *handle_cnt)
return map;
}
-bool _ion_unmap(int *buffer_cnt, int *handle_cnt)
+static bool _ion_unmap(int *buffer_cnt, int *handle_cnt)
{
BUG_ON(*handle_cnt == 0);
(*handle_cnt)--;
@@ -522,7 +524,7 @@ struct ion_buffer *ion_share(struct ion_client *client,
return ERR_PTR(-EINVAL);
}
- /* don't not take an extra refernce here, the burden is on the caller
+ /* do not take an extra reference here, the burden is on the caller
* to make sure the buffer doesn't go away while it's passing it
* to another client -- ion_free should not be called on this handle
* until the buffer has been imported into the other client
@@ -897,7 +899,7 @@ err1:
/* drop the reference to the handle */
ion_handle_put(handle);
err:
- /* drop the refernce to the client */
+ /* drop the reference to the client */
ion_client_put(client);
return ret;
}