diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c b/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c index 04f61c58..053550f6 100644 --- a/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * GK20A Semaphores | 4 | * GK20A Semaphores |
5 | * | 5 | * |
6 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | 6 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms and conditions of the GNU General Public License, | 9 | * under the terms and conditions of the GNU General Public License, |
@@ -44,8 +44,10 @@ struct gk20a_semaphore_pool *gk20a_semaphore_pool_alloc(struct device *d, | |||
44 | if (gk20a_get_sgtable(d, &p->sgt, p->cpu_va, p->iova, p->size)) | 44 | if (gk20a_get_sgtable(d, &p->sgt, p->cpu_va, p->iova, p->size)) |
45 | goto clean_up; | 45 | goto clean_up; |
46 | 46 | ||
47 | if (gk20a_allocator_init(&p->alloc, unique_name, 0, | 47 | /* Sacrifice one semaphore in the name of returning error codes. */ |
48 | p->size)) | 48 | if (gk20a_allocator_init(&p->alloc, unique_name, |
49 | SEMAPHORE_SIZE, p->size - SEMAPHORE_SIZE, | ||
50 | SEMAPHORE_SIZE)) | ||
49 | goto clean_up; | 51 | goto clean_up; |
50 | 52 | ||
51 | gk20a_dbg_info("cpuva=%p iova=%llx phys=%llx", p->cpu_va, | 53 | gk20a_dbg_info("cpuva=%p iova=%llx phys=%llx", p->cpu_va, |
@@ -163,8 +165,8 @@ struct gk20a_semaphore *gk20a_semaphore_alloc(struct gk20a_semaphore_pool *pool) | |||
163 | if (!s) | 165 | if (!s) |
164 | return NULL; | 166 | return NULL; |
165 | 167 | ||
166 | if (pool->alloc.alloc(&pool->alloc, &s->offset, SEMAPHORE_SIZE, | 168 | s->offset = gk20a_balloc(&pool->alloc, SEMAPHORE_SIZE); |
167 | SEMAPHORE_SIZE)) { | 169 | if (!s->offset) { |
168 | gk20a_err(pool->dev, "failed to allocate semaphore"); | 170 | gk20a_err(pool->dev, "failed to allocate semaphore"); |
169 | kfree(s); | 171 | kfree(s); |
170 | return NULL; | 172 | return NULL; |
@@ -186,8 +188,7 @@ static void gk20a_semaphore_free(struct kref *ref) | |||
186 | struct gk20a_semaphore *s = | 188 | struct gk20a_semaphore *s = |
187 | container_of(ref, struct gk20a_semaphore, ref); | 189 | container_of(ref, struct gk20a_semaphore, ref); |
188 | 190 | ||
189 | s->pool->alloc.free(&s->pool->alloc, s->offset, SEMAPHORE_SIZE, | 191 | gk20a_bfree(&s->pool->alloc, s->offset); |
190 | SEMAPHORE_SIZE); | ||
191 | gk20a_semaphore_pool_put(s->pool); | 192 | gk20a_semaphore_pool_put(s->pool); |
192 | kfree(s); | 193 | kfree(s); |
193 | } | 194 | } |