Remove several warnings reported with W=2

Improved support for W=2 compilation flag by solving some nested-extern
and sign-compare warnings.

The libraries are compiling with warnings (which turn into errors with
the Werror flag).

Outside of libraries, some warnings cannot be fixed.

Change-Id: I06b1923857f2a6a50e93d62d0274915b268cef05
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
diff --git a/drivers/arm/css/scmi/scmi_ap_core_proto.c b/drivers/arm/css/scmi/scmi_ap_core_proto.c
index 2caccc2..5941b87 100644
--- a/drivers/arm/css/scmi/scmi_ap_core_proto.c
+++ b/drivers/arm/css/scmi/scmi_ap_core_proto.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -18,7 +18,8 @@
 int scmi_ap_core_set_reset_addr(void *p, uint64_t reset_addr, uint32_t attr)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 	scmi_channel_t *ch = (scmi_channel_t *)p;
 
 	validate_scmi_channel(ch);
@@ -51,7 +52,8 @@
 int scmi_ap_core_get_reset_addr(void *p, uint64_t *reset_addr, uint32_t *attr)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 	scmi_channel_t *ch = (scmi_channel_t *)p;
 	uint32_t lo_addr, hi_addr;
 
diff --git a/drivers/arm/css/scmi/scmi_common.c b/drivers/arm/css/scmi/scmi_common.c
index e2c353d..5b3724a 100644
--- a/drivers/arm/css/scmi/scmi_common.c
+++ b/drivers/arm/css/scmi/scmi_common.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -90,7 +90,8 @@
 int scmi_proto_version(void *p, uint32_t proto_id, uint32_t *version)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 	scmi_channel_t *ch = (scmi_channel_t *)p;
 
 	validate_scmi_channel(ch);
@@ -122,7 +123,8 @@
 		uint32_t command_id, uint32_t *attr)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 	scmi_channel_t *ch = (scmi_channel_t *)p;
 
 	validate_scmi_channel(ch);
diff --git a/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c b/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c
index 70165de..a342aa8 100644
--- a/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c
+++ b/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -19,7 +19,8 @@
 					uint32_t scmi_pwr_state)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 
 	/*
 	 * Only asynchronous mode of `set power state` command is allowed on
@@ -59,7 +60,8 @@
 					uint32_t *scmi_pwr_state)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 	scmi_channel_t *ch = (scmi_channel_t *)p;
 
 	validate_scmi_channel(ch);
diff --git a/drivers/arm/css/scmi/scmi_sys_pwr_proto.c b/drivers/arm/css/scmi/scmi_sys_pwr_proto.c
index a27c4a5..c8e62d1 100644
--- a/drivers/arm/css/scmi/scmi_sys_pwr_proto.c
+++ b/drivers/arm/css/scmi/scmi_sys_pwr_proto.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -18,7 +18,8 @@
 int scmi_sys_pwr_state_set(void *p, uint32_t flags, uint32_t system_state)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 	scmi_channel_t *ch = (scmi_channel_t *)p;
 
 	validate_scmi_channel(ch);
@@ -50,7 +51,8 @@
 int scmi_sys_pwr_state_get(void *p, uint32_t *system_state)
 {
 	mailbox_mem_t *mbx_mem;
-	int token = 0, ret;
+	unsigned int token = 0;
+	int ret;
 	scmi_channel_t *ch = (scmi_channel_t *)p;
 
 	validate_scmi_channel(ch);