[Skiboot] [PATCH 31/36] sparse: fix endian conversions in hw/occ.c

Stewart Smith stewart at linux.vnet.ibm.com
Tue Nov 10 15:18:25 AEDT 2015


Since skiboot is all BE, this doesn't make a difference in code generated.

It does silence the following sparse warnings though:

hw/occ.c:354:38: warning: incorrect type in assignment (different base types)
hw/occ.c:354:38:    expected restricted beint64_t [usertype] type
hw/occ.c:354:38:    got int
hw/occ.c:370:46: warning: incorrect type in assignment (different base types)
hw/occ.c:370:46:    expected restricted beint64_t [addressable] [assigned] [usertype] type
hw/occ.c:370:46:    got int
hw/occ.c:371:46: warning: incorrect type in assignment (different base types)
hw/occ.c:371:46:    expected restricted beint64_t [addressable] [assigned] [usertype] chip
hw/occ.c:371:46:    got unsigned int [unsigned] [usertype] id
hw/occ.c:372:57: warning: incorrect type in assignment (different base types)
hw/occ.c:372:57:    expected restricted beint64_t [addressable] [assigned] [usertype] throttle_status
hw/occ.c:372:57:    got unsigned char [unsigned] [usertype] throttle
hw/occ.c:477:49: warning: incorrect type in initializer (different base types)
hw/occ.c:477:49:    expected restricted beint64_t [usertype] type
hw/occ.c:477:49:    got int

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hw/occ.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/occ.c b/hw/occ.c
index 710d8d400091..9c696db68a96 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -351,7 +351,7 @@ static void occ_throttle_poll(void *data __unused)
 			 * Queue OCC_THROTTLE with throttle status as 0 to
 			 * indicate all OCCs are active after a reset.
 			 */
-			occ_msg.type = OCC_THROTTLE;
+			occ_msg.type = cpu_to_be64(OCC_THROTTLE);
 			occ_msg.chip = 0;
 			occ_msg.throttle_status = 0;
 			rc = _opal_queue_msg(OPAL_MSG_OCC, NULL, NULL, 3,
@@ -367,9 +367,9 @@ static void occ_throttle_poll(void *data __unused)
 			if ((occ_data->valid == 1) &&
 			    (chip->throttle != occ_data->throttle) &&
 			    (occ_data->throttle <= OCC_MAX_THROTTLE_STATUS)) {
-				occ_msg.type = OCC_THROTTLE;
-				occ_msg.chip = chip->id;
-				occ_msg.throttle_status = occ_data->throttle;
+				occ_msg.type = cpu_to_be64(OCC_THROTTLE);
+				occ_msg.chip = cpu_to_be64(chip->id);
+				occ_msg.throttle_status = cpu_to_be64(occ_data->throttle);
 				rc = _opal_queue_msg(OPAL_MSG_OCC, NULL,
 						     occ_msg_consumed,
 						     3, (uint64_t *)&occ_msg);
@@ -474,7 +474,7 @@ static void __occ_do_load(u8 scope, u32 dbob_id __unused, u32 seq_id)
 		prlog(PR_INFO, "OCC: Load: Fallback to preloaded image\n");
 		rc = 0;
 	} else if (!rc) {
-		struct opal_occ_msg occ_msg = { OCC_LOAD, 0, 0 };
+		struct opal_occ_msg occ_msg = { CPU_TO_BE64(OCC_LOAD), 0, 0 };
 
 		rc = _opal_queue_msg(OPAL_MSG_OCC, NULL, NULL, 3,
 				     (uint64_t *)&occ_msg);
-- 
2.1.4



More information about the Skiboot mailing list