[Skiboot] [PATCH 11/36] sparse: fix endian conversions in hdata/iohub.c

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


Since skiboot is all BE and hdat is BE, this changes nothing except for silencing
the sparse warnings

hdata/iohub.c:35:9: warning: incorrect type in initializer (different base types)
hdata/iohub.c:35:9:    expected unsigned int
hdata/iohub.c:35:9:    got restricted beint32_t const [usertype] buid_ext
hdata/iohub.c:36:9: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:36:9:    expected unsigned int [unsigned] [usertype] proc_chip_id
hdata/iohub.c:36:9:    got restricted beint32_t const [usertype] proc_chip_id
hdata/iohub.c:36:9: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:36:9:    expected unsigned int [unsigned] [usertype] proc_chip_id
hdata/iohub.c:36:9:    got restricted beint32_t const [usertype] proc_chip_id
hdata/iohub.c:38:9: warning: incorrect type in initializer (different base types)
hdata/iohub.c:38:9:    expected unsigned int
hdata/iohub.c:38:9:    got restricted beint32_t const [usertype] gx_index
hdata/iohub.c:39:9: warning: incorrect type in initializer (different base types)
hdata/iohub.c:39:9:    expected unsigned int
hdata/iohub.c:39:9:    got restricted beint32_t const [usertype] ec_level
hdata/iohub.c:114:63: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:114:63:    expected unsigned short [unsigned] [usertype] slca_index
hdata/iohub.c:114:63:    got restricted beint16_t const [usertype] slca_index
hdata/iohub.c:634:17: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:634:17:    expected restricted beint32_t [usertype] be_val
hdata/iohub.c:634:17:    got restricted beint16_t const [usertype] hub_num
hdata/iohub.c:708:22: warning: incorrect type in assignment (different base types)
hdata/iohub.c:708:22:    expected unsigned int [unsigned] type
hdata/iohub.c:708:22:    got restricted beint32_t const [usertype] card_type

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hdata/iohub.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hdata/iohub.c b/hdata/iohub.c
index d189cb774693..1c69f630fd38 100644
--- a/hdata/iohub.c
+++ b/hdata/iohub.c
@@ -32,11 +32,11 @@ static void io_add_common(struct dt_node *hn, const struct cechub_io_hub *hub)
 {
 	dt_add_property_cells(hn, "#address-cells", 2);
 	dt_add_property_cells(hn, "#size-cells", 2);
-	dt_add_property_cells(hn, "ibm,buid-ext", hub->buid_ext);
+	dt_add_property_cells(hn, "ibm,buid-ext", be32_to_cpu(hub->buid_ext));
 	dt_add_property_cells(hn, "ibm,chip-id",
-			      pcid_to_chip_id(hub->proc_chip_id));
-	dt_add_property_cells(hn, "ibm,gx-index", hub->gx_index);
-	dt_add_property_cells(hn, "revision", hub->ec_level);
+			      pcid_to_chip_id(be32_to_cpu(hub->proc_chip_id)));
+	dt_add_property_cells(hn, "ibm,gx-index", be32_to_cpu(hub->gx_index));
+	dt_add_property_cells(hn, "revision", be32_to_cpu(hub->ec_level));
 
 	/* Instead of exposing the GX BARs as separate ranges as we *should*
 	 * do in an ideal world, we just create a pass-through ranges and
@@ -111,7 +111,7 @@ static void io_get_loc_code(const void *sp_iohubs, struct dt_node *hn, const cha
 		memset(loc_code, 0, sizeof(loc_code));
 
 		/* Find LOC Code from SLCA Index */
-		slca_loc_code = slca_get_loc_code_index(fru_id->slca_index);
+		slca_loc_code = slca_get_loc_code_index(be16_to_cpu(fru_id->slca_index));
 		if (slca_loc_code) {
 			strncpy(loc_code, slca_loc_code, LOC_CODE_SIZE);
 			if (!dt_has_node_property(hn, prop_name, NULL)) {
@@ -634,7 +634,7 @@ static void io_parse_fru(const void *sp_iohubs)
 		prlog(PR_DEBUG, "CEC:   PChip: %d HUB ID: %04x [EC=0x%x]"
 		      " Hub#=%d)\n",
 		      be32_to_cpu(hub->proc_chip_id), hub_id,
-		      be32_to_cpu(hub->ec_level), be32_to_cpu(hub->hub_num));
+		      be32_to_cpu(hub->ec_level), be16_to_cpu(hub->hub_num));
 
 		switch(hub_id) {
 		case CECHUB_HUB_P7IOC:
@@ -705,7 +705,7 @@ void io_parse(void)
 			prerror("CEC: IO-HUB FRU %d, bad ID data\n", i);
 			continue;
 		}
-		type = fru_id_data->card_type;
+		type = be32_to_cpu(fru_id_data->card_type);
 
 		prlog(PR_INFO, "CEC: HUB FRU %d is %s\n",
 		      i, type > 4 ? "Unknown" : typestr[type]);
-- 
2.1.4



More information about the Skiboot mailing list