summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a.c
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2017-08-08 02:38:03 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-24 04:10:37 -0400
commit3fa47b877db1edc16018d662e7b9915d92354745 (patch)
treec1d9a8734e7d92b5ae647fbc3f582a01207a23f6 /drivers/gpu/nvgpu/gk20a/gk20a.c
parent8662fae334f2419da2e7fd220f7734217ec52433 (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/gk20a/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 550b22c0..639ec4b5 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -511,7 +511,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
511/* 511/*
512 * Free the gk20a struct. 512 * Free the gk20a struct.
513 */ 513 */
514static void gk20a_free_cb(struct kref *refcount) 514static void gk20a_free_cb(struct nvgpu_ref *refcount)
515{ 515{
516 struct gk20a *g = container_of(refcount, 516 struct gk20a *g = container_of(refcount,
517 struct gk20a, refcount); 517 struct gk20a, refcount);
@@ -544,10 +544,11 @@ struct gk20a * __must_check gk20a_get(struct gk20a *g)
544 * the code will never be in such a situation that this race is 544 * the code will never be in such a situation that this race is
545 * possible. 545 * possible.
546 */ 546 */
547 success = kref_get_unless_zero(&g->refcount); 547 success = nvgpu_ref_get_unless_zero(&g->refcount);
548 548
549 gk20a_dbg(gpu_dbg_shutdown, "GET: refs currently %d %s", 549 gk20a_dbg(gpu_dbg_shutdown, "GET: refs currently %d %s",
550 atomic_read(&g->refcount.refcount), success ? "" : "(FAILED)"); 550 nvgpu_atomic_read(&g->refcount.refcount),
551 success ? "" : "(FAILED)");
551 552
552 return success ? g : NULL; 553 return success ? g : NULL;
553} 554}
@@ -571,7 +572,7 @@ void gk20a_put(struct gk20a *g)
571 * ... Freeing GK20A struct! 572 * ... Freeing GK20A struct!
572 */ 573 */
573 gk20a_dbg(gpu_dbg_shutdown, "PUT: refs currently %d", 574 gk20a_dbg(gpu_dbg_shutdown, "PUT: refs currently %d",
574 atomic_read(&g->refcount.refcount)); 575 nvgpu_atomic_read(&g->refcount.refcount));
575 576
576 kref_put(&g->refcount, gk20a_free_cb); 577 nvgpu_ref_put(&g->refcount, gk20a_free_cb);
577} 578}