linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mx3fb: Fix print format string
@ 2016-08-27  3:05 Oleg Drokin
  2016-08-27  3:18 ` Joe Perches
  2016-08-30  8:57 ` Tomi Valkeinen
  0 siblings, 2 replies; 4+ messages in thread
From: Oleg Drokin @ 2016-08-27  3:05 UTC (permalink / raw)
  To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Luis R. Rodriguez
  Cc: linux-fbdev, linux-kernel, 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.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
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(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index f91b1db..8778e01 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -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,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mx3fb: Fix print format string
  2016-08-27  3:05 [PATCH] mx3fb: Fix print format string Oleg Drokin
@ 2016-08-27  3:18 ` Joe Perches
  2016-08-27  3:28   ` Oleg Drokin
  2016-08-30  8:57 ` Tomi Valkeinen
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2016-08-27  3:18 UTC (permalink / raw)
  To: Oleg Drokin, Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
	Luis R. Rodriguez
  Cc: linux-fbdev, linux-kernel

On Fri, 2016-08-26 at 23:05 -0400, Oleg Drokin wrote:
> %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?

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

> diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
[]
> @@ -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,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mx3fb: Fix print format string
  2016-08-27  3:18 ` Joe Perches
@ 2016-08-27  3:28   ` Oleg Drokin
  0 siblings, 0 replies; 4+ messages in thread
From: Oleg Drokin @ 2016-08-27  3:28 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
	Luis R. Rodriguez, linux-fbdev, linux-kernel


On Aug 26, 2016, at 11:18 PM, Joe Perches wrote:

> On Fri, 2016-08-26 at 23:05 -0400, Oleg Drokin wrote:
>> %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?
> 
> 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.

>> diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
> []
>> @@ -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,
>>                                    (PICOS2KHZ(fbi->var.pixclock)) * 1000UL,

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mx3fb: Fix print format string
  2016-08-27  3:05 [PATCH] mx3fb: Fix print format string Oleg Drokin
  2016-08-27  3:18 ` Joe Perches
@ 2016-08-30  8:57 ` Tomi Valkeinen
  1 sibling, 0 replies; 4+ messages in thread
From: Tomi Valkeinen @ 2016-08-30  8:57 UTC (permalink / raw)
  To: Oleg Drokin, Jean-Christophe Plagniol-Villard, Luis R. Rodriguez
  Cc: linux-fbdev, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1192 bytes --]

On 27/08/16 06:05, Oleg Drokin wrote:
> %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.
> 
> Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
> ---
> 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(-)
> 
> diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
> index f91b1db..8778e01 100644
> --- a/drivers/video/fbdev/mx3fb.c
> +++ b/drivers/video/fbdev/mx3fb.c
> @@ -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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-30  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-27  3:05 [PATCH] mx3fb: Fix print format string Oleg Drokin
2016-08-27  3:18 ` Joe Perches
2016-08-27  3:28   ` Oleg Drokin
2016-08-30  8:57 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).