Commit bfc10001 authored by Karsten Wiese's avatar Karsten Wiese Committed by Linus Torvalds

[PATCH] kconfig: make sym_change_count static, let it be altered by 2 functions only

Those two functions are
	void sym_set_change_count(int count)
and
	void sym_add_change_count(int count)

All write accesses to sym_change_count are replaced by calls to above
functions.

Variable and changer-functions are moved to confdata.c.  IMO thats ok, as
sym_change_count is an attribute of the .config's change state.
Signed-off-by: default avatarKarsten Wiese <fzu@wemgehoertderstaat.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Acked-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b3214293
...@@ -100,7 +100,7 @@ int conf_read_simple(const char *name, int def) ...@@ -100,7 +100,7 @@ int conf_read_simple(const char *name, int def)
in = zconf_fopen(name); in = zconf_fopen(name);
if (in) if (in)
goto load; goto load;
sym_change_count++; sym_add_change_count(1);
if (!sym_defconfig_list) if (!sym_defconfig_list)
return 1; return 1;
...@@ -312,7 +312,7 @@ int conf_read(const char *name) ...@@ -312,7 +312,7 @@ int conf_read(const char *name)
struct expr *e; struct expr *e;
int i, flags; int i, flags;
sym_change_count = 0; sym_set_change_count(0);
if (conf_read_simple(name, S_DEF_USER)) if (conf_read_simple(name, S_DEF_USER))
return 1; return 1;
...@@ -364,7 +364,7 @@ int conf_read(const char *name) ...@@ -364,7 +364,7 @@ int conf_read(const char *name)
sym->flags &= flags | ~SYMBOL_DEF_USER; sym->flags &= flags | ~SYMBOL_DEF_USER;
} }
sym_change_count += conf_warnings || conf_unsaved; sym_add_change_count(conf_warnings || conf_unsaved);
return 0; return 0;
} }
...@@ -528,7 +528,7 @@ int conf_write(const char *name) ...@@ -528,7 +528,7 @@ int conf_write(const char *name)
"# configuration written to %s\n" "# configuration written to %s\n"
"#\n"), newname); "#\n"), newname);
sym_change_count = 0; sym_set_change_count(0);
return 0; return 0;
} }
...@@ -766,6 +766,18 @@ int conf_write_autoconf(void) ...@@ -766,6 +766,18 @@ int conf_write_autoconf(void)
return 0; return 0;
} }
static int sym_change_count;
void sym_set_change_count(int count)
{
sym_change_count = count;
}
void sym_add_change_count(int count)
{
sym_change_count += count;
}
bool conf_get_changed(void) bool conf_get_changed(void)
{ {
return sym_change_count; return sym_change_count;
......
...@@ -65,6 +65,8 @@ char *zconf_curname(void); ...@@ -65,6 +65,8 @@ char *zconf_curname(void);
/* confdata.c */ /* confdata.c */
char *conf_get_default_confname(void); char *conf_get_default_confname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
/* kconfig_load.c */ /* kconfig_load.c */
void kconfig_load(void); void kconfig_load(void);
......
...@@ -17,7 +17,6 @@ P(menu_get_parent_menu,struct menu *,(struct menu *menu)); ...@@ -17,7 +17,6 @@ P(menu_get_parent_menu,struct menu *,(struct menu *menu));
/* symbol.c */ /* symbol.c */
P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
P(sym_change_count,int,);
P(sym_lookup,struct symbol *,(const char *name, int isconst)); P(sym_lookup,struct symbol *,(const char *name, int isconst));
P(sym_find,struct symbol *,(const char *name)); P(sym_find,struct symbol *,(const char *name));
......
...@@ -30,7 +30,6 @@ struct symbol symbol_yes = { ...@@ -30,7 +30,6 @@ struct symbol symbol_yes = {
.flags = SYMBOL_VALID, .flags = SYMBOL_VALID,
}; };
int sym_change_count;
struct symbol *sym_defconfig_list; struct symbol *sym_defconfig_list;
struct symbol *modules_sym; struct symbol *modules_sym;
tristate modules_val; tristate modules_val;
...@@ -379,7 +378,7 @@ void sym_clear_all_valid(void) ...@@ -379,7 +378,7 @@ void sym_clear_all_valid(void)
for_all_symbols(i, sym) for_all_symbols(i, sym)
sym->flags &= ~SYMBOL_VALID; sym->flags &= ~SYMBOL_VALID;
sym_change_count++; sym_add_change_count(1);
if (modules_sym) if (modules_sym)
sym_calc_value(modules_sym); sym_calc_value(modules_sym);
} }
......
...@@ -2135,7 +2135,7 @@ void conf_parse(const char *name) ...@@ -2135,7 +2135,7 @@ void conf_parse(const char *name)
sym_check_deps(sym); sym_check_deps(sym);
} }
sym_change_count = 1; sym_set_change_count(1);
} }
const char *zconf_tokenname(int token) const char *zconf_tokenname(int token)
......
...@@ -504,7 +504,7 @@ void conf_parse(const char *name) ...@@ -504,7 +504,7 @@ void conf_parse(const char *name)
sym_check_deps(sym); sym_check_deps(sym);
} }
sym_change_count = 1; sym_set_change_count(1);
} }
const char *zconf_tokenname(int token) const char *zconf_tokenname(int token)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment