From e00804594b83781bc9f7c17ac68cd9c5dd30953c Mon Sep 17 00:00:00 2001 From: Seema Khowala Date: Thu, 27 Dec 2018 19:23:06 -0800 Subject: gpu: nvgpu: remove gk20a_is_channel_marked_as_tsg Use tsg_gk20a_from_ch to get tsg pointer for tsgid of a channel. For invalid tsgid, tsg pointer will be NULL Bug 2092051 Bug 2429295 Bug 2484211 Change-Id: I82cd6a2dc5fab4acb147202af667ca97a2842a73 Signed-off-by: Seema Khowala Reviewed-on: https://git-master.nvidia.com/r/2006722 Signed-off-by: Debarshi Dutta (cherry picked from commit 13f37f9c70b9ae2e0d179830cded93a0a6f86494 in dev-kernel) Reviewed-on: https://git-master.nvidia.com/r/2025507 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/common/fifo/channel.c') diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index 4b76dcdd..d30b8ded 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -326,7 +326,12 @@ static void gk20a_free_channel(struct channel_gk20a *ch, bool force) */ if (!nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) { /* abort channel and remove from runlist */ - if (gk20a_is_channel_marked_as_tsg(ch)) { + if (tsg_gk20a_from_ch(ch) != NULL) { + /* Between tsg is not null and unbind_channel call, + * ioctl cannot be called anymore because user doesn't + * have an open channel fd anymore to use for the unbind + * ioctl. + */ err = gk20a_tsg_unbind_channel(ch); if (err) { nvgpu_err(g, @@ -2264,7 +2269,7 @@ int gk20a_init_channel_support(struct gk20a *g, u32 chid) if (err) { goto fail_6; } - + nvgpu_init_list_node(&c->ch_entry); nvgpu_list_add(&c->free_chs, &g->fifo.free_chs); return 0; @@ -2403,10 +2408,9 @@ void gk20a_channel_semaphore_wakeup(struct gk20a *g, bool post_events) nvgpu_cond_broadcast_interruptible( &c->semaphore_wq); if (post_events) { - if (gk20a_is_channel_marked_as_tsg(c)) { - struct tsg_gk20a *tsg = - &g->fifo.tsg[c->tsgid]; - + struct tsg_gk20a *tsg = + tsg_gk20a_from_ch(c); + if (tsg != NULL) { g->ops.fifo.post_event_id(tsg, NVGPU_EVENT_ID_BLOCKING_SYNC); } -- cgit v1.2.2