Tegra: pmc: fix defects flagged during MISRA analysis
Main fixes:
* Fixed if/while statement conditional to be essentially boolean [Rule 14.4]
* Added curly braces ({}) around if/for/while statements in order to
make them compound [Rule 15.6]
* Added explicit casts (e.g. 0U) to integers in order for them to be
compatible with whatever operation they're used in [Rule 10.1]
Change-Id: Ic72b248aeede6cf18bf85051188ea7b8fd8ae829
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
diff --git a/plat/nvidia/tegra/include/drivers/pmc.h b/plat/nvidia/tegra/include/drivers/pmc.h
index 7bf3f81..ea9392b 100644
--- a/plat/nvidia/tegra/include/drivers/pmc.h
+++ b/plat/nvidia/tegra/include/drivers/pmc.h
@@ -9,20 +9,21 @@
#include <mmio.h>
#include <tegra_def.h>
+#include <utils_def.h>
-#define PMC_CONFIG 0x0U
-#define PMC_PWRGATE_STATUS 0x38U
-#define PMC_PWRGATE_TOGGLE 0x30U
-#define PMC_TOGGLE_START 0x100U
-#define PMC_SCRATCH39 0x138U
-#define PMC_SECURE_DISABLE2 0x2c4U
-#define PMC_SECURE_DISABLE2_WRITE22_ON (1U << 28)
-#define PMC_SECURE_SCRATCH22 0x338U
-#define PMC_SECURE_DISABLE3 0x2d8U
-#define PMC_SECURE_DISABLE3_WRITE34_ON (1U << 20)
-#define PMC_SECURE_DISABLE3_WRITE35_ON (1U << 22)
-#define PMC_SECURE_SCRATCH34 0x368U
-#define PMC_SECURE_SCRATCH35 0x36cU
+#define PMC_CONFIG U(0x0)
+#define PMC_PWRGATE_STATUS U(0x38)
+#define PMC_PWRGATE_TOGGLE U(0x30)
+#define PMC_TOGGLE_START U(0x100)
+#define PMC_SCRATCH39 U(0x138)
+#define PMC_SECURE_DISABLE2 U(0x2c4)
+#define PMC_SECURE_DISABLE2_WRITE22_ON (U(1) << 28)
+#define PMC_SECURE_SCRATCH22 U(0x338)
+#define PMC_SECURE_DISABLE3 U(0x2d8)
+#define PMC_SECURE_DISABLE3_WRITE34_ON (U(1) << 20)
+#define PMC_SECURE_DISABLE3_WRITE35_ON (U(1) << 22)
+#define PMC_SECURE_SCRATCH34 U(0x368)
+#define PMC_SECURE_SCRATCH35 U(0x36c)
static inline uint32_t tegra_pmc_read_32(uint32_t off)
{
@@ -36,7 +37,7 @@
void tegra_pmc_cpu_setup(uint64_t reset_addr);
void tegra_pmc_lock_cpu_vectors(void);
-void tegra_pmc_cpu_on(int cpu);
+void tegra_pmc_cpu_on(int32_t cpu);
__dead2 void tegra_pmc_system_reset(void);
#endif /* __PMC_H__ */