Re: [PATCH][RFC] disable built-in modules V2

From: Magnus Damm
Date: Thu Apr 07 2005 - 16:34:49 EST


On Apr 7, 2005 4:38 AM, Horst von Brand <vonbrand@xxxxxxxxxxxx> wrote:
> AsterixTheGaul <asterixthegaul@xxxxxxxxx> said:
> > > -#define module_init(x) __initcall(x);
> > > +#define module_init(x) __initcall(x); __module_init_disable(x);
> >
> > It would be better if there is brackets around them... like
> >
> > #define module_init(x) { __initcall(x); __module_init_disable(x); }
> >
> > then we know it wont break some code like
> >
> > if (..)
> > module_init(x);
>
> But happily break:
>
> if (...)
> module_init(x);
> else
> ...
>
> This should be:
>
> #define module_init(x) do {__initcall(x); __module_init_disable(x);}while(0)

Yes and no. =) Wrapping defines in do {} while(0) is nice when you are
using the defined constants inside functions. module_init() OTOH is
never used inside a function and your suggestion leads to compile
errors:

CC arch/i386/kernel/dmi_scan.o
CC arch/i386/kernel/bootflag.o
arch/i386/kernel/bootflag.c:99: error: parse error before "do"
arch/i386/kernel/bootflag.c:99: error: parse error before '}' token
make[1]: *** [arch/i386/kernel/bootflag.o] Error 1
make: *** [arch/i386/kernel] Error 2
damm@clementine linux-2.6.12-rc2-disable_builtin $

/ magnus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/