Re: [PATCH]: Prevent sn2 ptc code from executing on all ia64 subarches

Luck, Tony
2005-12-13T17:57:50Z

On Tue, Dec 13, 2005 at 10:42:28AM -0500, Prarit Bhargava wrote:
> Therefore the could would be something like (this is based off the existing
> do_initcalls)
>
> for (call = __initcall_start, platform = __platform_start;
> call < __initcall_end; call++, platform++) {

Running two separate parallel structures seems complex.
Why not make the entries in the .initcall sections be tuples
instead of just being an array:

struct initcalls {
initcall_t call;
#ifdef CONFIG_PLATFORM_SPECIFIC_INIT
char *platform;
#endif
};

#ifndef CONFIG_PLATFORM_SPECIFIC_INIT
#define arch_match(str) 1
old definition of __define_initcall (modified for structure}
#else
new definition of __define_initcall initializes to "{ fn, 0 }"
plus a __define_initcall_platform() that takes the extra arg
and initializes to "{ fn, plat }"
#endif

Then the do_initcalls loop looks like this:

struct initcalls *call;

for (call = __initcall_start; call < __initcall_end; call++) {
if (!arch_match(call->platform))
continue;
(*call->call)();

...
}

-Tony