* [PATCH] MTD: fix printk format warning
@ 2006-10-24 4:48 Randy Dunlap
2006-10-24 9:24 ` Artem Bityutskiy
0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2006-10-24 4:48 UTC (permalink / raw)
To: linux-mtd; +Cc: akpm, dwmw2
From: Randy Dunlap <randy.dunlap@oracle.com>
(may be a gcc phenomenon)
Fix printk format warning:
drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
drivers/mtd/maps/physmap.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- linux-2619-rc3-pv.orig/drivers/mtd/maps/physmap.c
+++ linux-2619-rc3-pv/drivers/mtd/maps/physmap.c
@@ -89,7 +89,7 @@ static int physmap_flash_probe(struct pl
return -ENODEV;
printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",
- (unsigned long long)dev->resource->end - dev->resource->start + 1,
+ (unsigned long long)(dev->resource->end - dev->resource->start + 1),
(unsigned long long)dev->resource->start);
info = kmalloc(sizeof(struct physmap_flash_info), GFP_KERNEL);
---
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MTD: fix printk format warning
2006-10-24 4:48 [PATCH] MTD: fix printk format warning Randy Dunlap
@ 2006-10-24 9:24 ` Artem Bityutskiy
2006-10-24 10:02 ` Ben Dooks
0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2006-10-24 9:24 UTC (permalink / raw)
To: Randy Dunlap; +Cc: akpm, dwmw2, linux-mtd
On Mon, 2006-10-23 at 21:48 -0700, Randy Dunlap wrote:
> (may be a gcc phenomenon)
> Fix printk format warning:
> drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)
>
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
... snip ...
> printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",
> - (unsigned long long)dev->resource->end - dev->resource->start + 1,
> + (unsigned long long)(dev->resource->end - dev->resource->start + 1),
> (unsigned long long)dev->resource->start);
Hmm, AFAIK
"(unsigned long) dev->resource->end - dev->resource->start + 1" should
end up with unsigned long, so why not to fix gcc instead?
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MTD: fix printk format warning
2006-10-24 9:24 ` Artem Bityutskiy
@ 2006-10-24 10:02 ` Ben Dooks
2006-10-24 15:29 ` Randy.Dunlap
0 siblings, 1 reply; 5+ messages in thread
From: Ben Dooks @ 2006-10-24 10:02 UTC (permalink / raw)
To: Artem Bityutskiy; +Cc: Randy Dunlap, akpm, dwmw2, linux-mtd
On Tue, Oct 24, 2006 at 12:24:10PM +0300, Artem Bityutskiy wrote:
> On Mon, 2006-10-23 at 21:48 -0700, Randy Dunlap wrote:
> > (may be a gcc phenomenon)
> > Fix printk format warning:
> > drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)
> >
> > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
>
> ... snip ...
>
> > printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",
> > - (unsigned long long)dev->resource->end - dev->resource->start + 1,
> > + (unsigned long long)(dev->resource->end - dev->resource->start + 1),
> > (unsigned long long)dev->resource->start);
>
> Hmm, AFAIK
>
> "(unsigned long) dev->resource->end - dev->resource->start + 1" should
I thought that 'z' was the modifier to %x for resources?
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MTD: fix printk format warning
2006-10-24 10:02 ` Ben Dooks
@ 2006-10-24 15:29 ` Randy.Dunlap
2006-10-24 16:57 ` Artem Bityutskiy
0 siblings, 1 reply; 5+ messages in thread
From: Randy.Dunlap @ 2006-10-24 15:29 UTC (permalink / raw)
To: Ben Dooks; +Cc: akpm, dwmw2, linux-mtd
Ben Dooks wrote:
> On Tue, Oct 24, 2006 at 12:24:10PM +0300, Artem Bityutskiy wrote:
>> On Mon, 2006-10-23 at 21:48 -0700, Randy Dunlap wrote:
>>> (may be a gcc phenomenon)
>>> Fix printk format warning:
>>> drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)
>>>
>>> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
>> ... snip ...
>>
>>> printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n",
>>> - (unsigned long long)dev->resource->end - dev->resource->start + 1,
>>> + (unsigned long long)(dev->resource->end - dev->resource->start + 1),
>>> (unsigned long long)dev->resource->start);
>> Hmm, AFAIK
>>
>> "(unsigned long) dev->resource->end - dev->resource->start + 1" should
>
> I thought that 'z' was the modifier to %x for resources?
Maybe you are thinking of 'z' for use with size_t ? From the C99 spec:
z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
size_t or the corresponding signed integer type argument; or that a
following n conversion specifier applies to a pointer to a signed integer type
corresponding to size_t argument. But a resource_size_t is not a size_t.
Depending on CONFIG, it's either:
#ifdef CONFIG_RESOURCES_64BIT
typedef u64 resource_size_t;
#else
typedef u32 resource_size_t;
#endif
which I suppose is what Artem missed. I.e., it's not always unsigned long.
However, I won't deny that gcc seems odd here.
--
~Randy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MTD: fix printk format warning
2006-10-24 15:29 ` Randy.Dunlap
@ 2006-10-24 16:57 ` Artem Bityutskiy
0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2006-10-24 16:57 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: akpm, Ben Dooks, dwmw2, linux-mtd
On Tue, 2006-10-24 at 08:29 -0700, Randy.Dunlap wrote:
> which I suppose is what Artem missed. I.e., it's not always unsigned long.
> However, I won't deny that gcc seems odd here.
I just wanted to say that (unsigned long)a - b + 1 has "unsigned long"
type even if "a" and "b" are u32 or u64. I would have understood you if
you had said that you cut "a" because of the u64->unsigned long casting,
but I understood that the rationale for the change was to fix print
format warning...
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-10-24 16:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-24 4:48 [PATCH] MTD: fix printk format warning Randy Dunlap
2006-10-24 9:24 ` Artem Bityutskiy
2006-10-24 10:02 ` Ben Dooks
2006-10-24 15:29 ` Randy.Dunlap
2006-10-24 16:57 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox