From 1aaff7a48c1f72a90356a06dd4ae2a3fc192ec20 Mon Sep 17 00:00:00 2001 From: Vinod G Date: Fri, 28 Jun 2019 15:01:16 -0700 Subject: [PATCH] gpu: nvgpu: reduce code complexity in common.gr Reduce the code complexity in gr_init_setup_hw function from 13 to 8. Remove all NULL checking for those hals which are initialized to valid a function for all supporting chips. Jira NVGPU-3661 Change-Id: I564dd87d72fcc66c31c9aaa62ef7bec505fd9510 Signed-off-by: Vinod G Reviewed-on: https://git-master.nvidia.com/r/2145470 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/gr/gr.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/nvgpu/common/gr/gr.c b/drivers/gpu/nvgpu/common/gr/gr.c index cb3d9ba8e..aa2094967 100644 --- a/drivers/gpu/nvgpu/common/gr/gr.c +++ b/drivers/gpu/nvgpu/common/gr/gr.c @@ -178,7 +178,6 @@ int nvgpu_gr_suspend(struct gk20a *g) return ret; } - static int gr_init_setup_hw(struct gk20a *g) { struct nvgpu_gr *gr = g->gr; @@ -186,9 +185,7 @@ static int gr_init_setup_hw(struct gk20a *g) nvgpu_log_fn(g, " "); - if (g->ops.gr.init.gpc_mmu != NULL) { - g->ops.gr.init.gpc_mmu(g); - } + g->ops.gr.init.gpc_mmu(g); /* load gr floorsweeping registers */ g->ops.gr.init.pes_vsc_stream(g); @@ -219,9 +216,7 @@ static int gr_init_setup_hw(struct gk20a *g) g->ops.gr.intr.set_hww_esr_report_mask(g); /* enable TPC exceptions per GPC */ - if (g->ops.gr.intr.enable_gpc_exceptions != NULL) { - g->ops.gr.intr.enable_gpc_exceptions(g, gr->config); - } + g->ops.gr.intr.enable_gpc_exceptions(g, gr->config); /* enable ECC for L1/SM */ if (g->ops.gr.init.ecc_scrub_reg != NULL) { @@ -243,13 +238,8 @@ static int gr_init_setup_hw(struct gk20a *g) /* * Disable both surface and LG coalesce. */ - if (g->ops.gr.init.su_coalesce != NULL) { - g->ops.gr.init.su_coalesce(g, 0); - } - - if (g->ops.gr.init.lg_coalesce != NULL) { - g->ops.gr.init.lg_coalesce(g, 0); - } + g->ops.gr.init.su_coalesce(g, 0); + g->ops.gr.init.lg_coalesce(g, 0); if (g->ops.gr.init.preemption_state != NULL) { err = g->ops.gr.init.preemption_state(g);