From 3fa47b877db1edc16018d662e7b9915d92354745 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Tue, 8 Aug 2017 12:08:03 +0530 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1540899 Reviewed-by: svc-mobile-coverity Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Vijayakumar Subbu --- drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 99d72292..f3e87a13 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c @@ -104,7 +104,7 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg, nvgpu_list_add_tail(&ch->ch_entry, &tsg->ch_list); up_write(&tsg->ch_list_lock); - kref_get(&tsg->refcount); + nvgpu_ref_get(&tsg->refcount); gk20a_dbg(gpu_dbg_fn, "BIND tsg:%d channel:%d\n", tsg->tsgid, ch->chid); @@ -122,7 +122,7 @@ int gk20a_tsg_unbind_channel(struct channel_gk20a *ch) nvgpu_list_del(&ch->ch_entry); up_write(&tsg->ch_list_lock); - kref_put(&tsg->refcount, gk20a_tsg_release); + nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); ch->tsgid = NVGPU_INVALID_TSG_ID; @@ -257,7 +257,7 @@ struct tsg_gk20a *gk20a_tsg_open(struct gk20a *g) tsg->g = g; tsg->num_active_channels = 0; - kref_init(&tsg->refcount); + nvgpu_ref_init(&tsg->refcount); tsg->tsg_gr_ctx = NULL; tsg->vm = NULL; @@ -287,11 +287,11 @@ struct tsg_gk20a *gk20a_tsg_open(struct gk20a *g) return tsg; clean_up: - kref_put(&tsg->refcount, gk20a_tsg_release); + nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release); return NULL; } -void gk20a_tsg_release(struct kref *ref) +void gk20a_tsg_release(struct nvgpu_ref *ref) { struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount); struct gk20a *g = tsg->g; -- cgit v1.2.2