gpu: nvgpu: fix MISRA rule 5.7 and 4.7 violations

nvgpu_pmu_cmd_post return value was not used in some call sites in
pmu perfmon. data structures were forward declared where not reqd
are removed and header included where needed.

JIRA NVGPU-1971

Change-Id: I8714ed138d1c0b897540b624ae73c70c0a0318e0
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093491
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Adeel Raza <araza@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2019-04-09 19:30:39 +05:30
committed by mobile promotions
parent bcbc87dc2e
commit 1eb8abe0de
17 changed files with 23 additions and 25 deletions

View File

@@ -27,7 +27,6 @@
#include "acr_blob_construct_v0.h" #include "acr_blob_construct_v0.h"
#include "acr_blob_construct_v1.h" #include "acr_blob_construct_v1.h"
struct nvgpu_firmware;
struct gk20a; struct gk20a;
struct nvgpu_acr; struct nvgpu_acr;
struct wpr_carveout_info; struct wpr_carveout_info;

View File

@@ -23,7 +23,7 @@
#ifndef NVGPU_CLK_FREQ_CONTROLLER_H #ifndef NVGPU_CLK_FREQ_CONTROLLER_H
#define NVGPU_CLK_FREQ_CONTROLLER_H #define NVGPU_CLK_FREQ_CONTROLLER_H
struct boardobj; #include <nvgpu/boardobj.h>
#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_ALL 0xFFU #define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_ALL 0xFFU
#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_SYS 0x00U #define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_SYS 0x00U

View File

@@ -197,8 +197,12 @@ int nvgpu_pmu_init_perfmon(struct nvgpu_pmu *pmu)
} }
nvgpu_pmu_dbg(g, "cmd post PMU_PERFMON_CMD_ID_INIT"); nvgpu_pmu_dbg(g, "cmd post PMU_PERFMON_CMD_ID_INIT");
nvgpu_pmu_cmd_post(g, &cmd, &payload, PMU_COMMAND_QUEUE_LPQ, status = nvgpu_pmu_cmd_post(g, &cmd, &payload, PMU_COMMAND_QUEUE_LPQ,
NULL, NULL); NULL, NULL);
if (status != 0) {
nvgpu_err(g, "failed cmd post PMU_PERFMON_CMD_ID_INIT");
return status;
}
return 0; return 0;
} }
@@ -256,8 +260,12 @@ int nvgpu_pmu_perfmon_start_sampling(struct nvgpu_pmu *pmu)
} }
nvgpu_pmu_dbg(g, "cmd post PMU_PERFMON_CMD_ID_START"); nvgpu_pmu_dbg(g, "cmd post PMU_PERFMON_CMD_ID_START");
nvgpu_pmu_cmd_post(g, &cmd, &payload, PMU_COMMAND_QUEUE_LPQ, status = nvgpu_pmu_cmd_post(g, &cmd, &payload, PMU_COMMAND_QUEUE_LPQ,
NULL, NULL); NULL, NULL);
if (status != 0) {
nvgpu_err(g, "failed cmd post PMU_PERFMON_CMD_ID_START");
return status;
}
return 0; return 0;
} }
@@ -267,6 +275,7 @@ int nvgpu_pmu_perfmon_stop_sampling(struct nvgpu_pmu *pmu)
struct gk20a *g = pmu->g; struct gk20a *g = pmu->g;
struct pmu_cmd cmd; struct pmu_cmd cmd;
u64 tmp_size; u64 tmp_size;
int status;
if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) { if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) {
return 0; return 0;
@@ -285,8 +294,12 @@ int nvgpu_pmu_perfmon_stop_sampling(struct nvgpu_pmu *pmu)
cmd.cmd.perfmon.stop.cmd_type = PMU_PERFMON_CMD_ID_STOP; cmd.cmd.perfmon.stop.cmd_type = PMU_PERFMON_CMD_ID_STOP;
nvgpu_pmu_dbg(g, "cmd post PMU_PERFMON_CMD_ID_STOP"); nvgpu_pmu_dbg(g, "cmd post PMU_PERFMON_CMD_ID_STOP");
nvgpu_pmu_cmd_post(g, &cmd, NULL, PMU_COMMAND_QUEUE_LPQ, status = nvgpu_pmu_cmd_post(g, &cmd, NULL, PMU_COMMAND_QUEUE_LPQ,
NULL, NULL); NULL, NULL);
if (status != 0) {
nvgpu_err(g, "failed cmd post PMU_PERFMON_CMD_ID_STOP");
return status;
}
return 0; return 0;
} }

View File

@@ -30,8 +30,6 @@
#include <nvgpu/pmu/pmuif/nvgpu_cmdif.h> #include <nvgpu/pmu/pmuif/nvgpu_cmdif.h>
#include <nvgpu/pmu.h> #include <nvgpu/pmu.h>
struct nvgpu_firmware;
#define ZBC_MASK(i) U16(~(~(0U) << ((i)+1U)) & 0xfffeU) #define ZBC_MASK(i) U16(~(~(0U) << ((i)+1U)) & 0xfffeU)
bool gk20a_pmu_is_interrupted(struct nvgpu_pmu *pmu); bool gk20a_pmu_is_interrupted(struct nvgpu_pmu *pmu);

View File

@@ -32,7 +32,6 @@
#include <nvgpu/flcnif_cmn.h> #include <nvgpu/flcnif_cmn.h>
struct nvgpu_mem; struct nvgpu_mem;
struct nv_pmu_super_surface_member_descriptor;
/* PMU super surface */ /* PMU super surface */
/* 1MB Bytes for SUPER_SURFACE_SIZE */ /* 1MB Bytes for SUPER_SURFACE_SIZE */

View File

@@ -27,7 +27,6 @@ struct gk20a;
struct nvgpu_falcon; struct nvgpu_falcon;
struct nvgpu_firmware; struct nvgpu_firmware;
struct nvgpu_acr; struct nvgpu_acr;
struct nv_pmu_rpc_header;
int nvgpu_acr_init(struct gk20a *g, struct nvgpu_acr **acr); int nvgpu_acr_init(struct gk20a *g, struct nvgpu_acr **acr);
int nvgpu_acr_alloc_blob_prerequisite(struct gk20a *g, struct nvgpu_acr *acr, int nvgpu_acr_alloc_blob_prerequisite(struct gk20a *g, struct nvgpu_acr *acr,

View File

@@ -26,7 +26,6 @@
struct boardobjgrp; struct boardobjgrp;
struct gk20a; struct gk20a;
struct nvgpu_list_node; struct nvgpu_list_node;
struct pmu_surface;
/* ------------------------ Includes ----------------------------------------*/ /* ------------------------ Includes ----------------------------------------*/

View File

@@ -26,9 +26,6 @@
#include <nvgpu/types.h> #include <nvgpu/types.h>
#include <nvgpu/pmu/pmuif/ctrlboardobj.h> #include <nvgpu/pmu/pmuif/ctrlboardobj.h>
struct ctrl_boardobjgrp_mask;
/* /*
* Board Object Group Mask super-structure. * Board Object Group Mask super-structure.
* Used to unify access to all BOARDOBJGRPMASK_E** child classes * Used to unify access to all BOARDOBJGRPMASK_E** child classes

View File

@@ -46,7 +46,6 @@
#define DLPL_REG_WR32(g, id, off, v) gk20a_writel(g, (g)->nvlink.links[(id)].dlpl_base + (off), (v)) #define DLPL_REG_WR32(g, id, off, v) gk20a_writel(g, (g)->nvlink.links[(id)].dlpl_base + (off), (v))
struct gk20a; struct gk20a;
struct nvgpu_firmware;
struct nvgpu_nvlink_ioctrl_list { struct nvgpu_nvlink_ioctrl_list {
bool valid; bool valid;

View File

@@ -30,7 +30,6 @@
struct gk20a; struct gk20a;
struct nvgpu_clk_domain; struct nvgpu_clk_domain;
struct nvgpu_clk_slave_freq; struct nvgpu_clk_slave_freq;
struct ctrl_perf_change_seq_change_input;
struct nvgpu_clk_pmupstate; struct nvgpu_clk_pmupstate;
typedef int nvgpu_clkproglink(struct gk20a *g, struct nvgpu_clk_pmupstate *pclk, typedef int nvgpu_clkproglink(struct gk20a *g, struct nvgpu_clk_pmupstate *pclk,

View File

@@ -26,13 +26,12 @@
#define NVGPU_PMU_CLK_FLL_H #define NVGPU_PMU_CLK_FLL_H
#include <nvgpu/types.h> #include <nvgpu/types.h>
#include <nvgpu/boardobjgrpmask.h>
#include <nvgpu/pmu/pmuif/clk.h>
struct gk20a; struct gk20a;
struct fll_device; struct fll_device;
struct boardobjgrp_e32; struct boardobjgrp_e32;
struct boardobjgrpmask_e32;
struct nv_pmu_clk_lut_device_desc;
struct nv_pmu_clk_regime_desc;
struct nvgpu_avfsfllobjs { struct nvgpu_avfsfllobjs {
struct boardobjgrp_e32 super; struct boardobjgrp_e32 super;

View File

@@ -26,10 +26,10 @@
#define NVGPU_PMU_CLK_FREQ_CONTROLLER_H #define NVGPU_PMU_CLK_FREQ_CONTROLLER_H
#include <nvgpu/types.h> #include <nvgpu/types.h>
#include <nvgpu/boardobjgrpmask.h>
struct gk20a; struct gk20a;
struct boardobjgrp_e32; struct boardobjgrp_e32;
struct boardobjgrpmask_e32;
struct nvgpu_clk_freq_controllers { struct nvgpu_clk_freq_controllers {
struct boardobjgrp_e32 super; struct boardobjgrp_e32 super;

View File

@@ -26,9 +26,9 @@
#define NVGPU_PMU_CLK_FREQ_DOMAIN_H #define NVGPU_PMU_CLK_FREQ_DOMAIN_H
#include <nvgpu/types.h> #include <nvgpu/types.h>
#include <nvgpu/boardobj.h>
struct gk20a; struct gk20a;
struct boardobj;
struct boardobjgrp_e32; struct boardobjgrp_e32;
struct nvgpu_clk_freq_domain_grp { struct nvgpu_clk_freq_domain_grp {

View File

@@ -26,11 +26,10 @@
#define NVGPU_PMU_CLK_VF_POINT_H #define NVGPU_PMU_CLK_VF_POINT_H
#include <nvgpu/types.h> #include <nvgpu/types.h>
#include <nvgpu/pmu/pmuif/ctrlclk.h>
struct gk20a; struct gk20a;
struct boardobjgrp_e255; struct boardobjgrp_e255;
struct ctrl_clk_vf_pair;
struct ctrl_clk_freq_delta;
struct nvgpu_clk_vf_points { struct nvgpu_clk_vf_points {
struct boardobjgrp_e255 super; struct boardobjgrp_e255 super;

View File

@@ -26,11 +26,11 @@
#define NVGPU_PMU_CLK_VIN_H #define NVGPU_PMU_CLK_VIN_H
#include <nvgpu/types.h> #include <nvgpu/types.h>
#include <nvgpu/boardobj.h>
struct gk20a; struct gk20a;
struct nvgpu_vin_device; struct nvgpu_vin_device;
struct nvgpu_clk_pmupstate; struct nvgpu_clk_pmupstate;
struct boardobj;
struct boardobjgrp_e32; struct boardobjgrp_e32;
typedef u32 vin_device_state_load(struct gk20a *g, typedef u32 vin_device_state_load(struct gk20a *g,

View File

@@ -40,7 +40,6 @@ struct nvgpu_pmu;
struct pmu_msg; struct pmu_msg;
struct pmu_sequence; struct pmu_sequence;
struct falcon_payload_alloc; struct falcon_payload_alloc;
struct nvgpu_engine_fb_queue;
typedef void (*pmu_callback)(struct gk20a *g, struct pmu_msg *msg, void *param, typedef void (*pmu_callback)(struct gk20a *g, struct pmu_msg *msg, void *param,
u32 status); u32 status);

View File

@@ -45,7 +45,6 @@ struct gk20a;
struct nvgpu_pmu; struct nvgpu_pmu;
struct nvgpu_allocator; struct nvgpu_allocator;
struct pmu_sequences; struct pmu_sequences;
struct pmu_queues;
struct nvgpu_mem; struct nvgpu_mem;
struct nvgpu_falcon; struct nvgpu_falcon;