Skip to contentSkip to conversation

mx3fb: Fix print format string

PATCH In review Oleg Drokin 3 participants 4 messages Aug 27, 2016 – Aug 30, 2016 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx3fb: Fix print format string

%ul was probably meant as %lu since the former would print an unsigned value and a letter l.

But in fact the whole value we are printing in u32 anyway, so we don't need the format to be long. Therefore just drop the l altogether.

---
Also do we really need 1000UL specification if we cast to u32 anyway? Or should we drop away the cast instead? Are pixelclocks over 4GHz possible here?

 drivers/video/fbdev/mx3fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/mx3fb.c +1 -1
index f91b1db..8778e01 100644
@@ -845,7 +845,7 @@ static int __set_par(struct fb_info *fbi, bool lock)
 		if (fbi->var.sync & FB_SYNC_SHARP_MODE)
 			mode = IPU_PANEL_SHARP_TFT;
 
-		dev_dbg(fbi->device, "pixclock = %ul Hz\n",
+		dev_dbg(fbi->device, "pixclock = %u Hz\n",
 			(u32) (PICOS2KHZ(fbi->var.pixclock) * 1000UL));
 
 		if (sdc_init_panel(mx3fb, mode,
Signature · 1 line
2.7.4
#1 lore raw
Quoted 6 lines · Oleg Drokin

%ul was probably meant as %lu since the former would print an unsigned value and a letter l.

But in fact the whole value we are printing in u32 anyway, so we don't need the format to be long. Therefore just drop the l altogether.

[]

Quoted 3 lines

Also do we really need 1000UL specification if we cast to u32 anyway? Or should we drop away the cast instead? Are pixelclocks over 4GHz possible here?

It's a debugging printk, it doesn't matter much.
Why not use "%u kHz" and drop the "* 1000UL"?

drivers/video/fbdev/mx3fb.c

Quoted 1 line
drivers/video/fbdev/mx3fb.c +0 -0

[]

Quoted 9 lines
drivers/video/fbdev/mx3fb.c +0 -0
@@ -845,7 +845,7 @@ static int __set_par(struct fb_info *fbi, bool lock)
  		if (fbi->var.sync & FB_SYNC_SHARP_MODE)
  			mode = IPU_PANEL_SHARP_TFT;

drivers/video/fbdev/mx3fb.c +1 -1
-		dev_dbg(fbi->device, "pixclock = %ul Hz\n",
+		dev_dbg(fbi->device, "pixclock = %u Hz\n",

  (u32) (PICOS2KHZ(fbi->var.pixclock) * 1000UL));
  if (sdc_init_panel(mx3fb, mode,

#2 lore raw
Quoted 7 lines · Joe Perches
Quoted 6 lines · Oleg Drokin

%ul was probably meant as %lu since the former would print an unsigned value and a letter l.

But in fact the whole value we are printing in u32 anyway, so we don't need the format to be long. Therefore just drop the l altogether.

Quoted 7 lines

[]

Quoted 3 lines

Also do we really need 1000UL specification if we cast to u32 anyway? Or should we drop away the cast instead? Are pixelclocks over 4GHz possible here?

It's a debugging printk, it doesn't matter much.
Why not use "%u kHz" and drop the "* 1000UL"?

I have no strong opinion on this since it's not my debugging code.

But XXX000l Hz makes zero sense either way.

Quoted 6 lines

drivers/video/fbdev/mx3fb.c

Quoted 1 line
drivers/video/fbdev/mx3fb.c +0 -0

[]

Quoted 4 lines
drivers/video/fbdev/mx3fb.c +0 -0
@@ -845,7 +845,7 @@ static int __set_par(struct fb_info *fbi, bool lock)
 		if (fbi->var.sync & FB_SYNC_SHARP_MODE)
 			mode = IPU_PANEL_SHARP_TFT;
 
Quoted 6 lines
Quoted 6 lines
drivers/video/fbdev/mx3fb.c +1 -1
-		dev_dbg(fbi->device, "pixclock = %ul Hz\n",
+		dev_dbg(fbi->device, "pixclock = %u Hz\n",
 			(u32) (PICOS2KHZ(fbi->var.pixclock) * 1000UL));
 
 		if (sdc_init_panel(mx3fb, mode,
                                   (PICOS2KHZ(fbi->var.pixclock)) * 1000UL,

I guess it's printed like that to match sdc_init_panel argument exactly?

#3 lore raw
In reply to Oleg Drokin
Quoted 22 lines · Oleg Drokin

%ul was probably meant as %lu since the former would print an unsigned value and a letter l.

But in fact the whole value we are printing in u32 anyway, so we don't need the format to be long. Therefore just drop the l altogether.

---
Also do we really need 1000UL specification if we cast to u32 anyway? Or should we drop away the cast instead? Are pixelclocks over 4GHz possible here?

 drivers/video/fbdev/mx3fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/mx3fb.c +0 -0
index f91b1db..8778e01 100644

drivers/video/fbdev/mx3fb.c static int __set_par(struct fb_info *fbi, bool lock) · line 851

Quoted 8 lines
drivers/video/fbdev/mx3fb.c +1 -1
@@ -845,7 +845,7 @@ static int __set_par(struct fb_info *fbi, bool lock)
 		if (fbi->var.sync & FB_SYNC_SHARP_MODE)
 			mode = IPU_PANEL_SHARP_TFT;
 
-		dev_dbg(fbi->device, "pixclock = %ul Hz\n",
+		dev_dbg(fbi->device, "pixclock = %u Hz\n",
 			(u32) (PICOS2KHZ(fbi->var.pixclock) * 1000UL));
 
 		if (sdc_init_panel(mx3fb, mode,

Thanks, queued for 4.9.

Tomi