Skip to contentSkip to conversation

powerpc/85xx: Fix compile warnings in mpc85xx_mds.c

PATCH Superseded Kumar Gala 2 participants 4 messages Dec 3, 2008

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc/85xx: Fix compile warnings in mpc85xx_mds.c

arch/powerpc/platforms/85xx/mpc85xx_mds.c: In function 'board_fixups':
arch/powerpc/platforms/85xx/mpc85xx_mds.c:244: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t' arch/powerpc/platforms/85xx/mpc85xx_mds.c:250: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t'

---
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_mds.c +2 -2
index 2494c51..915e8d3 100644
@@ -241,13 +241,13 @@ static int __init board_fixups(void)
 		mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
 
 		of_address_to_resource(mdio, 0, &res);
-		snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 1);
+		snprintf(phy_id, BUS_ID_SIZE, "%llx:%02x", (u64)res.start, 1);
 
 		phy_register_fixup_for_id(phy_id, mpc8568_fixup_125_clock);
 		phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
 
 		/* Register a workaround for errata */
-		snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 7);
+		snprintf(phy_id, BUS_ID_SIZE, "%llx:%02x", (u64)res.start, 7);
 		phy_register_fixup_for_id(phy_id, mpc8568_mds_phy_fixups);
 
 		of_node_put(mdio);
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 14 lines · Kumar Gala

arch/powerpc/platforms/85xx/mpc85xx_mds.c: In function 'board_fixups':
arch/powerpc/platforms/85xx/mpc85xx_mds.c:244: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t' arch/powerpc/platforms/85xx/mpc85xx_mds.c:250: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t'

---
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_mds.c +0 -0
index 2494c51..915e8d3 100644

arch/powerpc/platforms/85xx/mpc85xx_mds.c static int __init board_fixups(void) · line 244

Quoted 5 lines
arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -1
@@ -241,13 +241,13 @@ static int __init board_fixups(void)
 		mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
 
 		of_address_to_resource(mdio, 0, &res);
-		snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 1);
+		snprintf(phy_id, BUS_ID_SIZE, "%llx:%02x", (u64)res.start, 1);
                                                            ^^^

unsigned long? u64 differs for 32-bit and 64-bit.

Doh, if you would put the whole resource range there, you could use %pR ;-)

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V. VAT BE 0413.825.160 · RPR Brussels Fortis · BIC GEBABEBB · IBAN BE41293037680010

author
#2 lore raw
Quoted 17 lines · Geert Uytterhoeven
Quoted 16 lines · Kumar Gala

arch/powerpc/platforms/85xx/mpc85xx_mds.c: In function 'board_fixups':
arch/powerpc/platforms/85xx/mpc85xx_mds.c:244: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t' arch/powerpc/platforms/85xx/mpc85xx_mds.c:250: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t'

---
arch/powerpc/platforms/85xx/mpc85xx_mds.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_mds.c +0 -0
index 2494c51..915e8d3 100644
@@ -241,13 +241,13 @@ static int __init board_fixups(void)
 		mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
 
Quoted 5 lines

arch/powerpc/platforms/85xx/mpc85xx_mds.c static int __init board_fixups(void) · line 244

Quoted 3 lines
arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -1
 		of_address_to_resource(mdio, 0, &res);
-		snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 1);
+		snprintf(phy_id, BUS_ID_SIZE, "%llx:%02x", (u64)res.start, 1);
                                                           ^^^

unsigned long? u64 differs for 32-bit and 64-bit.

This is proper. This is a 32-bit only platform (and the format is long long).

Quoted 1 line

Doh, if you would put the whole resource range there, you could use %pR ;-)

and if we had a %R ... :)

- k

#3 lore raw
Quoted 21 lines · Kumar Gala
Quoted 20 lines · Geert Uytterhoeven
Quoted 19 lines · Kumar Gala

arch/powerpc/platforms/85xx/mpc85xx_mds.c: In function 'board_fixups':
arch/powerpc/platforms/85xx/mpc85xx_mds.c:244: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t' arch/powerpc/platforms/85xx/mpc85xx_mds.c:250: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'resource_size_t'

---
arch/powerpc/platforms/85xx/mpc85xx_mds.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_mds.c +0 -0
index 2494c51..915e8d3 100644
@@ -241,13 +241,13 @@ static int __init board_fixups(void)
 mdio = of_find_compatible_node(NULL, NULL, compstrs[i]);
 
Quoted 7 lines
Quoted 5 lines

arch/powerpc/platforms/85xx/mpc85xx_mds.c static int __init board_fixups(void) · line 244

Quoted 3 lines
arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -1
 		of_address_to_resource(mdio, 0, &res);
-		snprintf(phy_id, BUS_ID_SIZE, "%x:%02x", res.start, 1);
+		snprintf(phy_id, BUS_ID_SIZE, "%llx:%02x", (u64)res.start, 1);
                                                          ^^^

unsigned long? u64 differs for 32-bit and 64-bit.

This is proper. This is a 32-bit only platform (and the format is long long).

Sorry, I meant `unsigned long long'.

One day someone may copy-and-paste to a 64-bit platform...

Quoted 3 lines
Quoted 1 line

Doh, if you would put the whole resource range there, you could use %pR ;-)

and if we had a %R ... :)

... we would have a hard job teaching gcc how to handle it ;-)

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V. VAT BE 0413.825.160 · RPR Brussels Fortis · BIC GEBABEBB · IBAN BE41293037680010