mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 09:00:54 +07:00
kconfig: autogenerated config_is_xxx macro
this will allow to use to use if(config_is_xxx()) if(config_is_xxx_module()) in the code instead of #ifdef CONFIG_xxx #ifdef CONFIG_xxx_MODULE and now let the compiler remove the non usefull code and not the pre-processor as done in the mach-types for arm as exmaple Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Acked-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
parent
76ce94a371
commit
de125187dc
@ -778,6 +778,29 @@ static int conf_split_config(void)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void conf_write_function_autoconf(FILE *out, char* conf, char* name,
|
||||||
|
int val)
|
||||||
|
{
|
||||||
|
char c;
|
||||||
|
char *tmp, *d;
|
||||||
|
|
||||||
|
d = strdup(conf);
|
||||||
|
tmp = d;
|
||||||
|
while ((c = *conf++))
|
||||||
|
*d++ = tolower(c);
|
||||||
|
|
||||||
|
fprintf(out, "#define %sis_", tmp);
|
||||||
|
free(tmp);
|
||||||
|
|
||||||
|
d = strdup(name);
|
||||||
|
tmp = d;
|
||||||
|
while ((c = *name++))
|
||||||
|
*d++ = tolower(c);
|
||||||
|
fprintf(out, "%s%s() %d\n", tmp, (val > 1) ? "_module" : "",
|
||||||
|
val ? 1 : 0);
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
int conf_write_autoconf(void)
|
int conf_write_autoconf(void)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
@ -785,6 +808,7 @@ int conf_write_autoconf(void)
|
|||||||
const char *name;
|
const char *name;
|
||||||
FILE *out, *tristate, *out_h;
|
FILE *out, *tristate, *out_h;
|
||||||
int i;
|
int i;
|
||||||
|
int fct_val;
|
||||||
|
|
||||||
sym_clear_all_valid();
|
sym_clear_all_valid();
|
||||||
|
|
||||||
@ -825,6 +849,7 @@ int conf_write_autoconf(void)
|
|||||||
rootmenu.prompt->text);
|
rootmenu.prompt->text);
|
||||||
|
|
||||||
for_all_symbols(i, sym) {
|
for_all_symbols(i, sym) {
|
||||||
|
fct_val = 1;
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
|
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
|
||||||
continue;
|
continue;
|
||||||
@ -838,12 +863,14 @@ int conf_write_autoconf(void)
|
|||||||
case S_TRISTATE:
|
case S_TRISTATE:
|
||||||
switch (sym_get_tristate_value(sym)) {
|
switch (sym_get_tristate_value(sym)) {
|
||||||
case no:
|
case no:
|
||||||
|
fct_val = 0;
|
||||||
break;
|
break;
|
||||||
case mod:
|
case mod:
|
||||||
fprintf(tristate, "%s%s=M\n",
|
fprintf(tristate, "%s%s=M\n",
|
||||||
CONFIG_, sym->name);
|
CONFIG_, sym->name);
|
||||||
fprintf(out_h, "#define %s%s_MODULE 1\n",
|
fprintf(out_h, "#define %s%s_MODULE 1\n",
|
||||||
CONFIG_, sym->name);
|
CONFIG_, sym->name);
|
||||||
|
fct_val = 2;
|
||||||
break;
|
break;
|
||||||
case yes:
|
case yes:
|
||||||
if (sym->type == S_TRISTATE)
|
if (sym->type == S_TRISTATE)
|
||||||
@ -870,8 +897,10 @@ int conf_write_autoconf(void)
|
|||||||
CONFIG_, sym->name, str);
|
CONFIG_, sym->name, str);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
fct_val = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
conf_write_function_autoconf(out_h, CONFIG_, sym->name, fct_val);
|
||||||
}
|
}
|
||||||
fclose(out);
|
fclose(out);
|
||||||
fclose(tristate);
|
fclose(tristate);
|
||||||
|
Loading…
Reference in New Issue
Block a user