public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] PNP: fix printk format warnings
@ 2008-04-30 20:56 Randy Dunlap
  2008-04-30 21:07 ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2008-04-30 20:56 UTC (permalink / raw)
  To: linux-next, lkml; +Cc: akpm

From: Randy Dunlap <randy.dunlap@oracle.com>

next-20080430/drivers/pnp/pnpbios/rsparser.c:594: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'
next-20080430/drivers/pnp/pnpbios/rsparser.c:605: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 drivers/pnp/pnpbios/rsparser.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- next-20080430.orig/drivers/pnp/pnpbios/rsparser.c
+++ next-20080430/drivers/pnp/pnpbios/rsparser.c
@@ -591,7 +591,7 @@ static void pnpbios_encode_irq(struct pn
 	p[1] = map & 0xff;
 	p[2] = (map >> 8) & 0xff;
 
-	dev_dbg(&dev->dev, "  encode irq %d\n", res->start);
+	dev_dbg(&dev->dev, "  encode irq %d\n", (int)res->start);
 }
 
 static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p,
@@ -602,7 +602,7 @@ static void pnpbios_encode_dma(struct pn
 	map = 1 << res->start;
 	p[1] = map & 0xff;
 
-	dev_dbg(&dev->dev, "  encode dma %d\n", res->start);
+	dev_dbg(&dev->dev, "  encode dma %d\n", (int)res->start);
 }
 
 static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p,

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

* Re: [PATCH -next] PNP: fix printk format warnings
  2008-04-30 20:56 [PATCH -next] PNP: fix printk format warnings Randy Dunlap
@ 2008-04-30 21:07 ` Joe Perches
  2008-04-30 21:25   ` Randy Dunlap
  2008-05-04 19:18   ` Rene Herman
  0 siblings, 2 replies; 6+ messages in thread
From: Joe Perches @ 2008-04-30 21:07 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-next, lkml, akpm


On Wed, 2008-04-30 at 13:56 -0700, Randy Dunlap wrote:
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> next-20080430/drivers/pnp/pnpbios/rsparser.c:594: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'
> next-20080430/drivers/pnp/pnpbios/rsparser.c:605: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'

resource_size_t can be u64
I think you need %llu/(unsigned long long)

--- next-20080430.orig/drivers/pnp/pnpbios/rsparser.c
+++ next-20080430/drivers/pnp/pnpbios/rsparser.c
@@ -591,7 +591,7 @@ static void pnpbios_encode_irq(struct pn
 	p[1] = map & 0xff;
 	p[2] = (map >> 8) & 0xff;
 
-	dev_dbg(&dev->dev, "  encode irq %d\n", res->start);
+	dev_dbg(&dev->dev, "  encode irq %llu\n", (unsigned long long)res->start);
 }
 
 static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p,
@@ -602,7 +602,7 @@ static void pnpbios_encode_dma(struct pn
 	map = 1 << res->start;
 	p[1] = map & 0xff;
 
-	dev_dbg(&dev->dev, "  encode dma %d\n", res->start);
+	dev_dbg(&dev->dev, "  encode dma %llu\n", (unsigned long long)res->start);
 }
 
 static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p,



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

* Re: [PATCH -next] PNP: fix printk format warnings
  2008-04-30 21:07 ` Joe Perches
@ 2008-04-30 21:25   ` Randy Dunlap
  2008-05-04 19:18   ` Rene Herman
  1 sibling, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2008-04-30 21:25 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-next, lkml, akpm

Joe Perches wrote:
> On Wed, 2008-04-30 at 13:56 -0700, Randy Dunlap wrote:
>> From: Randy Dunlap <randy.dunlap@oracle.com>
>>
>> next-20080430/drivers/pnp/pnpbios/rsparser.c:594: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'
>> next-20080430/drivers/pnp/pnpbios/rsparser.c:605: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'
> 
> resource_size_t can be u64

I know.

> I think you need %llu/(unsigned long long)

So the interrupt number or DMA channel may be astronomically huge?  OK.
Whatever.

> --- next-20080430.orig/drivers/pnp/pnpbios/rsparser.c
> +++ next-20080430/drivers/pnp/pnpbios/rsparser.c
> @@ -591,7 +591,7 @@ static void pnpbios_encode_irq(struct pn
>  	p[1] = map & 0xff;
>  	p[2] = (map >> 8) & 0xff;
>  
> -	dev_dbg(&dev->dev, "  encode irq %d\n", res->start);
> +	dev_dbg(&dev->dev, "  encode irq %llu\n", (unsigned long long)res->start);
>  }
>  
>  static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p,
> @@ -602,7 +602,7 @@ static void pnpbios_encode_dma(struct pn
>  	map = 1 << res->start;
>  	p[1] = map & 0xff;
>  
> -	dev_dbg(&dev->dev, "  encode dma %d\n", res->start);
> +	dev_dbg(&dev->dev, "  encode dma %llu\n", (unsigned long long)res->start);
>  }
>  
>  static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p,
> 
> 


-- 
~Randy

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

* Re: [PATCH -next] PNP: fix printk format warnings
  2008-04-30 21:07 ` Joe Perches
  2008-04-30 21:25   ` Randy Dunlap
@ 2008-05-04 19:18   ` Rene Herman
  2008-05-04 21:05     ` Randy Dunlap
  1 sibling, 1 reply; 6+ messages in thread
From: Rene Herman @ 2008-05-04 19:18 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Joe Perches, Randy Dunlap, linux-next, lkml, akpm

On 30-04-08 23:07, Joe Perches wrote:

> On Wed, 2008-04-30 at 13:56 -0700, Randy Dunlap wrote:
>> From: Randy Dunlap <randy.dunlap@oracle.com>
>>
>> next-20080430/drivers/pnp/pnpbios/rsparser.c:594: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'
>> next-20080430/drivers/pnp/pnpbios/rsparser.c:605: warning: format '%d' expects type 'int', but argument 4 has type 'resource_size_t'
> 
> resource_size_t can be u64
> I think you need %llu/(unsigned long long)
> 
> --- next-20080430.orig/drivers/pnp/pnpbios/rsparser.c
> +++ next-20080430/drivers/pnp/pnpbios/rsparser.c
> @@ -591,7 +591,7 @@ static void pnpbios_encode_irq(struct pn
>  	p[1] = map & 0xff;
>  	p[2] = (map >> 8) & 0xff;
>  
> -	dev_dbg(&dev->dev, "  encode irq %d\n", res->start);
> +	dev_dbg(&dev->dev, "  encode irq %llu\n", (unsigned long long)res->start);
>  }
>  
>  static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p,
> @@ -602,7 +602,7 @@ static void pnpbios_encode_dma(struct pn
>  	map = 1 << res->start;
>  	p[1] = map & 0xff;
>  
> -	dev_dbg(&dev->dev, "  encode dma %d\n", res->start);
> +	dev_dbg(&dev->dev, "  encode dma %llu\n", (unsigned long long)res->start);
>  }
>  
>  static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p,

Bjorn? Could swear I previously saw patches that just did an (int) cast here...

Rene

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

* Re: [PATCH -next] PNP: fix printk format warnings
  2008-05-04 19:18   ` Rene Herman
@ 2008-05-04 21:05     ` Randy Dunlap
  2008-05-04 21:40       ` Rene Herman
  0 siblings, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2008-05-04 21:05 UTC (permalink / raw)
  To: Rene Herman; +Cc: Bjorn Helgaas, Joe Perches, linux-next, lkml, akpm

Rene Herman wrote:
> On 30-04-08 23:07, Joe Perches wrote:
> 
>> On Wed, 2008-04-30 at 13:56 -0700, Randy Dunlap wrote:
>>> From: Randy Dunlap <randy.dunlap@oracle.com>
>>>
>>> next-20080430/drivers/pnp/pnpbios/rsparser.c:594: warning: format 
>>> '%d' expects type 'int', but argument 4 has type 'resource_size_t'
>>> next-20080430/drivers/pnp/pnpbios/rsparser.c:605: warning: format 
>>> '%d' expects type 'int', but argument 4 has type 'resource_size_t'
>>
>> resource_size_t can be u64
>> I think you need %llu/(unsigned long long)
>>
>> --- next-20080430.orig/drivers/pnp/pnpbios/rsparser.c
>> +++ next-20080430/drivers/pnp/pnpbios/rsparser.c
>> @@ -591,7 +591,7 @@ static void pnpbios_encode_irq(struct pn
>>      p[1] = map & 0xff;
>>      p[2] = (map >> 8) & 0xff;
>>  
>> -    dev_dbg(&dev->dev, "  encode irq %d\n", res->start);
>> +    dev_dbg(&dev->dev, "  encode irq %llu\n", (unsigned long 
>> long)res->start);
>>  }
>>  
>>  static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p,
>> @@ -602,7 +602,7 @@ static void pnpbios_encode_dma(struct pn
>>      map = 1 << res->start;
>>      p[1] = map & 0xff;
>>  
>> -    dev_dbg(&dev->dev, "  encode dma %d\n", res->start);
>> +    dev_dbg(&dev->dev, "  encode dma %llu\n", (unsigned long 
>> long)res->start);
>>  }
>>  
>>  static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p,
> 
> Bjorn? Could swear I previously saw patches that just did an (int) cast 
> here...

My original patch did (int) cast but Joe suggested using
unsigned long long.  I didn't expect DMA channel or irq to be anywhere
near that large, so I thought that (int) would be sufficient,
at the same time recognizing that it does/could truncate the value,
while ull won't truncate.

-- 
~Randy

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

* Re: [PATCH -next] PNP: fix printk format warnings
  2008-05-04 21:05     ` Randy Dunlap
@ 2008-05-04 21:40       ` Rene Herman
  0 siblings, 0 replies; 6+ messages in thread
From: Rene Herman @ 2008-05-04 21:40 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Bjorn Helgaas, Joe Perches, linux-next, lkml, akpm

On 04-05-08 23:05, Randy Dunlap wrote:

> My original patch did (int) cast but Joe suggested using unsigned long
> long.  I didn't expect DMA channel or irq to be anywhere near that large,
> so I thought that (int) would be sufficient, at the same time recognizing
> that it does/could truncate the value, while ull won't truncate.

Yes, (int) would've been fine. It's (int) in PnPACPI as well which is what I 
remebered seeing. Doesn't matter much ofcourse.

Rene.

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

end of thread, other threads:[~2008-05-04 21:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30 20:56 [PATCH -next] PNP: fix printk format warnings Randy Dunlap
2008-04-30 21:07 ` Joe Perches
2008-04-30 21:25   ` Randy Dunlap
2008-05-04 19:18   ` Rene Herman
2008-05-04 21:05     ` Randy Dunlap
2008-05-04 21:40       ` Rene Herman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox