summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/tsg_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/tsg_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/tsg_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c10
1 files changed, 5 insertions, 5 deletions
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,
104 nvgpu_list_add_tail(&ch->ch_entry, &tsg->ch_list); 104 nvgpu_list_add_tail(&ch->ch_entry, &tsg->ch_list);
105 up_write(&tsg->ch_list_lock); 105 up_write(&tsg->ch_list_lock);
106 106
107 kref_get(&tsg->refcount); 107 nvgpu_ref_get(&tsg->refcount);
108 108
109 gk20a_dbg(gpu_dbg_fn, "BIND tsg:%d channel:%d\n", 109 gk20a_dbg(gpu_dbg_fn, "BIND tsg:%d channel:%d\n",
110 tsg->tsgid, ch->chid); 110 tsg->tsgid, ch->chid);
@@ -122,7 +122,7 @@ int gk20a_tsg_unbind_channel(struct channel_gk20a *ch)
122 nvgpu_list_del(&ch->ch_entry); 122 nvgpu_list_del(&ch->ch_entry);
123 up_write(&tsg->ch_list_lock); 123 up_write(&tsg->ch_list_lock);
124 124
125 kref_put(&tsg->refcount, gk20a_tsg_release); 125 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release);
126 126
127 ch->tsgid = NVGPU_INVALID_TSG_ID; 127 ch->tsgid = NVGPU_INVALID_TSG_ID;
128 128
@@ -257,7 +257,7 @@ struct tsg_gk20a *gk20a_tsg_open(struct gk20a *g)
257 257
258 tsg->g = g; 258 tsg->g = g;
259 tsg->num_active_channels = 0; 259 tsg->num_active_channels = 0;
260 kref_init(&tsg->refcount); 260 nvgpu_ref_init(&tsg->refcount);
261 261
262 tsg->tsg_gr_ctx = NULL; 262 tsg->tsg_gr_ctx = NULL;
263 tsg->vm = NULL; 263 tsg->vm = NULL;
@@ -287,11 +287,11 @@ struct tsg_gk20a *gk20a_tsg_open(struct gk20a *g)
287 return tsg; 287 return tsg;
288 288
289clean_up: 289clean_up:
290 kref_put(&tsg->refcount, gk20a_tsg_release); 290 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release);
291 return NULL; 291 return NULL;
292} 292}
293 293
294void gk20a_tsg_release(struct kref *ref) 294void gk20a_tsg_release(struct nvgpu_ref *ref)
295{ 295{
296 struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount); 296 struct tsg_gk20a *tsg = container_of(ref, struct tsg_gk20a, refcount);
297 struct gk20a *g = tsg->g; 297 struct gk20a *g = tsg->g;