Skip to content

Commit bfc1000

Browse files
Karsten WieseLinus Torvalds
authored andcommitted
[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: Karsten Wiese <fzu@wemgehoertderstaat.de> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent b321429 commit bfc1000

6 files changed

Lines changed: 21 additions & 9 deletions

File tree

‎scripts/kconfig/confdata.c‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int conf_read_simple(const char *name, int def)
100100
in = zconf_fopen(name);
101101
if (in)
102102
goto load;
103-
sym_change_count++;
103+
sym_add_change_count(1);
104104
if (!sym_defconfig_list)
105105
return 1;
106106

@@ -312,7 +312,7 @@ int conf_read(const char *name)
312312
struct expr *e;
313313
int i, flags;
314314

315-
sym_change_count = 0;
315+
sym_set_change_count(0);
316316

317317
if (conf_read_simple(name, S_DEF_USER))
318318
return 1;
@@ -364,7 +364,7 @@ int conf_read(const char *name)
364364
sym->flags &= flags | ~SYMBOL_DEF_USER;
365365
}
366366

367-
sym_change_count += conf_warnings || conf_unsaved;
367+
sym_add_change_count(conf_warnings || conf_unsaved);
368368

369369
return 0;
370370
}
@@ -528,7 +528,7 @@ int conf_write(const char *name)
528528
"# configuration written to %s\n"
529529
"#\n"), newname);
530530

531-
sym_change_count = 0;
531+
sym_set_change_count(0);
532532

533533
return 0;
534534
}
@@ -766,6 +766,18 @@ int conf_write_autoconf(void)
766766
return 0;
767767
}
768768

769+
static int sym_change_count;
770+
771+
void sym_set_change_count(int count)
772+
{
773+
sym_change_count = count;
774+
}
775+
776+
void sym_add_change_count(int count)
777+
{
778+
sym_change_count += count;
779+
}
780+
769781
bool conf_get_changed(void)
770782
{
771783
return sym_change_count;

‎scripts/kconfig/lkc.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ char *zconf_curname(void);
6565

6666
/* confdata.c */
6767
char *conf_get_default_confname(void);
68+
void sym_set_change_count(int count);
69+
void sym_add_change_count(int count);
6870

6971
/* kconfig_load.c */
7072
void kconfig_load(void);

‎scripts/kconfig/lkc_proto.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ P(menu_get_parent_menu,struct menu *,(struct menu *menu));
1717

1818
/* symbol.c */
1919
P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
20-
P(sym_change_count,int,);
2120

2221
P(sym_lookup,struct symbol *,(const char *name, int isconst));
2322
P(sym_find,struct symbol *,(const char *name));

‎scripts/kconfig/symbol.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ struct symbol symbol_yes = {
3030
.flags = SYMBOL_VALID,
3131
};
3232

33-
int sym_change_count;
3433
struct symbol *sym_defconfig_list;
3534
struct symbol *modules_sym;
3635
tristate modules_val;
@@ -379,7 +378,7 @@ void sym_clear_all_valid(void)
379378

380379
for_all_symbols(i, sym)
381380
sym->flags &= ~SYMBOL_VALID;
382-
sym_change_count++;
381+
sym_add_change_count(1);
383382
if (modules_sym)
384383
sym_calc_value(modules_sym);
385384
}

‎scripts/kconfig/zconf.tab.c_shipped‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ void conf_parse(const char *name)
21352135
sym_check_deps(sym);
21362136
}
21372137

2138-
sym_change_count = 1;
2138+
sym_set_change_count(1);
21392139
}
21402140

21412141
const char *zconf_tokenname(int token)

‎scripts/kconfig/zconf.y‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void conf_parse(const char *name)
504504
sym_check_deps(sym);
505505
}
506506

507-
sym_change_count = 1;
507+
sym_set_change_count(1);
508508
}
509509

510510
const char *zconf_tokenname(int token)

0 commit comments

Comments
 (0)