linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][resend] udbg_printf() formatting attribute
@ 2006-05-17 16:00 jimix
  2006-05-17 23:36 ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: jimix @ 2006-05-17 16:00 UTC (permalink / raw)
  To: linuxppc-dev

Sorry, Previous patch was munged by MTA.

This patch allows the compiler to catch any printf-like mismatches for
udbg_printf().  After some brute force building I've only found issues
with my own code and lparcfg.c It could break some developers, but
IMHO that would be goodness.

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>

---

diff -r 0163968f7fce arch/powerpc/kernel/lparcfg.c
--- a/arch/powerpc/kernel/lparcfg.c	Tue May 16 15:55:19 2006 -0400
+++ b/arch/powerpc/kernel/lparcfg.c	Wed May 17 11:55:21 2006 -0400
@@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file
 
 	current_weight = (resource >> 5 * 8) & 0xFF;
 
-	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
+	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
 		 __FUNCTION__, current_entitled, current_weight);
 
-	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
+	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
 		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
 
 	retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
diff -r 0163968f7fce include/asm-powerpc/udbg.h
--- a/include/asm-powerpc/udbg.h	Tue May 16 15:55:19 2006 -0400
+++ b/include/asm-powerpc/udbg.h	Wed May 17 11:55:21 2006 -0400
@@ -23,7 +23,8 @@ extern int udbg_read(char *buf, int bufl
 extern int udbg_read(char *buf, int buflen);
 
 extern void register_early_udbg_console(void);
-extern void udbg_printf(const char *fmt, ...);
+extern void udbg_printf(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
 extern void udbg_progress(char *s, unsigned short hex);
 
 extern void udbg_init_uart(void __iomem *comport, unsigned int speed,

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

* Re: [PATCH][resend] udbg_printf() formatting attribute
  2006-05-17 16:00 [PATCH][resend] udbg_printf() formatting attribute jimix
@ 2006-05-17 23:36 ` Michael Ellerman
  2006-05-18 12:22   ` Jimi Xenidis
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2006-05-17 23:36 UTC (permalink / raw)
  To: jimix; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]

On Wed, 2006-05-17 at 12:00 -0400, jimix@watson.ibm.com wrote:
> Sorry, Previous patch was munged by MTA.
> 
> This patch allows the compiler to catch any printf-like mismatches for
> udbg_printf().  After some brute force building I've only found issues
> with my own code and lparcfg.c It could break some developers, but
> IMHO that would be goodness.
> 
> Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
> 
> ---
> 
> diff -r 0163968f7fce arch/powerpc/kernel/lparcfg.c
> --- a/arch/powerpc/kernel/lparcfg.c	Tue May 16 15:55:19 2006 -0400
> +++ b/arch/powerpc/kernel/lparcfg.c	Wed May 17 11:55:21 2006 -0400
> @@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file
>  
>  	current_weight = (resource >> 5 * 8) & 0xFF;
>  
> -	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
> +	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
>  		 __FUNCTION__, current_entitled, current_weight);
>  
> -	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
> +	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
>  		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);

But pr_debug() calls printk, not udbg_printf() ?

cheers

>  
>  	retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
> diff -r 0163968f7fce include/asm-powerpc/udbg.h
> --- a/include/asm-powerpc/udbg.h	Tue May 16 15:55:19 2006 -0400
> +++ b/include/asm-powerpc/udbg.h	Wed May 17 11:55:21 2006 -0400
> @@ -23,7 +23,8 @@ extern int udbg_read(char *buf, int bufl
>  extern int udbg_read(char *buf, int buflen);
>  
>  extern void register_early_udbg_console(void);
> -extern void udbg_printf(const char *fmt, ...);
> +extern void udbg_printf(const char *fmt, ...)
> +	__attribute__ ((format (printf, 1, 2)));
>  extern void udbg_progress(char *s, unsigned short hex);
>  
>  extern void udbg_init_uart(void __iomem *comport, unsigned int speed,

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

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

* Re: [PATCH][resend] udbg_printf() formatting attribute
  2006-05-17 23:36 ` Michael Ellerman
@ 2006-05-18 12:22   ` Jimi Xenidis
  2006-05-18 15:56     ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Jimi Xenidis @ 2006-05-18 12:22 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]


On May 17, 2006, at 7:36 PM, Michael Ellerman wrote:

> On Wed, 2006-05-17 at 12:00 -0400, jimix@watson.ibm.com wrote:
>> -	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
>> +	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
>>  		 __FUNCTION__, current_entitled, current_weight);
>>
>> -	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
>> +	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
>>  		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
>
> But pr_debug() calls printk, not udbg_printf() ?

Now _thats_ funny!
Then I'm so happy to have found and fixed this compiler warning :)

>> -extern void udbg_printf(const char *fmt, ...);
>> +extern void udbg_printf(const char *fmt, ...)
>> +	__attribute__ ((format (printf, 1, 2)));

I believe this chunk is still goodness as it will catch format issues  
for developers.
-JX

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

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

* Re: [PATCH][resend] udbg_printf() formatting attribute
  2006-05-18 12:22   ` Jimi Xenidis
@ 2006-05-18 15:56     ` Michael Ellerman
  2006-05-18 16:52       ` Jimi Xenidis
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2006-05-18 15:56 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]

On Thu, 2006-05-18 at 08:22 -0400, Jimi Xenidis wrote:
> On May 17, 2006, at 7:36 PM, Michael Ellerman wrote:
> 
> > On Wed, 2006-05-17 at 12:00 -0400, jimix@watson.ibm.com wrote:
> >> -	pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
> >> +	pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
> >>  		 __FUNCTION__, current_entitled, current_weight);
> >>
> >> -	pr_debug("%s: new_entitled = %lu, new_weight = %lu\n",
> >> +	pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
> >>  		 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
> >
> > But pr_debug() calls printk, not udbg_printf() ?
> 
> Now _thats_ funny!
> Then I'm so happy to have found and fixed this compiler warning :)

Haha, nice one Jimi :D

> >> -extern void udbg_printf(const char *fmt, ...);
> >> +extern void udbg_printf(const char *fmt, ...)
> >> +	__attribute__ ((format (printf, 1, 2)));
> 
> I believe this chunk is still goodness as it will catch format issues  
> for developers.

I'm actually hoping to get rid of udbg_printf(), but if I can't we
should stick this in I guess. The real problem IMHO is that debug
printks rot because they're rarely compiled, not sure what to do about
that.

cheers

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

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

* Re: [PATCH][resend] udbg_printf() formatting attribute
  2006-05-18 15:56     ` Michael Ellerman
@ 2006-05-18 16:52       ` Jimi Xenidis
  2006-05-22  6:33         ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Jimi Xenidis @ 2006-05-18 16:52 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]


On May 18, 2006, at 11:56 AM, Michael Ellerman wrote:
>
> I'm actually hoping to get rid of udbg_printf(), but if I can't we
> should stick this in I guess. The real problem IMHO is that debug
> printks rot because they're rarely compiled, not sure what to do about
> that.

Yeah, debug code always has that problem.  But I must say, whenever I  
work with the x86 guys and I see how long they are _blind_ when they  
boot it blows my mind.  Lets hope we don't go there.
-JX

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

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

* Re: [PATCH][resend] udbg_printf() formatting attribute
  2006-05-18 16:52       ` Jimi Xenidis
@ 2006-05-22  6:33         ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2006-05-22  6:33 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

On Thu, 2006-05-18 at 12:52 -0400, Jimi Xenidis wrote:
> On May 18, 2006, at 11:56 AM, Michael Ellerman wrote:
> >
> > I'm actually hoping to get rid of udbg_printf(), but if I can't we
> > should stick this in I guess. The real problem IMHO is that debug
> > printks rot because they're rarely compiled, not sure what to do about
> > that.
> 
> Yeah, debug code always has that problem.  But I must say, whenever I  
> work with the x86 guys and I see how long they are _blind_ when they  
> boot it blows my mind.  Lets hope we don't go there.

Yeah nuts. Don't worry, when I say "get rid of udbg_printf()" I mean
"replace with printk".

cheers

-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

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

end of thread, other threads:[~2006-05-22  6:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-17 16:00 [PATCH][resend] udbg_printf() formatting attribute jimix
2006-05-17 23:36 ` Michael Ellerman
2006-05-18 12:22   ` Jimi Xenidis
2006-05-18 15:56     ` Michael Ellerman
2006-05-18 16:52       ` Jimi Xenidis
2006-05-22  6:33         ` Michael Ellerman

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).