Re: kernel coding style for if ... else which cross #ifdef
From: Jeremy Fitzhardinge
Date: Sat May 24 2008 - 11:46:32 EST
Sam Ravnborg wrote:
We should actually do as you intially suggested and alwyas
define CONFIG_FOO no matter if FOO is built-in or module.
Because we do only want to distingush between the two in rare cases.
But that is a separate patch and lets not do the same
mistage with CFG_*
I think pretty strongly that CFG_ and CONFIG_ should be exactly
parallel. If you want to change the meaning of CONFIG_X in the presence
of modules, then change CFG_X at the same time. Making them have
different meanings will just confuse anyone wanting to convert #ifdef
CONFIG_ code into if(CFG_) code.
I cooked up following patch - but I have not test-build a kernel yet.
We may use CFG_* here and there and clash is not good.
I have to say I'm not very keen on the CFG_* prefix. It doesn't have
any inherent meaning and just looks like a redundant abbreviation of
CONFIG_; something which actually expresses the notion that it's always
a compile-time constant would be better. Not that I have any
particularly good alternatives: CONST_? CCONST_? CONFIG_X_VAL? KCONFIG_?
KONFIG_? KCONST_?
J
--
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/