Merge pull request #152 from jcastillo-arm/jc/tf-issues/073-v2

Remove all checkpatch errors from codebase
diff --git a/Makefile b/Makefile
index 7b5288d..b505d62 100644
--- a/Makefile
+++ b/Makefile
@@ -148,9 +148,7 @@
 .PHONY:			all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip
 .SUFFIXES:
 
-INCLUDES		+=	-Iinclude/bl1			\
-				-Iinclude/bl2			\
-				-Iinclude/bl31			\
+INCLUDES		+=	-Iinclude/bl31			\
 				-Iinclude/bl31/services		\
 				-Iinclude/bl32			\
 				-Iinclude/bl32/payloads		\
@@ -184,10 +182,12 @@
 $(eval $(call add_define,RESET_TO_BL31))
 
 ASFLAGS			+= 	-nostdinc -ffreestanding -Wa,--fatal-warnings	\
+				-Werror -Wmissing-include-dirs			\
 				-mgeneral-regs-only -D__ASSEMBLY__		\
 				${DEFINES} ${INCLUDES}
 CFLAGS			+= 	-nostdinc -pedantic -ffreestanding -Wall	\
-				-Werror -mgeneral-regs-only -std=c99 -c -Os	\
+				-Werror -Wmissing-include-dirs			\
+				-mgeneral-regs-only -std=c99 -c -Os		\
 				${DEFINES} ${INCLUDES}
 CFLAGS			+=	-ffunction-sections -fdata-sections
 
diff --git a/include/lib/bakery_lock.h b/include/lib/bakery_lock.h
index 037fa7d..95634cf 100644
--- a/include/lib/bakery_lock.h
+++ b/include/lib/bakery_lock.h
@@ -44,8 +44,8 @@
 #define NO_OWNER (-1)
 
 void bakery_lock_init(bakery_lock_t *bakery);
-void bakery_lock_get(unsigned long mpidr, bakery_lock_t *bakery);
-void bakery_lock_release(unsigned long mpidr, bakery_lock_t *bakery);
-int bakery_lock_try(unsigned long mpidr, bakery_lock_t *bakery);
+void bakery_lock_get(bakery_lock_t *bakery);
+void bakery_lock_release(bakery_lock_t *bakery);
+int bakery_lock_try(bakery_lock_t *bakery);
 
 #endif /* __BAKERY_LOCK_H__ */
diff --git a/lib/locks/bakery/bakery_lock.c b/lib/locks/bakery/bakery_lock.c
index 4e148b5..877f526 100644
--- a/lib/locks/bakery/bakery_lock.c
+++ b/lib/locks/bakery/bakery_lock.c
@@ -124,12 +124,12 @@
  * of others'. The CPU with the highest priority (lowest numerical value)
  * acquires the lock
  */
-void bakery_lock_get(unsigned long mpidr, bakery_lock_t *bakery)
+void bakery_lock_get(bakery_lock_t *bakery)
 {
 	unsigned int they, me;
 	unsigned int my_ticket, my_prio, their_ticket;
 
-	me = platform_get_core_pos(mpidr);
+	me = platform_get_core_pos(read_mpidr_el1());
 
 	assert_bakery_entry_valid(me, bakery);
 
@@ -176,9 +176,9 @@
 
 
 /* Release the lock and signal contenders */
-void bakery_lock_release(unsigned long mpidr, bakery_lock_t *bakery)
+void bakery_lock_release(bakery_lock_t *bakery)
 {
-	unsigned int me = platform_get_core_pos(mpidr);
+	unsigned int me = platform_get_core_pos(read_mpidr_el1());
 
 	assert_bakery_entry_valid(me, bakery);
 	assert(bakery->owner == me);
diff --git a/plat/fvp/drivers/pwrc/fvp_pwrc.c b/plat/fvp/drivers/pwrc/fvp_pwrc.c
index d1feece..c32c322 100644
--- a/plat/fvp/drivers/pwrc/fvp_pwrc.c
+++ b/plat/fvp/drivers/pwrc/fvp_pwrc.c
@@ -41,59 +41,54 @@
 
 unsigned int fvp_pwrc_get_cpu_wkr(unsigned long mpidr)
 {
-	unsigned int rc = 0;
-	bakery_lock_get(mpidr, &pwrc_lock);
-	mmio_write_32(PWRC_BASE + PSYSR_OFF, (unsigned int) mpidr);
-	rc = PSYSR_WK(mmio_read_32(PWRC_BASE + PSYSR_OFF));
-	bakery_lock_release(mpidr, &pwrc_lock);
-	return rc;
+	return PSYSR_WK(fvp_pwrc_read_psysr(mpidr));
 }
 
 unsigned int fvp_pwrc_read_psysr(unsigned long mpidr)
 {
-	unsigned int rc = 0;
-	bakery_lock_get(mpidr, &pwrc_lock);
+	unsigned int rc;
+	bakery_lock_get(&pwrc_lock);
 	mmio_write_32(PWRC_BASE + PSYSR_OFF, (unsigned int) mpidr);
 	rc = mmio_read_32(PWRC_BASE + PSYSR_OFF);
-	bakery_lock_release(mpidr, &pwrc_lock);
+	bakery_lock_release(&pwrc_lock);
 	return rc;
 }
 
 void fvp_pwrc_write_pponr(unsigned long mpidr)
 {
-	bakery_lock_get(mpidr, &pwrc_lock);
+	bakery_lock_get(&pwrc_lock);
 	mmio_write_32(PWRC_BASE + PPONR_OFF, (unsigned int) mpidr);
-	bakery_lock_release(mpidr, &pwrc_lock);
+	bakery_lock_release(&pwrc_lock);
 }
 
 void fvp_pwrc_write_ppoffr(unsigned long mpidr)
 {
-	bakery_lock_get(mpidr, &pwrc_lock);
+	bakery_lock_get(&pwrc_lock);
 	mmio_write_32(PWRC_BASE + PPOFFR_OFF, (unsigned int) mpidr);
-	bakery_lock_release(mpidr, &pwrc_lock);
+	bakery_lock_release(&pwrc_lock);
 }
 
 void fvp_pwrc_set_wen(unsigned long mpidr)
 {
-	bakery_lock_get(mpidr, &pwrc_lock);
+	bakery_lock_get(&pwrc_lock);
 	mmio_write_32(PWRC_BASE + PWKUPR_OFF,
 		      (unsigned int) (PWKUPR_WEN | mpidr));
-	bakery_lock_release(mpidr, &pwrc_lock);
+	bakery_lock_release(&pwrc_lock);
 }
 
 void fvp_pwrc_clr_wen(unsigned long mpidr)
 {
-	bakery_lock_get(mpidr, &pwrc_lock);
+	bakery_lock_get(&pwrc_lock);
 	mmio_write_32(PWRC_BASE + PWKUPR_OFF,
 		      (unsigned int) mpidr);
-	bakery_lock_release(mpidr, &pwrc_lock);
+	bakery_lock_release(&pwrc_lock);
 }
 
 void fvp_pwrc_write_pcoffr(unsigned long mpidr)
 {
-	bakery_lock_get(mpidr, &pwrc_lock);
+	bakery_lock_get(&pwrc_lock);
 	mmio_write_32(PWRC_BASE + PCOFFR_OFF, (unsigned int) mpidr);
-	bakery_lock_release(mpidr, &pwrc_lock);
+	bakery_lock_release(&pwrc_lock);
 }
 
 /* Nothing else to do here apart from initializing the lock */
diff --git a/plat/fvp/include/plat_macros.S b/plat/fvp/include/plat_macros.S
index bdd402d..d2e7cbc 100644
--- a/plat/fvp/include/plat_macros.S
+++ b/plat/fvp/include/plat_macros.S
@@ -47,7 +47,7 @@
 	bl	fvp_get_cfgvar
 	/* gic base address is now in x0 */
 	ldr	w1, [x0, #GICC_IAR]
-	ldr	w2, [x0, #GICD_CTLR]
+	ldr	w2, [x0, #GICC_CTLR]
 	sub	sp, sp, #GIC_REG_SIZE
 	stp	x1, x2, [sp] /* we store the gic registers as 64 bit */
 	adr	x0, gic_regs
diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c
index 23235d3..ed29fbe 100644
--- a/services/std_svc/psci/psci_common.c
+++ b/services/std_svc/psci/psci_common.c
@@ -166,7 +166,7 @@
 	for (level = start_afflvl; level <= end_afflvl; level++) {
 		if (mpidr_nodes[level] == NULL)
 			continue;
-		bakery_lock_get(mpidr, &mpidr_nodes[level]->lock);
+		bakery_lock_get(&mpidr_nodes[level]->lock);
 	}
 }
 
@@ -185,7 +185,7 @@
 	for (level = end_afflvl; level >= start_afflvl; level--) {
 		if (mpidr_nodes[level] == NULL)
 			continue;
-		bakery_lock_release(mpidr, &mpidr_nodes[level]->lock);
+		bakery_lock_release(&mpidr_nodes[level]->lock);
 	}
 }