* [PATCH] fix printk format compiler warnings
@ 2008-09-05 12:06 Jan Beulich
2008-09-05 21:20 ` Andrew Morton
2008-09-30 11:29 ` [PATCH] checkpatch: Check for %L for all integer formats (was: Re: [PATCH] fix printk format compiler warnings) Geert Uytterhoeven
0 siblings, 2 replies; 6+ messages in thread
From: Jan Beulich @ 2008-09-05 12:06 UTC (permalink / raw)
To: linux-kernel
%llx and the like cannot be used on u64-derived data types - they must
be cast to long long explicitly for arch-es where u64 is a typedef of
unsigned long (ia64 is where I observed the problem).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
---
drivers/pci/probe.c | 16 +++++++++++++---
drivers/pci/setup-bus.c | 6 +++++-
2 files changed, 18 insertions(+), 4 deletions(-)
--- linux-2.6.27-rc5/drivers/pci/probe.c 2008-08-21 14:37:32.000000000 +0200
+++ 2.6.27-rc5-pci-probe-print/drivers/pci/probe.c 2008-09-02 15:18:08.000000000 +0200
@@ -383,7 +383,10 @@ void __devinit pci_read_bridge_bases(str
res->start = base;
if (!res->end)
res->end = limit + 0xfff;
- printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
+ printk(KERN_INFO "PCI: bridge %s io port: [%Lx, %Lx]\n",
+ pci_name(dev),
+ (unsigned long long)res->start,
+ (unsigned long long)res->end);
}
res = child->resource[1];
@@ -395,7 +398,10 @@ void __devinit pci_read_bridge_bases(str
res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
res->start = base;
res->end = limit + 0xfffff;
- printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
+ printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%Lx, %Lx]\n",
+ pci_name(dev),
+ (unsigned long long)res->start,
+ (unsigned long long)res->end);
}
res = child->resource[2];
@@ -431,7 +437,11 @@ void __devinit pci_read_bridge_bases(str
res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
res->start = base;
res->end = limit + 0xfffff;
- printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end);
+ printk(KERN_INFO "PCI: bridge %s %dbit mmio pref: [%Lx, %Lx]\n",
+ pci_name(dev),
+ res->flags & PCI_PREF_RANGE_TYPE_64 ? 64 : 32,
+ (unsigned long long)res->start,
+ (unsigned long long)res->end);
}
}
--- linux-2.6.27-rc5/drivers/pci/setup-bus.c 2008-08-21 14:37:32.000000000 +0200
+++ 2.6.27-rc5-pci-probe-print/drivers/pci/setup-bus.c 2008-09-02 15:18:20.000000000 +0200
@@ -539,7 +539,11 @@ static void pci_bus_dump_res(struct pci_
if (!res)
continue;
- printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
+ printk(KERN_INFO "bus: %02x index %x %s: [%Lx, %Lx]\n",
+ bus->number, i,
+ res->flags & IORESOURCE_IO ? "io port" : "mmio",
+ (unsigned long long)res->start,
+ (unsigned long long)res->end);
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] fix printk format compiler warnings
2008-09-05 12:06 [PATCH] fix printk format compiler warnings Jan Beulich
@ 2008-09-05 21:20 ` Andrew Morton
2008-09-09 4:54 ` Jesse Barnes
2008-09-30 11:29 ` [PATCH] checkpatch: Check for %L for all integer formats (was: Re: [PATCH] fix printk format compiler warnings) Geert Uytterhoeven
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2008-09-05 21:20 UTC (permalink / raw)
To: Jan Beulich; +Cc: linux-kernel, Jesse Barnes
On Fri, 05 Sep 2008 13:06:24 +0100
"Jan Beulich" <jbeulich@novell.com> wrote:
> %llx and the like cannot be used on u64-derived data types - they must
> be cast to long long explicitly for arch-es where u64 is a typedef of
> unsigned long (ia64 is where I observed the problem).
>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>
> ---
> drivers/pci/probe.c | 16 +++++++++++++---
> drivers/pci/setup-bus.c | 6 +++++-
> 2 files changed, 18 insertions(+), 4 deletions(-)
>
> --- linux-2.6.27-rc5/drivers/pci/probe.c 2008-08-21 14:37:32.000000000 +0200
> +++ 2.6.27-rc5-pci-probe-print/drivers/pci/probe.c 2008-09-02 15:18:08.000000000 +0200
> @@ -383,7 +383,10 @@ void __devinit pci_read_bridge_bases(str
> res->start = base;
> if (!res->end)
> res->end = limit + 0xfff;
> - printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
> + printk(KERN_INFO "PCI: bridge %s io port: [%Lx, %Lx]\n",
> + pci_name(dev),
> + (unsigned long long)res->start,
> + (unsigned long long)res->end);
> }
>
> res = child->resource[1];
> @@ -395,7 +398,10 @@ void __devinit pci_read_bridge_bases(str
> res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
> res->start = base;
> res->end = limit + 0xfffff;
> - printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
> + printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%Lx, %Lx]\n",
> + pci_name(dev),
> + (unsigned long long)res->start,
> + (unsigned long long)res->end);
> }
>
> res = child->resource[2];
> @@ -431,7 +437,11 @@ void __devinit pci_read_bridge_bases(str
> res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
> res->start = base;
> res->end = limit + 0xfffff;
> - printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end);
> + printk(KERN_INFO "PCI: bridge %s %dbit mmio pref: [%Lx, %Lx]\n",
> + pci_name(dev),
> + res->flags & PCI_PREF_RANGE_TYPE_64 ? 64 : 32,
> + (unsigned long long)res->start,
> + (unsigned long long)res->end);
> }
> }
>
> --- linux-2.6.27-rc5/drivers/pci/setup-bus.c 2008-08-21 14:37:32.000000000 +0200
> +++ 2.6.27-rc5-pci-probe-print/drivers/pci/setup-bus.c 2008-09-02 15:18:20.000000000 +0200
> @@ -539,7 +539,11 @@ static void pci_bus_dump_res(struct pci_
> if (!res)
> continue;
>
> - printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
> + printk(KERN_INFO "bus: %02x index %x %s: [%Lx, %Lx]\n",
> + bus->number, i,
> + res->flags & IORESOURCE_IO ? "io port" : "mmio",
> + (unsigned long long)res->start,
> + (unsigned long long)res->end);
> }
> }
>
>
These have been fixed in linux-next for a month.
Jesse, can we get that into 2.6.27 please?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] fix printk format compiler warnings
2008-09-05 21:20 ` Andrew Morton
@ 2008-09-09 4:54 ` Jesse Barnes
0 siblings, 0 replies; 6+ messages in thread
From: Jesse Barnes @ 2008-09-09 4:54 UTC (permalink / raw)
To: Andrew Morton; +Cc: Jan Beulich, linux-kernel
On Friday, September 05, 2008 2:20 pm Andrew Morton wrote:
> On Fri, 05 Sep 2008 13:06:24 +0100
>
> "Jan Beulich" <jbeulich@novell.com> wrote:
> > %llx and the like cannot be used on u64-derived data types - they must
> > be cast to long long explicitly for arch-es where u64 is a typedef of
> > unsigned long (ia64 is where I observed the problem).
> >
> > Signed-off-by: Jan Beulich <jbeulich@novell.com>
> >
> > ---
> > drivers/pci/probe.c | 16 +++++++++++++---
> > drivers/pci/setup-bus.c | 6 +++++-
> > 2 files changed, 18 insertions(+), 4 deletions(-)
> >
> > --- linux-2.6.27-rc5/drivers/pci/probe.c 2008-08-21 14:37:32.000000000
> > +0200 +++ 2.6.27-rc5-pci-probe-print/drivers/pci/probe.c 2008-09-02
> > 15:18:08.000000000 +0200 @@ -383,7 +383,10 @@ void __devinit
> > pci_read_bridge_bases(str
> > res->start = base;
> > if (!res->end)
> > res->end = limit + 0xfff;
> > - printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n",
> > pci_name(dev), res->start, res->end); + printk(KERN_INFO "PCI: bridge %s
> > io port: [%Lx, %Lx]\n",
> > + pci_name(dev),
> > + (unsigned long long)res->start,
> > + (unsigned long long)res->end);
> > }
> >
> > res = child->resource[1];
> > @@ -395,7 +398,10 @@ void __devinit pci_read_bridge_bases(str
> > res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
> > IORESOURCE_MEM; res->start = base;
> > res->end = limit + 0xfffff;
> > - printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n",
> > pci_name(dev), res->start, res->end); + printk(KERN_INFO "PCI: bridge %s
> > 32bit mmio: [%Lx, %Lx]\n",
> > + pci_name(dev),
> > + (unsigned long long)res->start,
> > + (unsigned long long)res->end);
> > }
> >
> > res = child->resource[2];
> > @@ -431,7 +437,11 @@ void __devinit pci_read_bridge_bases(str
> > res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
> > IORESOURCE_MEM | IORESOURCE_PREFETCH; res->start = base;
> > res->end = limit + 0xfffff;
> > - printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n",
> > pci_name(dev), (res->flags &
> > PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end);
> > + printk(KERN_INFO "PCI: bridge %s %dbit mmio pref: [%Lx, %Lx]\n", +
> > pci_name(dev),
> > + res->flags & PCI_PREF_RANGE_TYPE_64 ? 64 : 32,
> > + (unsigned long long)res->start,
> > + (unsigned long long)res->end);
> > }
> > }
> >
> > --- linux-2.6.27-rc5/drivers/pci/setup-bus.c 2008-08-21
> > 14:37:32.000000000 +0200 +++
> > 2.6.27-rc5-pci-probe-print/drivers/pci/setup-bus.c 2008-09-02
> > 15:18:20.000000000 +0200 @@ -539,7 +539,11 @@ static void
> > pci_bus_dump_res(struct pci_
> > if (!res)
> > continue;
> >
> > - printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number,
> > i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
> > + printk(KERN_INFO "bus: %02x index %x %s: [%Lx, %Lx]\n",
> > + bus->number, i,
> > + res->flags & IORESOURCE_IO ? "io port" : "mmio",
> > + (unsigned long long)res->start,
> > + (unsigned long long)res->end);
> > }
> > }
>
> These have been fixed in linux-next for a month.
>
> Jesse, can we get that into 2.6.27 please?
I suppose. They only appear with certain configs and are fairly harmless, so
I wasn't planning on pushing them into 2.6.27. But I'll include it in my
next pull request anyway, since you're such a cool guy and I want to make you
happy :) (assuming 2.6.27 proper isn't released in the next couple of
day...)
Thanks,
Jesse
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] checkpatch: Check for %L for all integer formats (was: Re: [PATCH] fix printk format compiler warnings)
2008-09-05 12:06 [PATCH] fix printk format compiler warnings Jan Beulich
2008-09-05 21:20 ` Andrew Morton
@ 2008-09-30 11:29 ` Geert Uytterhoeven
2008-09-30 13:14 ` Andy Whitcroft
2008-09-30 15:32 ` [PATCH] checkpatch: Check for %L for all integer formats (was: " Jan Beulich
1 sibling, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2008-09-30 11:29 UTC (permalink / raw)
To: Jan Beulich, Andy Whitcroft, Randy Dunlap, Joel Schopp
Cc: Linux Kernel Development
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3042 bytes --]
On Fri, 5 Sep 2008, Jan Beulich wrote:
> %llx and the like cannot be used on u64-derived data types - they must
> be cast to long long explicitly for arch-es where u64 is a typedef of
> unsigned long (ia64 is where I observed the problem).
> - printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
> + printk(KERN_INFO "PCI: bridge %s io port: [%Lx, %Lx]\n",
> - printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
> + printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%Lx, %Lx]\n",
> - printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end);
> + printk(KERN_INFO "PCI: bridge %s %dbit mmio pref: [%Lx, %Lx]\n",
> - printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
> + printk(KERN_INFO "bus: %02x index %x %s: [%Lx, %Lx]\n",
Why did you replace `%ll' by `%L'?
While `L' is used as an internal flag in Linux' vsnprintf() implementation and
is still supported because of historical (pre-C99) reasons, the `L' conversion
qualifier is meant for the `long double' floating point type, as per C99.
The recommended conversion qualifier for the `long long' integer type is `ll'.
Perhaps checkpatch should check for this? Ah, it already does for some of the
integer formats. The patch below adds checks for the missing ones.
Subject: [PATCH] checkpatch: Check for %L for all integer formats
Checkpatch checks for the use of the non-standard `L' conversion qualifier for
some (`u', `d', and `i') of the 6 integers formats. Add the missing ones
(`o', `x', and `X'), and keep the list sorted.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bc67793..92cbf5e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2277,12 +2277,12 @@ sub process {
WARN("usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr);
}
-# check for %L{u,d,i} in strings
+# check for %L{d,i,o,u,x,X} in strings
my $string;
while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
$string = substr($rawline, $-[1], $+[1] - $-[1]);
- if ($string =~ /(?<!%)%L[udi]/) {
- WARN("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr);
+ if ($string =~ /(?<!%)%L[diouxX]/) {
+ WARN("\%L[diouxX] are not-standard C, use %ll[diouxX]\n" . $herecurr);
last;
}
}
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] checkpatch: Check for %L for all integer formats (was: Re: [PATCH] fix printk format compiler warnings)
2008-09-30 11:29 ` [PATCH] checkpatch: Check for %L for all integer formats (was: Re: [PATCH] fix printk format compiler warnings) Geert Uytterhoeven
@ 2008-09-30 13:14 ` Andy Whitcroft
2008-09-30 15:32 ` [PATCH] checkpatch: Check for %L for all integer formats (was: " Jan Beulich
1 sibling, 0 replies; 6+ messages in thread
From: Andy Whitcroft @ 2008-09-30 13:14 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Jan Beulich, Randy Dunlap, Joel Schopp, Linux Kernel Development
On Tue, Sep 30, 2008 at 01:29:44PM +0200, Geert Uytterhoeven wrote:
> On Fri, 5 Sep 2008, Jan Beulich wrote:
> > %llx and the like cannot be used on u64-derived data types - they must
> > be cast to long long explicitly for arch-es where u64 is a typedef of
> > unsigned long (ia64 is where I observed the problem).
>
> > - printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
> > + printk(KERN_INFO "PCI: bridge %s io port: [%Lx, %Lx]\n",
>
> > - printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
> > + printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%Lx, %Lx]\n",
>
> > - printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end);
> > + printk(KERN_INFO "PCI: bridge %s %dbit mmio pref: [%Lx, %Lx]\n",
>
> > - printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
> > + printk(KERN_INFO "bus: %02x index %x %s: [%Lx, %Lx]\n",
>
> Why did you replace `%ll' by `%L'?
>
> While `L' is used as an internal flag in Linux' vsnprintf() implementation and
> is still supported because of historical (pre-C99) reasons, the `L' conversion
> qualifier is meant for the `long double' floating point type, as per C99.
> The recommended conversion qualifier for the `long long' integer type is `ll'.
>
> Perhaps checkpatch should check for this? Ah, it already does for some of the
> integer formats. The patch below adds checks for the missing ones.
[...]
Yes that looks entirly reasonable to me. Will queue it up with my next
batch for Andrew.
Thanks.
-apw
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] checkpatch: Check for %L for all integer formats (was: Re:[PATCH] fix printk format compiler warnings)
2008-09-30 11:29 ` [PATCH] checkpatch: Check for %L for all integer formats (was: Re: [PATCH] fix printk format compiler warnings) Geert Uytterhoeven
2008-09-30 13:14 ` Andy Whitcroft
@ 2008-09-30 15:32 ` Jan Beulich
1 sibling, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2008-09-30 15:32 UTC (permalink / raw)
To: Joel Schopp, Andy Whitcroft, Geert Uytterhoeven, Randy Dunlap
Cc: Linux Kernel Development
>>> Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> 30.09.08 13:29 >>>
>On Fri, 5 Sep 2008, Jan Beulich wrote:
>> %llx and the like cannot be used on u64-derived data types - they must
>> be cast to long long explicitly for arch-es where u64 is a typedef of
>> unsigned long (ia64 is where I observed the problem).
>
>> - printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
>> + printk(KERN_INFO "PCI: bridge %s io port: [%Lx, %Lx]\n",
>
>> - printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end);
>> + printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%Lx, %Lx]\n",
>
>> - printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end);
>> + printk(KERN_INFO "PCI: bridge %s %dbit mmio pref: [%Lx, %Lx]\n",
>
>> - printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end);
>> + printk(KERN_INFO "bus: %02x index %x %s: [%Lx, %Lx]\n",
>
>Why did you replace `%ll' by `%L'?
Because it's one byte shorter.
>While `L' is used as an internal flag in Linux' vsnprintf() implementation and
>is still supported because of historical (pre-C99) reasons, the `L' conversion
>qualifier is meant for the `long double' floating point type, as per C99.
>The recommended conversion qualifier for the `long long' integer type is `ll'.
I understand all of this, but can't see why you would care about floating point
formats in the kernel (when specifically you know that vsnprintf() & Co aren't
able to handle it anyway).
So I think rather than widening the set of specifiers checkpatch looks for, the
check should rather be removed altogether.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-09-30 15:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-05 12:06 [PATCH] fix printk format compiler warnings Jan Beulich
2008-09-05 21:20 ` Andrew Morton
2008-09-09 4:54 ` Jesse Barnes
2008-09-30 11:29 ` [PATCH] checkpatch: Check for %L for all integer formats (was: Re: [PATCH] fix printk format compiler warnings) Geert Uytterhoeven
2008-09-30 13:14 ` Andy Whitcroft
2008-09-30 15:32 ` [PATCH] checkpatch: Check for %L for all integer formats (was: " Jan Beulich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox