common header file in sparc/kernel/ - kernel.h?
Hi Dave.
A lot of sparc code uses local extern definitions of variabels and local function prototypes. sparse is good at reporting this.
I tried to look for the right place to add these but did not really find it.
For sparc64 we have "entry.h" but that does not look like a shareable file at all.
So I'm considering creating a sparc/kernel/kernel.h for all the local definitions for this directory.
Samples:
/* from cpu.c */
extern const char *sparc_cpu_type;
extern const char *sparc_fpu_type;
extern void cpu_probe(void);
extern void clock_stop_probe(void); /* tadpole.c */ extern void sun4c_probe_memerr_reg(void);
extern void auxio_probe(void);
extern void auxio_power_probe(void);
$ grep extern *32.c | wc -l 80
Sam
From: Sam Ravnborg <[email protected]>
Date: Sat, 6 Dec 2008 09:34:16 +0100
Quoted 8 lines
A lot of sparc code uses local extern definitions of variabels and local function prototypes. sparse is good at reporting this.
I tried to look for the right place to add these but did not really find it.
For sparc64 we have "entry.h" but that does not look like a shareable file at all.
entry.h is for functions and symbols whose definition exists in assembler code on sparc64. If we wanted to do something similar for sparc32 likely we'd initially move entry.h to entry_64.h and create an entry_32.h
Quoted 2 lines
So I'm considering creating a
sparc/kernel/kernel.hfor all the local definitions for this directory.
...
Quoted 2 lines
$ grep extern *32.c | wc -l 80
If it's for 32-bit stuff, maybe give the header file a foo_32.h name? But otherwise sounds like a good idea.
For these things on the sparc64 side I just added them to the closest appropritate header in asm/*.h, there is a series of commits here and there where I addressed sparse warnings in this way. Probably "gitk arch/sparc64" would allow you to scan them quickly.
Quoted 23 lines · David Miller
From: Sam Ravnborg <[email protected]>
Date: Sat, 6 Dec 2008 09:34:16 +0100Quoted 8 lines
A lot of sparc code uses local extern definitions of variabels and local function prototypes. sparse is good at reporting this.
I tried to look for the right place to add these but did not really find it.
For sparc64 we have "entry.h" but that does not look like a shareable file at all.
entry.his for functions and symbols whose definition exists in assembler code on sparc64. If we wanted to do something similar for sparc32 likely we'd initially moveentry.htoentry_64.hand create anentry_32.hQuoted 2 lines
So I'm considering creating a
sparc/kernel/kernel.hfor all the local definitions for this directory....
Quoted 2 lines
$ grep extern *32.c | wc -l 80
Quoted 8 lines
If it's for 32-bit stuff, maybe give the header file a
foo_32.hname? But otherwise sounds like a good idea.For these things on the sparc64 side I just added them to the closest appropritate header in asm/*.h, there is a series of commits here and there where I addressed sparse warnings in this way. Probably "gitk
arch/sparc64" would allow you to scan them quickly.
I already did somthing like this and in this case the symbols was added to entry.h despite they came from a .c file. (sparc_cpu_type + sparc_fpu_type).
[note: git log --follow arch/sparc/kernel/ is your friend]
Looking at the sparse output there are addition candidates to be added to kernel.h - several being shared with sparc64.
So what I would suggest is to do the following:sparc/kernel/kernel.h for stuff from .c files sparc/kernel/entry_{32,64}.h for the assembler stuff that are 32/64 bit specific. sparc/kernel/entry.h for the common assembler stuff.
If I get around to do additional sparc unification I will try this if you do not beat me or tell me otherwise.
Sam
From: Sam Ravnborg <[email protected]>
Date: Sat, 6 Dec 2008 23:26:23 +0100
Quoted 10 lines · David Miller
Quoted 8 lines
If it's for 32-bit stuff, maybe give the header file a
foo_32.hname? But otherwise sounds like a good idea.For these things on the sparc64 side I just added them to the closest appropritate header in asm/*.h, there is a series of commits here and there where I addressed sparse warnings in this way. Probably "gitk
arch/sparc64" would allow you to scan them quickly.
Quoted 3 lines
I already did somthing like this and in this case the symbols was added to
entry.hdespite they came from a .c file. (sparc_cpu_type+sparc_fpu_type).
Indeed. And actually I got the case reversed, the problematic case is where the implementation is in *.c but all of the _callers_ are in *.S code. In this case the sparse warning is completely silly, because the whole point of the declaration is to make sure the callers and implementation agree on the arguments, but no compiler or semantic checker can verify that for C code called from assembler :-)
Quoted 5 lines
[note: git log --follow
arch/sparc/kernel/is your friend]Looking at the sparse output there are addition candidates to be added to
kernel.h- several being shared with sparc64.
Quoted 8 lines
So what I would suggest is to do the following:
sparc/kernel/kernel.hfor stuff from .c filessparc/kernel/entry_{32,64}.hfor the assembler stuff that are 32/64 bit specific.sparc/kernel/entry.hfor the common assembler stuff.If I get around to do additional sparc unification I will try this if you do not beat me or tell me otherwise.
Sounds good to me.