From 31432919cac8fc4ddad3b9245cf61ffd47d5db82 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Thu, 29 Mar 2018 16:52:16 -0700 Subject: gpu: nvgpu: vgpu: fix build errors on qnx - Declare global functions before reaching the implementation. - avoid using current (current process). - assign ch->pid/tgid before using them. Jira VFND-4870 Change-Id: I688a1b89ef4d5dcf046929eab11d7e523caba0a5 Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1687142 Reviewed-by: svc-mobile-coverity Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: Nirav Patel Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index a68968fe..f50c37a7 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -645,6 +645,9 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, /* Channel privilege level */ ch->is_privileged_channel = is_privileged_channel; + ch->pid = nvgpu_current_tid(g); + ch->tgid = nvgpu_current_pid(g); /* process granularity for FECS traces */ + if (g->ops.fifo.alloc_inst(g, ch)) { ch->g = NULL; free_channel(f, ch); @@ -656,9 +659,6 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, /* now the channel is in a limbo out of the free list but not marked as * alive and used (i.e. get-able) yet */ - ch->pid = nvgpu_current_tid(g); - ch->tgid = nvgpu_current_pid(g); /* process granularity for FECS traces */ - /* By default, channel is regular (non-TSG) channel */ ch->tsgid = NVGPU_INVALID_TSG_ID; -- cgit v1.2.2