Re: linux-next: net tree build warning
From: Wolfgang Grandegger
Date: Wed Jun 10 2009 - 03:39:12 EST
David Miller wrote:
> From: Wolfgang Grandegger <wg@xxxxxxxxxxxxxx>
> Date: Tue, 09 Jun 2009 15:14:38 +0200
>
>> David Miller wrote:
>>> From: Wolfgang Grandegger <wg@xxxxxxxxxxxxxx>
>>> Date: Tue, 09 Jun 2009 13:25:27 +0200
>>>
>>>> [PATCH] can: sja1000_of_platform: fix build problems with printk format
>>>>
>>>> Variables of type size_t should be printed with the format "%zx".
>>>>
>>>> Signed-off-by: Wolfgang Grandegger <wg@xxxxxxxxxxxxxx>
>>> It's not a "size_t", it's a "resource_size_t" which can be
>>> "unsigned long long" on some platforms.
>> Right, but I assume that the %zx handles that type properly as well.
>
> It absolutely does not.b
>
> resource_size_t is a arch specifically defined type that
> could be anything, it does not conform to the definitions
> of size_t.
Right, I'm now compiling on a x86_64 system and can reproduce the
warnings. Below is a revised patch.
Thanks for your patience.
Wolfgang.
[PATCH v2] can: sja1000_of_platform: fix build problems with printk format
According to "Documentation/printk-formats.txt", if the type is
dependent on a config option for its size, like resource_size_t,
we should use a format specifier of its largest possible type and
explicitly cast to it.
Signed-off-by: Wolfgang Grandegger <wg@xxxxxxxxxxxxxx>
---
drivers/net/can/sja1000/sja1000_of_platform.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: net-next-2.6/drivers/net/can/sja1000/sja1000_of_platform.c
===================================================================
--- net-next-2.6.orig/drivers/net/can/sja1000/sja1000_of_platform.c 2009-06-09 12:45:38.000000000 +0200
+++ net-next-2.6/drivers/net/can/sja1000/sja1000_of_platform.c 2009-06-10 09:23:47.208720083 +0200
@@ -108,15 +108,17 @@
res_size = resource_size(&res);
if (!request_mem_region(res.start, res_size, DRV_NAME)) {
- dev_err(&ofdev->dev, "couldn't request %#x..%#x\n",
- res.start, res.end);
+ dev_err(&ofdev->dev, "couldn't request %#llx..%#llx\n",
+ (unsigned long long)res.start,
+ (unsigned long long)res.end);
return -EBUSY;
}
base = ioremap_nocache(res.start, res_size);
if (!base) {
- dev_err(&ofdev->dev, "couldn't ioremap %#x..%#x\n",
- res.start, res.end);
+ dev_err(&ofdev->dev, "couldn't ioremap %#llx..%#llx\n",
+ (unsigned long long)res.start,
+ (unsigned long long)res.end);
err = -ENOMEM;
goto exit_release_mem;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/