lkml.org 
[lkml]   [2008]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -next] PNP: fix printk format warnings
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


\
 
 \ /
  Last update: 2008-05-04 23:09    [W:0.061 / U:1.080 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site