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
Quoted 5 lines · Jaswinder Singh
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:
Quoted 1 line
2. [PATCH] x86:
process_32.cdeclarecpu_numberbefore 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:
include/linux/syscalls.h +3 -0
@@ -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
Hello Ingo,
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Jaswinder Singh
Hello Ingo,
2. [PATCH] x86:
process_32.cdeclarecpu_numberbefore they get usedwhy is
cpu_numbermoved over fromsmp.htocurrent.h? I think it's more logical insmp.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.
Quoted 23 lines
also, this change:
+++
b/include/linux/timer.hinclude/linux/syscalls.h +3
-0@@ -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:
include/linux/syscalls.h +3
-0@@ -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 */
Quoted 5 lines
i'd suggest we just do
asm-x86/syscall.handasm-x86/timer.hchanges and add #include <asm/syscall.h> and #include <asm/timer.h> to the affected x86 .c files. Once every architecture has it,linux/syscall.hcan be extended with an unconditionalasm/syscall.hinclude.
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>
Quoted 10 lines
+#ifdef
CONFIG_X86_32
extern inttimer_ack;
-extern intno_timer_check;
extern intrecalibrate_cpu_khz(void);
+#endif /*CONFIG_X86_32*/
+
+extern intno_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.
Hello Ingo,
Quoted 11 lines · Ingo Molnar
* Jaswinder Singh <[email protected]> wrote:
another thing:
include/asm-x86/signal.h +2
-0+void do_notify_resume (struct pt_regs *,void *,__u32 ); +
Quoted 4 lines
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.