Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for .c files

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Sam Ravnborg
Date: Saturday, May 24, 2008 - 1:24 pm

On Sat, May 24, 2008 at 12:53:16PM -0700, Andrew Morton wrote:
It would have helped if I had applied the correct patch...
All boolean and tristate symbols in the konfiguration have
their symbols defined as KCONFIG_* no matter their values.
So KCONFIG_DVB_VES1820 would get defined.

Correct patch below.

	Sam

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index ee5fe94..247ea30 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -666,6 +666,43 @@ out:
 	return res;
 }
 
+static void write_tristate_config(FILE *m, FILE *h, struct symbol *sym)
+{
+	switch (sym_get_tristate_value(sym)) {
+	case mod:
+		fprintf(m, "CONFIG_%s=m\n", sym->name);
+		fprintf(h, "#define CONFIG_%s_MODULE 1\n", sym->name);
+		break;
+	case yes:
+		fprintf(m, "CONFIG_%s=y\n", sym->name);
+		fprintf(h, "#define CONFIG_%s 1\n", sym->name);
+		break;
+	case no:
+		break;
+	}
+}
+
+static void write_tristate_kconfig(FILE *f, struct symbol *sym)
+{
+	switch (sym_get_tristate_value(sym)) {
+	case mod:
+		fprintf(f, "#define KCONFIG_%s 1\n", sym->name);
+		if (sym->type == S_TRISTATE)
+			fprintf(f, "#define KCONFIG_%s_MODULE 1\n", sym->name);
+		break;
+	case yes:
+		fprintf(f, "#define KCONFIG_%s 1\n", sym->name);
+		if (sym->type == S_TRISTATE)
+			fprintf(f, "#define KCONFIG_%s_MODULE 0\n", sym->name);
+		break;
+	case no:
+		fprintf(f, "#define KCONFIG_%s 0\n", sym->name);
+		if (sym->type == S_TRISTATE)
+			fprintf(f, "#define KCONFIG_%s_MODULE 0\n", sym->name);
+		break;
+	}
+}
+
 int conf_write_autoconf(void)
 {
 	struct symbol *sym;
@@ -716,18 +753,7 @@ int conf_write_autoconf(void)
 		switch (sym->type) {
 		case S_BOOLEAN:
 		case S_TRISTATE:
-			switch (sym_get_tristate_value(sym)) {
-			case no:
-				break;
-			case mod:
-				fprintf(out, "CONFIG_%s=m\n", sym->name);
-				fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
-				break;
-			case yes:
-				fprintf(out, "CONFIG_%s=y\n", sym->name);
-				fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
-				break;
-			}
+			write_tristate_config(out, out_h, sym);
 			break;
 		case S_STRING:
 			str = sym_get_string_value(sym);
@@ -765,6 +791,19 @@ int conf_write_autoconf(void)
 			break;
 		}
 	}
+	for_all_symbols(i, sym) {
+		sym_calc_value(sym);
+		if (!sym->name)
+			continue;
+		switch (sym->type) {
+		case S_BOOLEAN:
+		case S_TRISTATE:
+			write_tristate_kconfig(out_h, sym);
+			break;
+		default:
+			break;
+		}
+	}
 	fclose(out);
 	fclose(out_h);
 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for . ..., Jeremy Fitzhardinge, (Sat May 24, 1:14 pm)
Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for . ..., Sam Ravnborg, (Sat May 24, 1:24 pm)
[PATCH] x86: use defconfig as last resort, Sam Ravnborg, (Sat May 24, 1:37 pm)
Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for . ..., Jeremy Fitzhardinge, (Sat May 24, 1:48 pm)
Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for . ..., Jeremy Fitzhardinge, (Sat May 24, 1:56 pm)
Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for . ..., Jeremy Fitzhardinge, (Sat May 24, 1:58 pm)
Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for . ..., Jeremy Fitzhardinge, (Sat May 24, 2:13 pm)
Re: [PATCH] x86: use defconfig as last resort, Linus Torvalds, (Sat May 24, 6:30 pm)
Re: [PATCH] x86: use defconfig as last resort, Sam Ravnborg, (Sat May 24, 11:15 pm)
Re: [PATCH] x86: use defconfig as last resort, Sam Ravnborg, (Sat May 24, 11:22 pm)