PNP: fix printk format warnings
PATCH 1/1 PNP: fix printk format warnings
From: Randy Dunlap <[email protected]>
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'
--- drivers/pnp/pnpbios/rsparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pnp/pnpbios/rsparser.c +2 -2
@@ -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,
Quoted 4 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
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)
drivers/pnp/pnpbios/rsparser.c +2 -2
@@ -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,
Quoted 7 lines · Joe Perches
Quoted 4 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
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_tcan be u64
I know.
Quoted 1 line
I think you need %llu/(unsigned long long)
So the interrupt number or DMA channel may be astronomically huge? OK. Whatever.
Quoted 22 lines
drivers/pnp/pnpbios/rsparser.c +2
-2@@ -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,
Signature · 1 line
~Randy
Quoted 21 lines · Joe Perches
Quoted 4 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
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_tcan be u64
I think you need %llu/(unsigned long long)drivers/pnp/pnpbios/rsparser.c +1
-1@@ -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,
drivers/pnp/pnpbios/rsparser.c static void pnpbios_encode_dma(struct pn · line 608
Quoted 8 lines
drivers/pnp/pnpbios/rsparser.c +1
-1@@ -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
Quoted 27 lines · Rene Herman
Quoted 25 lines · Joe Perches
Quoted 4 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
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_tcan be u64
I think you need %llu/(unsigned long long)drivers/pnp/pnpbios/rsparser.c +1
-1@@ -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,drivers/pnp/pnpbios/rsparser.c +0
-0@@ -602,7 +602,7 @@ static void pnpbios_encode_dma(struct pn map =1 << res->start; p[1 ] = map &0xff ;
Quoted 8 lines
Quoted 6 lines
drivers/pnp/pnpbios/rsparser.c +1
-1-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.
Signature · 1 line
~Randy
Quoted 4 lines · Randy Dunlap
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.