* __kernel_suseconds_t is int on PA-RISC (and SPARC64)?
@ 2008-08-26 20:11 Geert Uytterhoeven
2008-08-26 20:24 ` Helge Deller
2008-08-26 20:50 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2008-08-26 20:11 UTC (permalink / raw)
To: linux-parisc; +Cc: Linux/m68k, Linux Kernel Development
Apparently __kernel_suseconds_t is `int' on PA-RISC (and on SPARC64),
while it's `long' on all other platforms.
Is there a specific reason for that?
This causes compiler warnings in the HP SDC Real Time Clock driver,
which is shared between PA-RISC and m68k:
drivers/input/misc/hp_sdc_rtc.c:461: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:461: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:468: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:468: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:475: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:475: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:482: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:482: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:489: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
drivers/input/misc/hp_sdc_rtc.c:489: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __kernel_suseconds_t is int on PA-RISC (and SPARC64)?
2008-08-26 20:11 __kernel_suseconds_t is int on PA-RISC (and SPARC64)? Geert Uytterhoeven
@ 2008-08-26 20:24 ` Helge Deller
2008-09-04 20:40 ` Geert Uytterhoeven
2008-08-26 20:50 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Helge Deller @ 2008-08-26 20:24 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-parisc, Linux/m68k, Linux Kernel Development
Geert Uytterhoeven wrote:
> Apparently __kernel_suseconds_t is `int' on PA-RISC (and on SPARC64),
> while it's `long' on all other platforms.
>
> Is there a specific reason for that?
I don't know for sure, but arch/parisc/kernel/syscall_table.S states:
/* even though manpage says struct timeval contains longs, ours has
* time_t and suseconds_t -- both of which are safe wide/narrow */
ENTRY_COMP(setitimer)
So it was probably chosen to be int so that it can be easily used in 32-
and 64bit kernels (or compat code).
Helge
> This causes compiler warnings in the HP SDC Real Time Clock driver,
> which is shared between PA-RISC and m68k:
>
> drivers/input/misc/hp_sdc_rtc.c:461: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:461: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:468: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:468: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:475: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:475: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:482: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:482: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:489: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
> drivers/input/misc/hp_sdc_rtc.c:489: warning: format '%02d' expects type 'int', but argument 4 has type 'long int'
>
> Gr{oetje,eeting}s,
>
> Geert
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __kernel_suseconds_t is int on PA-RISC (and SPARC64)?
2008-08-26 20:11 __kernel_suseconds_t is int on PA-RISC (and SPARC64)? Geert Uytterhoeven
2008-08-26 20:24 ` Helge Deller
@ 2008-08-26 20:50 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2008-08-26 20:50 UTC (permalink / raw)
To: geert; +Cc: linux-parisc, linux-m68k, linux-kernel
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Tue, 26 Aug 2008 22:11:25 +0200 (CEST)
> Apparently __kernel_suseconds_t is `int' on PA-RISC (and on SPARC64),
> while it's `long' on all other platforms.
>
> Is there a specific reason for that?
An existing API probably decided it for us :-)
Anyways, no use in wondering why, it can't be changed at this point.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __kernel_suseconds_t is int on PA-RISC (and SPARC64)?
2008-08-26 20:24 ` Helge Deller
@ 2008-09-04 20:40 ` Geert Uytterhoeven
2008-09-04 21:03 ` Helge Deller
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2008-09-04 20:40 UTC (permalink / raw)
To: Helge Deller; +Cc: linux-parisc, Linux/m68k, Linux Kernel Development
On Tue, 26 Aug 2008, Helge Deller wrote:
> Geert Uytterhoeven wrote:
> > Apparently __kernel_suseconds_t is `int' on PA-RISC (and on SPARC64),
> > while it's `long' on all other platforms.
> >
> > Is there a specific reason for that?
>
> I don't know for sure, but arch/parisc/kernel/syscall_table.S states:
> /* even though manpage says struct timeval contains longs, ours has
> * time_t and suseconds_t -- both of which are safe wide/narrow */
> ENTRY_COMP(setitimer)
>
> So it was probably chosen to be int so that it can be easily used in 32- and
> 64bit kernels (or compat code).
>
> > This causes compiler warnings in the HP SDC Real Time Clock driver,
> > which is shared between PA-RISC and m68k:
Here's a patch to fix the compiler warnings. Is this OK for PA-RISC?
SUbject: [PATCH] HP input: kill warnings due to suseconds_t differences
Kill compiler warnings related to printf() formats in the input drivers for
various HP9000 machines, which are shared between PA-RISC (suseconds_t is int)
and m68k (suseconds_t is long). As both are 32-bit, it's safe to cast to int.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/input/misc/hp_sdc_rtc.c | 10 +++++-----
drivers/input/serio/hp_sdc.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -458,35 +458,35 @@ static int hp_sdc_rtc_proc_output (char
p += sprintf(p, "i8042 rtc\t: READ FAILED!\n");
} else {
p += sprintf(p, "i8042 rtc\t: %ld.%02d seconds\n",
- tv.tv_sec, tv.tv_usec/1000);
+ tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_fhs(&tv)) {
p += sprintf(p, "handshake\t: READ FAILED!\n");
} else {
p += sprintf(p, "handshake\t: %ld.%02d seconds\n",
- tv.tv_sec, tv.tv_usec/1000);
+ tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_mt(&tv)) {
p += sprintf(p, "alarm\t\t: READ FAILED!\n");
} else {
p += sprintf(p, "alarm\t\t: %ld.%02d seconds\n",
- tv.tv_sec, tv.tv_usec/1000);
+ tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_dt(&tv)) {
p += sprintf(p, "delay\t\t: READ FAILED!\n");
} else {
p += sprintf(p, "delay\t\t: %ld.%02d seconds\n",
- tv.tv_sec, tv.tv_usec/1000);
+ tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_ct(&tv)) {
p += sprintf(p, "periodic\t: READ FAILED!\n");
} else {
p += sprintf(p, "periodic\t: %ld.%02d seconds\n",
- tv.tv_sec, tv.tv_usec/1000);
+ tv.tv_sec, (int)tv.tv_usec/1000);
}
p += sprintf(p,
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -323,7 +323,7 @@ static void hp_sdc_tasklet(unsigned long
* it back to the application. and be less verbose.
*/
printk(KERN_WARNING PREFIX "read timeout (%ius)!\n",
- tv.tv_usec - hp_sdc.rtv.tv_usec);
+ (int)(tv.tv_usec - hp_sdc.rtv.tv_usec));
curr->idx += hp_sdc.rqty;
hp_sdc.rqty = 0;
tmp = curr->seq[curr->actidx];
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: __kernel_suseconds_t is int on PA-RISC (and SPARC64)?
2008-09-04 20:40 ` Geert Uytterhoeven
@ 2008-09-04 21:03 ` Helge Deller
0 siblings, 0 replies; 5+ messages in thread
From: Helge Deller @ 2008-09-04 21:03 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-parisc, Linux/m68k, Linux Kernel Development
Geert Uytterhoeven wrote:
> On Tue, 26 Aug 2008, Helge Deller wrote:
>> Geert Uytterhoeven wrote:
>>> Apparently __kernel_suseconds_t is `int' on PA-RISC (and on SPARC64),
>>> while it's `long' on all other platforms.
>>>
>>> Is there a specific reason for that?
>> I don't know for sure, but arch/parisc/kernel/syscall_table.S states:
>> /* even though manpage says struct timeval contains longs, ours has
>> * time_t and suseconds_t -- both of which are safe wide/narrow */
>> ENTRY_COMP(setitimer)
>>
>> So it was probably chosen to be int so that it can be easily used in 32- and
>> 64bit kernels (or compat code).
>>
>>> This causes compiler warnings in the HP SDC Real Time Clock driver,
>>> which is shared between PA-RISC and m68k:
>
> Here's a patch to fix the compiler warnings. Is this OK for PA-RISC?
>
> SUbject: [PATCH] HP input: kill warnings due to suseconds_t differences
>
> Kill compiler warnings related to printf() formats in the input drivers for
> various HP9000 machines, which are shared between PA-RISC (suseconds_t is int)
> and m68k (suseconds_t is long). As both are 32-bit, it's safe to cast to int.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Thanks Geert.
Tested and OK for PA-RISC.
Acked-by: Helge Deller <deller@gmx.de>
> ---
> drivers/input/misc/hp_sdc_rtc.c | 10 +++++-----
> drivers/input/serio/hp_sdc.c | 2 +-
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> --- a/drivers/input/misc/hp_sdc_rtc.c
> +++ b/drivers/input/misc/hp_sdc_rtc.c
> @@ -458,35 +458,35 @@ static int hp_sdc_rtc_proc_output (char
> p += sprintf(p, "i8042 rtc\t: READ FAILED!\n");
> } else {
> p += sprintf(p, "i8042 rtc\t: %ld.%02d seconds\n",
> - tv.tv_sec, tv.tv_usec/1000);
> + tv.tv_sec, (int)tv.tv_usec/1000);
> }
>
> if (hp_sdc_rtc_read_fhs(&tv)) {
> p += sprintf(p, "handshake\t: READ FAILED!\n");
> } else {
> p += sprintf(p, "handshake\t: %ld.%02d seconds\n",
> - tv.tv_sec, tv.tv_usec/1000);
> + tv.tv_sec, (int)tv.tv_usec/1000);
> }
>
> if (hp_sdc_rtc_read_mt(&tv)) {
> p += sprintf(p, "alarm\t\t: READ FAILED!\n");
> } else {
> p += sprintf(p, "alarm\t\t: %ld.%02d seconds\n",
> - tv.tv_sec, tv.tv_usec/1000);
> + tv.tv_sec, (int)tv.tv_usec/1000);
> }
>
> if (hp_sdc_rtc_read_dt(&tv)) {
> p += sprintf(p, "delay\t\t: READ FAILED!\n");
> } else {
> p += sprintf(p, "delay\t\t: %ld.%02d seconds\n",
> - tv.tv_sec, tv.tv_usec/1000);
> + tv.tv_sec, (int)tv.tv_usec/1000);
> }
>
> if (hp_sdc_rtc_read_ct(&tv)) {
> p += sprintf(p, "periodic\t: READ FAILED!\n");
> } else {
> p += sprintf(p, "periodic\t: %ld.%02d seconds\n",
> - tv.tv_sec, tv.tv_usec/1000);
> + tv.tv_sec, (int)tv.tv_usec/1000);
> }
>
> p += sprintf(p,
> --- a/drivers/input/serio/hp_sdc.c
> +++ b/drivers/input/serio/hp_sdc.c
> @@ -323,7 +323,7 @@ static void hp_sdc_tasklet(unsigned long
> * it back to the application. and be less verbose.
> */
> printk(KERN_WARNING PREFIX "read timeout (%ius)!\n",
> - tv.tv_usec - hp_sdc.rtv.tv_usec);
> + (int)(tv.tv_usec - hp_sdc.rtv.tv_usec));
> curr->idx += hp_sdc.rqty;
> hp_sdc.rqty = 0;
> tmp = curr->seq[curr->actidx];
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-04 21:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-26 20:11 __kernel_suseconds_t is int on PA-RISC (and SPARC64)? Geert Uytterhoeven
2008-08-26 20:24 ` Helge Deller
2008-09-04 20:40 ` Geert Uytterhoeven
2008-09-04 21:03 ` Helge Deller
2008-08-26 20:50 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox