[PATCH radeontool 5/5] Fix string format mismatch warnings

Tormod Volden lists.tormod at gmail.com
Fri Dec 2 13:32:06 PST 2011


From: Tormod Volden <debian.tormod at gmail.com>

Consistently use int for register values and long for register offsets.

Signed-off-by: Tormod Volden <debian.tormod at gmail.com>
---
 atombios_tables.c |    2 +-
 avivotool.c       |   18 +++++++++---------
 radeonreg.c       |    4 ++--
 radeontool.c      |   14 +++++++-------
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/atombios_tables.c b/atombios_tables.c
index f291a02..845be47 100644
--- a/atombios_tables.c
+++ b/atombios_tables.c
@@ -634,7 +634,7 @@ static void radeon_print_pp_misc(uint32_t misc)
     if (misc & ATOM_PM_MISCINFO_THERMAL_DIODE_MODE)
 	printf("\t\tTHERMAL_DIODE_MODE\n");
     if (misc & ATOM_PM_MISCINFO_FRAME_MODULATION_MASK)
-	printf("\t\tFM: 0x%x\n",
+	printf("\t\tFM: 0x%lx\n",
 	       (misc & ATOM_PM_MISCINFO_FRAME_MODULATION_MASK) >> ATOM_PM_MISCINFO_FRAME_MODULATION_SHIFT);
     if (misc & ATOM_PM_MISCINFO_DYN_CLK_3D_IDLE)
 	printf("\t\tDYN_CLK_3D_IDLE\n");
diff --git a/avivotool.c b/avivotool.c
index c555083..f957d9a 100644
--- a/avivotool.c
+++ b/avivotool.c
@@ -938,7 +938,7 @@ void eg_cmd_regs(const char *type)
     int show_all = (strcmp(type, "all") == 0);
     int show_mc = (show_all || strstr(type, "mc"));
     int show_grphs = 0;
-    int i;
+    unsigned long i;
     uint32_t tmp, tmp1;
     char tmpname[10];
     
@@ -963,7 +963,7 @@ void eg_cmd_regs(const char *type)
 	if (tmp & 0x1)
 	    show_grphs |= (1 << i);
 
-	printf("D%dCRTC: %s, Cursor %s\n", i+1, tmp & 0x1 ? "Enabled" : "Disabled",
+	printf("D%ldCRTC: %s, Cursor %s\n", i+1, tmp & 0x1 ? "Enabled" : "Disabled",
 	       tmp1 & 0x1 ? "Enabled" : "Disabled");
 	if (!(tmp & 0x1))
 	    continue;
@@ -980,7 +980,7 @@ void eg_cmd_regs(const char *type)
 	if (!(show_grphs & (1 << i)))
 	    continue;
 
-	snprintf(tmpname, 10, "D%dGRPH", i+1);
+	snprintf(tmpname, 10, "D%ldGRPH", i+1);
 	tmp = EG_GET_MODE_REG(i, EVERGREEN_GRPH_ENABLE);
 	if (!(tmp & 0x1)) {
 	    printf("\n%s: disabled\n", tmpname, i);
@@ -1017,7 +1017,7 @@ void eg_cmd_regs(const char *type)
 	if (!(tmp & 0x1))
 	    continue;
 
-	snprintf(tmpname, 10, "D%dCUR", i+1);
+	snprintf(tmpname, 10, "D%ldCUR", i+1);
 	radeon_show_reg_bits(tmpname, "CONTROL", 0, 0,
 			     EVERGREEN_CUR_CONTROL,
 			     0, 0, "Enable",
@@ -1052,9 +1052,9 @@ void eg_cmd_regs(const char *type)
 	    SHOW_UNKNOWN_REG(i);
 	for (i = 0x6420 ; i < 0x647c; i+=4)
 	    SHOW_UNKNOWN_REG(i);
-	SHOW_UNKNOWN_REG(0x6590);
-	SHOW_UNKNOWN_REG(0x65b4);
-	SHOW_UNKNOWN_REG(0x65cc);
+	SHOW_UNKNOWN_REG(0x6590L);
+	SHOW_UNKNOWN_REG(0x65b4L);
+	SHOW_UNKNOWN_REG(0x65ccL);
 
 	for (i = 0x6660 ; i <= 0x66dc; i+=4)
 	    SHOW_UNKNOWN_REG(i);
@@ -1223,11 +1223,11 @@ void radeon_cmd_regs(const char *type)
             SHOW_UNKNOWN_REG(i);
 
 	/* dump a bunch of the MC regs */
-#define SHOW_UNK_MC_REG(r) printf("%02x\t%08x\n", r, radeon_get_indexed(AVIVO_MC_INDEX, AVIVO_MC_DATA, (r | 0x007f0000), #r))
+#define SHOW_UNK_MC_REG(r) printf("%02lx\t%08x\n", r, radeon_get_indexed(AVIVO_MC_INDEX, AVIVO_MC_DATA, (r | 0x007f0000), #r))
 	for (i = 0; i < 0x92; i++)
         	SHOW_UNK_MC_REG(i);
 		
-#define SHOW_UNK_CLK_REG(r) printf("%02x\t%08x\n", r, radeon_get_indexed(RADEON_CLOCK_CNTL_INDEX, RADEON_CLOCK_CNTL_DATA, (r), #r))
+#define SHOW_UNK_CLK_REG(r) printf("%02lx\t%08x\n", r, radeon_get_indexed(RADEON_CLOCK_CNTL_INDEX, RADEON_CLOCK_CNTL_DATA, (r), #r))
 	for (i = 0; i < 0x20; i++)
         	SHOW_UNK_CLK_REG(i);
         return;
diff --git a/radeonreg.c b/radeonreg.c
index 68dfad3..bbfe629 100644
--- a/radeonreg.c
+++ b/radeonreg.c
@@ -176,9 +176,9 @@ static void usage(void)
 #define SHOW_MC_REG_BITS(r, ...) radeon_show_reg_bits(NULL, AVIVO_MC_INDEX, AVIVO_MC_DATA, #r, (r | 0x007f0000), __VA_ARGS__)
 #define SHOW_PCIE_REG(r) printf("%s\t%08x\n", #r, radeon_get_indexed(0x30, 0x34, (r), #r))
 
-#define SHOW_UNK_MC_REG(r) printf("%02x\t%08x\n", r, radeon_get_indexed(AVIVO_MC_INDEX, AVIVO_MC_DATA, (r | 0x007f0000), #r))
+#define SHOW_UNK_MC_REG(r) printf("%02lx\t%08x\n", r, radeon_get_indexed(AVIVO_MC_INDEX, AVIVO_MC_DATA, (r | 0x007f0000), #r))
 
-#define SHOW_UNK_CLK_REG(r) printf("%02x\t%08x\n", r, radeon_get_indexed(RADEON_CLOCK_CNTL_INDEX, RADEON_CLOCK_CNTL_DATA, (r), #r))
+#define SHOW_UNK_CLK_REG(r) printf("%02lx\t%08x\n", r, radeon_get_indexed(RADEON_CLOCK_CNTL_INDEX, RADEON_CLOCK_CNTL_DATA, (r), #r))
 
 static void radeon_show_radeon_display_regs(const char *type)
 {
diff --git a/radeontool.c b/radeontool.c
index 08b1749..a63d074 100644
--- a/radeontool.c
+++ b/radeontool.c
@@ -849,7 +849,7 @@ void radeon_cmd_bits(void)
 
 void radeon_cmd_dac(char *param)
 {
-    unsigned long dac_cntl;
+    unsigned int dac_cntl;
 
     dac_cntl = radeon_get(RADEON_DAC_CNTL,"RADEON_DAC_CNTL");
     if(param == NULL) {
@@ -867,7 +867,7 @@ void radeon_cmd_dac(char *param)
 
 void radeon_cmd_light(char *param)
 {
-    unsigned long lvds_gen_cntl;
+    unsigned int lvds_gen_cntl;
 
     lvds_gen_cntl = radeon_get(RADEON_LVDS_GEN_CNTL,"RADEON_LVDS_GEN_CNTL");
     if(param == NULL) {
@@ -885,7 +885,7 @@ void radeon_cmd_light(char *param)
 
 void radeon_cmd_stretch(char *param)
 {
-    unsigned long fp_vert_stretch,fp_horz_stretch;
+    unsigned int fp_vert_stretch,fp_horz_stretch;
 
     fp_vert_stretch = radeon_get(RADEON_FP_VERT_STRETCH,"RADEON_FP_VERT_STRETCH");
     fp_horz_stretch = radeon_get(RADEON_FP_HORZ_STRETCH,"RADEON_FP_HORZ_STRETCH");
@@ -2379,7 +2379,7 @@ static void radeon_rom_legacy_igptable(unsigned char *bios, int hdr)
 	fsb = BIOS16(offset + 0x2);
 	if (rev < 2)
 	    fsb *= 100;
-	printf("FSB: %f Mhz\n", fsb);
+	printf("FSB: %i Mhz\n", fsb);
 
 	printf("mclk reference frequency: %f Mhz\n", BIOS16(offset + 0x4) / 100.00);
 	printf("mclk reference divider: %d \n", BIOS16(offset + 0x6));
@@ -2389,9 +2389,9 @@ static void radeon_rom_legacy_igptable(unsigned char *bios, int hdr)
 	if (rev > 1)
 	    printf("max mclk: %f \n", BIOS16(offset + 0xf) / 100.00);
 	if (rev > 2) {
-	    printf("K8 mclk: %f \n", BIOS16(offset + 0x11));
-	    printf("K8 sync start delay: %f us\n", BIOS16(offset + 0x13) / 100);
-	    printf("K8 data return time: %f us\n", BIOS16(offset + 0x15) / 100);
+	    printf("K8 mclk: %i \n", BIOS16(offset + 0x11));
+	    printf("K8 sync start delay: %f us\n", BIOS16(offset + 0x13) / 100.00);
+	    printf("K8 data return time: %f us\n", BIOS16(offset + 0x15) / 100.00);
 	}
 	if (rev > 3) {
 	    if (BIOS16(offset + 0x17) & 1)
-- 
1.7.5.4



More information about the xorg-driver-ati mailing list