diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2017-08-08 02:38:03 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-24 04:10:37 -0400 |
commit | 3fa47b877db1edc16018d662e7b9915d92354745 (patch) | |
tree | c1d9a8734e7d92b5ae647fbc3f582a01207a23f6 /drivers/gpu/nvgpu/common/semaphore.c | |
parent | 8662fae334f2419da2e7fd220f7734217ec52433 (diff) |
gpu: nvgpu: Replace kref for refcounting in nvgpu
- added wrapper struct nvgpu_ref over nvgpu_atomic_t
- added nvgpu_ref_* APIs to access the above struct
JIRA NVGPU-140
Change-Id: Id47f897995dd4721751f7610b6d4d4fbfe4d6b9a
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1540899
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/semaphore.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/semaphore.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/common/semaphore.c b/drivers/gpu/nvgpu/common/semaphore.c index ac45aaaa..5496f5ec 100644 --- a/drivers/gpu/nvgpu/common/semaphore.c +++ b/drivers/gpu/nvgpu/common/semaphore.c | |||
@@ -156,7 +156,7 @@ struct nvgpu_semaphore_pool *nvgpu_semaphore_pool_alloc( | |||
156 | p->sema_sea = sea; | 156 | p->sema_sea = sea; |
157 | nvgpu_init_list_node(&p->hw_semas); | 157 | nvgpu_init_list_node(&p->hw_semas); |
158 | nvgpu_init_list_node(&p->pool_list_entry); | 158 | nvgpu_init_list_node(&p->pool_list_entry); |
159 | kref_init(&p->ref); | 159 | nvgpu_ref_init(&p->ref); |
160 | 160 | ||
161 | sea->page_count++; | 161 | sea->page_count++; |
162 | nvgpu_list_add(&p->pool_list_entry, &sea->pool_list); | 162 | nvgpu_list_add(&p->pool_list_entry, &sea->pool_list); |
@@ -285,7 +285,7 @@ void nvgpu_semaphore_pool_unmap(struct nvgpu_semaphore_pool *p, | |||
285 | * Completely free a semaphore_pool. You should make sure this pool is not | 285 | * Completely free a semaphore_pool. You should make sure this pool is not |
286 | * mapped otherwise there's going to be a memory leak. | 286 | * mapped otherwise there's going to be a memory leak. |
287 | */ | 287 | */ |
288 | static void nvgpu_semaphore_pool_free(struct kref *ref) | 288 | static void nvgpu_semaphore_pool_free(struct nvgpu_ref *ref) |
289 | { | 289 | { |
290 | struct nvgpu_semaphore_pool *p = | 290 | struct nvgpu_semaphore_pool *p = |
291 | container_of(ref, struct nvgpu_semaphore_pool, ref); | 291 | container_of(ref, struct nvgpu_semaphore_pool, ref); |
@@ -314,12 +314,12 @@ static void nvgpu_semaphore_pool_free(struct kref *ref) | |||
314 | 314 | ||
315 | void nvgpu_semaphore_pool_get(struct nvgpu_semaphore_pool *p) | 315 | void nvgpu_semaphore_pool_get(struct nvgpu_semaphore_pool *p) |
316 | { | 316 | { |
317 | kref_get(&p->ref); | 317 | nvgpu_ref_get(&p->ref); |
318 | } | 318 | } |
319 | 319 | ||
320 | void nvgpu_semaphore_pool_put(struct nvgpu_semaphore_pool *p) | 320 | void nvgpu_semaphore_pool_put(struct nvgpu_semaphore_pool *p) |
321 | { | 321 | { |
322 | kref_put(&p->ref, nvgpu_semaphore_pool_free); | 322 | nvgpu_ref_put(&p->ref, nvgpu_semaphore_pool_free); |
323 | } | 323 | } |
324 | 324 | ||
325 | /* | 325 | /* |
@@ -423,7 +423,7 @@ struct nvgpu_semaphore *nvgpu_semaphore_alloc(struct channel_gk20a *ch) | |||
423 | if (!s) | 423 | if (!s) |
424 | return NULL; | 424 | return NULL; |
425 | 425 | ||
426 | kref_init(&s->ref); | 426 | nvgpu_ref_init(&s->ref); |
427 | s->hw_sema = ch->hw_sema; | 427 | s->hw_sema = ch->hw_sema; |
428 | nvgpu_atomic_set(&s->value, 0); | 428 | nvgpu_atomic_set(&s->value, 0); |
429 | 429 | ||
@@ -438,7 +438,7 @@ struct nvgpu_semaphore *nvgpu_semaphore_alloc(struct channel_gk20a *ch) | |||
438 | return s; | 438 | return s; |
439 | } | 439 | } |
440 | 440 | ||
441 | static void nvgpu_semaphore_free(struct kref *ref) | 441 | static void nvgpu_semaphore_free(struct nvgpu_ref *ref) |
442 | { | 442 | { |
443 | struct nvgpu_semaphore *s = | 443 | struct nvgpu_semaphore *s = |
444 | container_of(ref, struct nvgpu_semaphore, ref); | 444 | container_of(ref, struct nvgpu_semaphore, ref); |
@@ -450,10 +450,10 @@ static void nvgpu_semaphore_free(struct kref *ref) | |||
450 | 450 | ||
451 | void nvgpu_semaphore_put(struct nvgpu_semaphore *s) | 451 | void nvgpu_semaphore_put(struct nvgpu_semaphore *s) |
452 | { | 452 | { |
453 | kref_put(&s->ref, nvgpu_semaphore_free); | 453 | nvgpu_ref_put(&s->ref, nvgpu_semaphore_free); |
454 | } | 454 | } |
455 | 455 | ||
456 | void nvgpu_semaphore_get(struct nvgpu_semaphore *s) | 456 | void nvgpu_semaphore_get(struct nvgpu_semaphore *s) |
457 | { | 457 | { |
458 | kref_get(&s->ref); | 458 | nvgpu_ref_get(&s->ref); |
459 | } | 459 | } |