From b8db4393936a9e9e334b67cf92360e3e7215f070 Mon Sep 17 00:00:00 2001 From: Davorin Mista Date: Wed, 27 May 2015 15:00:38 -0700 Subject: [PATCH] PMUFW: PM: Minor MISRA compliance fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Davorin Mista Reviewed-by: Sören Brinkmann Acked-by: Jyotheeswar Reddy Mutthareddyvari --- lib/sw_apps/zynqmp_pmufw/src/pm_api.c | 4 +-- lib/sw_apps/zynqmp_pmufw/src/pm_core.c | 15 ++++---- lib/sw_apps/zynqmp_pmufw/src/pm_master.c | 38 +++++---------------- lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h | 2 +- 4 files changed, 19 insertions(+), 40 deletions(-) diff --git a/lib/sw_apps/zynqmp_pmufw/src/pm_api.c b/lib/sw_apps/zynqmp_pmufw/src/pm_api.c index 4c698317..044626fe 100644 --- a/lib/sw_apps/zynqmp_pmufw/src/pm_api.c +++ b/lib/sw_apps/zynqmp_pmufw/src/pm_api.c @@ -154,12 +154,12 @@ static PmPayloadStatus PmCheckArgument(const u8 argType, } break; case ARG_WAKE: - if (arg != 1 && arg != 0) { + if (arg != 1U && arg != 0U) { status = PM_PAYLOAD_ERR_WAKE; } break; case ARG_ENABLE: - if (arg != 1 && arg != 0) { + if (arg != 1U && arg != 0U) { status = PM_PAYLOAD_ERR_ENABLE; } break; diff --git a/lib/sw_apps/zynqmp_pmufw/src/pm_core.c b/lib/sw_apps/zynqmp_pmufw/src/pm_core.c index e6ea31d2..b92d6699 100644 --- a/lib/sw_apps/zynqmp_pmufw/src/pm_core.c +++ b/lib/sw_apps/zynqmp_pmufw/src/pm_core.c @@ -152,7 +152,7 @@ static void PmForcePowerdown(const PmMaster *const master, const u32 ack) { u32 status; - u32 oppoint = 0; + u32 oppoint = 0U; PmNode* nodePtr = PmGetNodeById(node); PmDbg("(%s, %s)\n", PmStrNode(node), PmStrAck(ack)); @@ -228,7 +228,7 @@ static void PmRequestWakeup(const PmMaster *const master, const u32 node, const u32 ack) { u32 status; - u32 oppoint = 0; + u32 oppoint = 0U; PmProc* proc = PmGetProcByNodeId(node); PmDbg("(%s, %s)\n", PmStrNode(node), PmStrAck(ack)); @@ -266,7 +266,7 @@ static void PmReleaseNode(const PmMaster *master, } /* Release requirements */ - status = PmRequirementUpdate(masterReq, 0); + status = PmRequirementUpdate(masterReq, 0U); masterReq->info &= ~PM_MASTER_USING_SLAVE_MASK; if (PM_RET_SUCCESS != status) { @@ -300,7 +300,7 @@ static void PmRequestNode(const PmMaster *master, const u32 ack) { u32 status; - u32 oppoint = 0; + u32 oppoint = 0U; PmRequirement* masterReq = PmGetRequirementForSlave(master, node); PmDbg("(%s, %d, %d, %s)\n", PmStrNode(node), capabilities, @@ -352,7 +352,7 @@ static void PmSetRequirement(const PmMaster *master, const u32 ack) { u32 status; - u32 oppoint = 0; + u32 oppoint = 0U; PmRequirement* masterReq = PmGetRequirementForSlave(master, node); PmDbg("(%s, %d, %d, %s)\n", PmStrNode(node), capabilities, @@ -365,14 +365,14 @@ static void PmSetRequirement(const PmMaster *master, } /* Does master have the privilege to request settings for the node? */ - if (!(PM_MASTER_USING_SLAVE_MASK & masterReq->info)) { + if (0U == (PM_MASTER_USING_SLAVE_MASK & masterReq->info)) { status = PM_RET_ERROR_ACCESS; goto done; } /* Master is using slave (previously has requested node) */ switch (master->procs->node.currState) { - case (PM_PROC_STATE_SUSPENDING): + case PM_PROC_STATE_SUSPENDING: /* Schedule setting the requirement */ status = PmRequirementSchedule(masterReq, capabilities); break; @@ -385,6 +385,7 @@ static void PmSetRequirement(const PmMaster *master, status = PM_RET_ERROR_COMMUNIC; break; } + oppoint = masterReq->slave->node.currState; done: PmProcessAckRequest(ack, master, node, status, oppoint); diff --git a/lib/sw_apps/zynqmp_pmufw/src/pm_master.c b/lib/sw_apps/zynqmp_pmufw/src/pm_master.c index f3c236c3..77dd7cb0 100644 --- a/lib/sw_apps/zynqmp_pmufw/src/pm_master.c +++ b/lib/sw_apps/zynqmp_pmufw/src/pm_master.c @@ -211,7 +211,7 @@ PmMaster pmMasterApu_g = { PmMaster pmMasterRpu0_g = { .procs = &pmRpuProcs_g[PM_PROC_RPU_0], - .procsCnt = 1, + .procsCnt = 1U, .ipiMask = IPI_PMU_0_IER_RPU_0_MASK, .ipiTrigMask = IPI_PMU_0_TRIG_RPU_0_MASK, .pmuBuffer = IPI_BUFFER_PMU_BASE + IPI_BUFFER_TARGET_RPU_0_OFFSET, @@ -222,19 +222,19 @@ PmMaster pmMasterRpu0_g = { PmMaster pmMasterRpu1_g = { .procs = &pmRpuProcs_g[PM_PROC_RPU_1], - .procsCnt = 1, + .procsCnt = 1U, .ipiMask = IPI_PMU_0_IER_RPU_1_MASK, .ipiTrigMask = IPI_PMU_0_TRIG_RPU_1_MASK, .pmuBuffer = IPI_BUFFER_PMU_BASE + IPI_BUFFER_TARGET_RPU_1_OFFSET, .buffer = IPI_BUFFER_RPU_1_BASE + IPI_BUFFER_TARGET_PMU_OFFSET, .reqs = NULL, /* lockstep mode is assumed for now */ - .reqsCnt = 0, + .reqsCnt = 0U, }; -static const PmMaster *const pmAllMasters[PM_MASTER_MAX] = { - [PM_MASTER_APU] = &pmMasterApu_g, - [PM_MASTER_RPU_0] = &pmMasterRpu0_g, - [PM_MASTER_RPU_1] = &pmMasterRpu1_g, +static const PmMaster *const pmAllMasters[] = { + &pmMasterApu_g, + &pmMasterRpu0_g, + &pmMasterRpu1_g, }; /** @@ -377,7 +377,7 @@ void PmRequirementCancelScheduled(const PmMaster* const master) * are automatically released. * @master Master whose primary processor was forced to power down */ -void PmRequirementReleaseAll(const PmMaster* const master) +static void PmRequirementReleaseAll(const PmMaster* const master) { u32 status; PmRequirementId i; @@ -595,28 +595,6 @@ done: return proc; } -/** - * PmMasterGetAwakeProcCnt() - count how many processors within master are not - * in sleep state - * processor - * @master Pointer to the master whose awake processors are to be counted - * - * @return Number of awake processors within a master - */ -u32 PmMasterGetAwakeProcCnt(const PmMaster* const master) -{ - u32 i; - u32 activeCnt = 0U; - - for (i = 0U; i < master->procsCnt; i++) { - if (PM_PROC_STATE_ACTIVE == master->procs[i].node.currState) { - activeCnt++; - } - } - - return activeCnt; -} - /** * PmEnableProxyWake() - Enable scheduled wake-up sources in GIC Proxy * @master Pointer to master whose scheduled wake-up sources should be enabled diff --git a/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h b/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h index f0859cf4..9acce4f1 100644 --- a/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h +++ b/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h @@ -1,4 +1,4 @@ #ifndef ZYNQMP_XPFW_VERSION__H_ #define ZYNQMP_XPFW_VERSION__H_ - #define ZYNQMP_XPFW_VERSION "2015.1-swbeta2-15-g9a15e28febbd" + #define ZYNQMP_XPFW_VERSION "2015.1-swbeta2-16-g1a5a1abd8be3" #endif