2008-07-21 17:48:24

by Jaswinder Singh Rajput

[permalink] [raw]
Subject: [git pull] x86: declaration fixes

Hello Ingo,

Please pull the declaration fixes for x86-tip from :

git://git.infradead.org/users/jaswinder/linux-2.6-tip.git

This includes following patches after commit 087115517d43c2 (Merge branch 'xen-64bit') :-

1. [PATCH] x86: Introducing asm/syscalls.h
2. [PATCH] x86: process_32.c declare cpu_number before they get used
3. [PATCH] x86: signal_XX.c declare do_notify_resume before they get used
4. [PATCH] x86: time_XX.c declare functions before they get used
5. [PATCH] x86: setup.c declare saved_video_mode before they get used
6. [PATCH] x86: e820.c declare pci_mem_start before they get used
7. [PATCH] x86: pci-dma.c declare iommu_bio_merge before they get used
8. [PATCH] x86: pci-nommu.c declare nommu_dma_ops before they get used
9. [PATCH] x86: i387.c declare dump_fpu() before they get used
10. [PATCH] x86: ptrace.c declare functions before they get used
11. [PATCH] x86: proc.c declare cpuinfo_op before they get used
12. [PATCH] x86: common.c declare idle_regs before they get used
13. [PATCH] x86: mtrr/main.c declare range_state as static


Thank you,

Jaswinder Singh


2008-07-21 18:05:10

by Ingo Molnar

[permalink] [raw]
Subject: Re: [git pull] x86: declaration fixes


* Jaswinder Singh <[email protected]> wrote:

> Hello Ingo,
>
> Please pull the declaration fixes for x86-tip from :
>
> git://git.infradead.org/users/jaswinder/linux-2.6-tip.git

pulled this into tip/x86/prototypes, thanks Jaswinder.

Btw., when sending pull requests it's best to use git-request-pull. I.e.
something like:

git-request-pull tip/master git://git.infradead.org/users/jaswinder/linux-2.6-tip.git

would have generated the proper output.

The changes still need some fixing though. For example, this change:

> 2. [PATCH] x86: process_32.c declare cpu_number before they get used

why is cpu_number moved over from smp.h to current.h? I think it's more
logical in smp.h. If it's missing somewhere then add an #include
<asm/smp.h> to that file?

also, this change:

+++ b/include/linux/timer.h
@@ -6,6 +6,10 @@
#include <linux/stddef.h>
#include <linux/debugobjects.h>

+#ifdef CONFIG_X86
+#include <asm/timer.h>
+#endif /* CONFIG_X86 */

is not really acceptable in a generic header, nor is:

--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -65,6 +67,10 @@ struct getcpu_cache;
#include <linux/quota.h>
#include <linux/key.h>

+#ifdef CONFIG_X86
+#include <asm/syscalls.h>
+#endif /* CONFIG_X86 */

i'd suggest we just do asm-x86/syscall.h and asm-x86/timer.h changes and
add #include <asm/syscall.h> and #include <asm/timer.h> to the affected
x86 .c files. Once every architecture has it, linux/syscall.h can be
extended with an unconditional asm/syscall.h include.

Or, like Matthew has suggested, a 'complete' collection of all syscalls
should be assembled into linux/syscall.h. In that case it has extra
documentation value if there's an #ifdef CONFIG_X86 for certain
syscalls. (say the LDT or VM86 syscalls make only sense on x86
platforms)

another thing:

--- a/include/asm-x86/signal.h
+++ b/include/asm-x86/signal.h

+void do_notify_resume(struct pt_regs *, void *, __u32);
+

please add "extern" to each such prototype declaration. (the same is
true for a handful of other prototypes you've added - please re-review
and fix them)

+#ifdef CONFIG_X86_32
extern int timer_ack;
-extern int no_timer_check;
extern int recalibrate_cpu_khz(void);
+#endif /* CONFIG_X86_32 */
+
+extern int no_timer_check;

hm, why was this needed?

Ingo

2008-07-22 03:19:46

by Jaswinder Singh Rajput

[permalink] [raw]
Subject: Re: [git pull] x86: declaration fixes

Hello Ingo,

On Mon, 2008-07-21 at 20:04 +0200, Ingo Molnar wrote:
> * Jaswinder Singh <[email protected]> wrote:
>
> > Hello Ingo,
> >
> > 2. [PATCH] x86: process_32.c declare cpu_number before they get used
>
> why is cpu_number moved over from smp.h to current.h? I think it's more
> logical in smp.h. If it's missing somewhere then add an #include
> <asm/smp.h> to that file?
>

Because cpu_number is used by everyone independent of smp.

In smp.h It was declared under #ifdef CONFIG_X86_32_SMP which was wrong.

> also, this change:
>
> +++ b/include/linux/timer.h
> @@ -6,6 +6,10 @@
> #include <linux/stddef.h>
> #include <linux/debugobjects.h>
>
> +#ifdef CONFIG_X86
> +#include <asm/timer.h>
> +#endif /* CONFIG_X86 */
>
> is not really acceptable in a generic header, nor is:
>
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -65,6 +67,10 @@ struct getcpu_cache;
> #include <linux/quota.h>
> #include <linux/key.h>
>
> +#ifdef CONFIG_X86
> +#include <asm/syscalls.h>
> +#endif /* CONFIG_X86 */
>
> i'd suggest we just do asm-x86/syscall.h and asm-x86/timer.h changes and
> add #include <asm/syscall.h> and #include <asm/timer.h> to the affected
> x86 .c files. Once every architecture has it, linux/syscall.h can be
> extended with an unconditional asm/syscall.h include.
>

Because checkpatch.pl raise objection for it.

$ ./scripts/checkpatch.pl ../test.patch
WARNING: Use #include <linux/timer.h> instead of <asm/timer.h>
#9: FILE: arch/x86/kernel/time_32.c:40:
+#include <asm/timer.h>


> +#ifdef CONFIG_X86_32
> extern int timer_ack;
> -extern int no_timer_check;
> extern int recalibrate_cpu_khz(void);
> +#endif /* CONFIG_X86_32 */
> +
> +extern int no_timer_check;
>
> hm, why was this needed?
>

Because timer_ack is only required for X86_32
and int recalibrate_cpu_khz(void) is declared inside #ifdef
CONFIG_X86_32 in arch/x86/kernel/tsc.c

Thank you,

Jaswinder Singh.

2008-07-22 05:58:22

by Jaswinder Singh Rajput

[permalink] [raw]
Subject: Re: [git pull] x86: declaration fixes

Hello Ingo,

On Mon, 2008-07-21 at 20:04 +0200, Ingo Molnar wrote:
> * Jaswinder Singh <[email protected]> wrote:
>

> another thing:
>
> --- a/include/asm-x86/signal.h
> +++ b/include/asm-x86/signal.h
>
> +void do_notify_resume(struct pt_regs *, void *, __u32);
> +
>
> please add "extern" to each such prototype declaration. (the same is
> true for a handful of other prototypes you've added - please re-review
> and fix them)
>

I was trying to follow other functions declaration in the file.

function declaration without extern :-

http://git.infradead.org/users/jaswinder/linux-2.6-tip.git?a=commitdiff;h=f740a1e1bbee2ce8a0b1b97361771db40afc37d2
http://git.infradead.org/users/jaswinder/linux-2.6-tip.git?a=commitdiff;h=b7b5113220da95eaa8b75ebd5bbd5278eed122e5

function declaration with extern :-

http://git.infradead.org/users/jaswinder/linux-2.6-tip.git?a=commitdiff;h=8cac4294a5e9b036c30d30e2e894e74201ee1c6b
http://git.infradead.org/users/jaswinder/linux-2.6-tip.git?a=commitdiff;h=e7d3d48dbf3e517e2e827a2adc6a2f861b16e6a6
http://git.infradead.org/users/jaswinder/linux-2.6-tip.git?a=commitdiff;h=feb49274338051ddf11d16f67b08ee6cafb32dbf

But you are emphasizing to use extern for all function declarations.

With current gcc, I think using extern with function declaration is :-
1. Wastage of time
2. Wastage of energy
3. Increase file size with 7 bytes for each extern.

If there is any secret behind using extern in kernel header files.
Please let me know.

Thank you,

Jaswinder Singh.