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, 7 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c b/drivers/gpu/nvgpu/gk20a/semaphore_gk20a.c index 053550f6..04f61c58 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-2015, NVIDIA CORPORATION. All rights reserved. | 6 | * Copyright (c) 2014, 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,10 +44,8 @@ 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 | /* Sacrifice one semaphore in the name of returning error codes. */ | 47 | if (gk20a_allocator_init(&p->alloc, unique_name, 0, |
48 | if (gk20a_allocator_init(&p->alloc, unique_name, | 48 | p->size)) |
49 | SEMAPHORE_SIZE, p->size - SEMAPHORE_SIZE, | ||
50 | SEMAPHORE_SIZE)) | ||
51 | goto clean_up; | 49 | goto clean_up; |
52 | 50 | ||
53 | gk20a_dbg_info("cpuva=%p iova=%llx phys=%llx", p->cpu_va, | 51 | gk20a_dbg_info("cpuva=%p iova=%llx phys=%llx", p->cpu_va, |
@@ -165,8 +163,8 @@ struct gk20a_semaphore *gk20a_semaphore_alloc(struct gk20a_semaphore_pool *pool) | |||
165 | if (!s) | 163 | if (!s) |
166 | return NULL; | 164 | return NULL; |
167 | 165 | ||
168 | s->offset = gk20a_balloc(&pool->alloc, SEMAPHORE_SIZE); | 166 | if (pool->alloc.alloc(&pool->alloc, &s->offset, SEMAPHORE_SIZE, |
169 | if (!s->offset) { | 167 | SEMAPHORE_SIZE)) { |
170 | gk20a_err(pool->dev, "failed to allocate semaphore"); | 168 | gk20a_err(pool->dev, "failed to allocate semaphore"); |
171 | kfree(s); | 169 | kfree(s); |
172 | return NULL; | 170 | return NULL; |
@@ -188,7 +186,8 @@ static void gk20a_semaphore_free(struct kref *ref) | |||
188 | struct gk20a_semaphore *s = | 186 | struct gk20a_semaphore *s = |
189 | container_of(ref, struct gk20a_semaphore, ref); | 187 | container_of(ref, struct gk20a_semaphore, ref); |
190 | 188 | ||
191 | gk20a_bfree(&s->pool->alloc, s->offset); | 189 | s->pool->alloc.free(&s->pool->alloc, s->offset, SEMAPHORE_SIZE, |
190 | SEMAPHORE_SIZE); | ||
192 | gk20a_semaphore_pool_put(s->pool); | 191 | gk20a_semaphore_pool_put(s->pool); |
193 | kfree(s); | 192 | kfree(s); |
194 | } | 193 | } |