From 50438811c85e29c8cd9ade8615fb3117df43f81d Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 9 Oct 2018 17:21:30 +0300 Subject: [PATCH] gpu: nvgpu: inline alloc_tsg_gr_ctx gr_gk20a_alloc_tsg_gr_ctx() is just g->ops.gr.alloc_gr_ctx() and one assignment. Move that to the call site. Jira NVGPU-1149 Change-Id: I2c7f0168c55468d2125c19a7041bc5d962ba9e44 Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1925426 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 10d5d002c..2ce441c77 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -2768,27 +2768,6 @@ int gr_gk20a_alloc_gr_ctx(struct gk20a *g, return err; } -static int gr_gk20a_alloc_tsg_gr_ctx(struct gk20a *g, - struct tsg_gk20a *tsg, u32 class, u32 padding) -{ - struct nvgpu_gr_ctx *gr_ctx = tsg->gr_ctx; - int err; - - if (tsg->vm == NULL) { - nvgpu_err(tsg->g, "No address space bound"); - return -ENOMEM; - } - - err = g->ops.gr.alloc_gr_ctx(g, gr_ctx, tsg->vm, class, padding); - if (err != 0) { - return err; - } - - gr_ctx->tsgid = tsg->tsgid; - - return 0; -} - void gr_gk20a_free_gr_ctx(struct gk20a *g, struct vm_gk20a *vm, struct nvgpu_gr_ctx *gr_ctx) { @@ -2931,9 +2910,8 @@ int gk20a_alloc_obj_ctx(struct channel_gk20a *c, u32 class_num, u32 flags) if (!nvgpu_mem_is_valid(&gr_ctx->mem)) { tsg->vm = c->vm; nvgpu_vm_get(tsg->vm); - err = gr_gk20a_alloc_tsg_gr_ctx(g, tsg, - class_num, - flags); + err = g->ops.gr.alloc_gr_ctx(g, gr_ctx, tsg->vm, class_num, + flags); if (err != 0) { nvgpu_err(g, "fail to allocate TSG gr ctx buffer"); @@ -2942,6 +2920,8 @@ int gk20a_alloc_obj_ctx(struct channel_gk20a *c, u32 class_num, u32 flags) goto out; } + gr_ctx->tsgid = tsg->tsgid; + /* allocate patch buffer */ if (!nvgpu_mem_is_valid(&gr_ctx->patch_ctx.mem)) { gr_ctx->patch_ctx.data_count = 0;