aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 43eda40c3838..c55c227af463 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1040,7 +1040,7 @@ void conf_set_changed_callback(void (*fn)(void))
1040 conf_changed_callback = fn; 1040 conf_changed_callback = fn;
1041} 1041}
1042 1042
1043static void randomize_choice_values(struct symbol *csym) 1043static bool randomize_choice_values(struct symbol *csym)
1044{ 1044{
1045 struct property *prop; 1045 struct property *prop;
1046 struct symbol *sym; 1046 struct symbol *sym;
@@ -1053,7 +1053,7 @@ static void randomize_choice_values(struct symbol *csym)
1053 * In both cases stop. 1053 * In both cases stop.
1054 */ 1054 */
1055 if (csym->curr.tri != yes) 1055 if (csym->curr.tri != yes)
1056 return; 1056 return false;
1057 1057
1058 prop = sym_get_choice_prop(csym); 1058 prop = sym_get_choice_prop(csym);
1059 1059
@@ -1077,13 +1077,18 @@ static void randomize_choice_values(struct symbol *csym)
1077 else { 1077 else {
1078 sym->def[S_DEF_USER].tri = no; 1078 sym->def[S_DEF_USER].tri = no;
1079 } 1079 }
1080 sym->flags |= SYMBOL_DEF_USER;
1081 /* clear VALID to get value calculated */
1082 sym->flags &= ~SYMBOL_VALID;
1080 } 1083 }
1081 csym->flags |= SYMBOL_DEF_USER; 1084 csym->flags |= SYMBOL_DEF_USER;
1082 /* clear VALID to get value calculated */ 1085 /* clear VALID to get value calculated */
1083 csym->flags &= ~(SYMBOL_VALID); 1086 csym->flags &= ~(SYMBOL_VALID);
1087
1088 return true;
1084} 1089}
1085 1090
1086static void set_all_choice_values(struct symbol *csym) 1091void set_all_choice_values(struct symbol *csym)
1087{ 1092{
1088 struct property *prop; 1093 struct property *prop;
1089 struct symbol *sym; 1094 struct symbol *sym;
@@ -1100,10 +1105,10 @@ static void set_all_choice_values(struct symbol *csym)
1100 } 1105 }
1101 csym->flags |= SYMBOL_DEF_USER; 1106 csym->flags |= SYMBOL_DEF_USER;
1102 /* clear VALID to get value calculated */ 1107 /* clear VALID to get value calculated */
1103 csym->flags &= ~(SYMBOL_VALID); 1108 csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES);
1104} 1109}
1105 1110
1106void conf_set_all_new_symbols(enum conf_def_mode mode) 1111bool conf_set_all_new_symbols(enum conf_def_mode mode)
1107{ 1112{
1108 struct symbol *sym, *csym; 1113 struct symbol *sym, *csym;
1109 int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y 1114 int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y
@@ -1151,6 +1156,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
1151 exit( 1 ); 1156 exit( 1 );
1152 } 1157 }
1153 } 1158 }
1159 bool has_changed = false;
1154 1160
1155 for_all_symbols(i, sym) { 1161 for_all_symbols(i, sym) {
1156 if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID)) 1162 if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
@@ -1158,6 +1164,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
1158 switch (sym_get_type(sym)) { 1164 switch (sym_get_type(sym)) {
1159 case S_BOOLEAN: 1165 case S_BOOLEAN:
1160 case S_TRISTATE: 1166 case S_TRISTATE:
1167 has_changed = true;
1161 switch (mode) { 1168 switch (mode) {
1162 case def_yes: 1169 case def_yes:
1163 sym->def[S_DEF_USER].tri = yes; 1170 sym->def[S_DEF_USER].tri = yes;
@@ -1202,14 +1209,26 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
1202 * selected in a choice block and we set it to yes, 1209 * selected in a choice block and we set it to yes,
1203 * and the rest to no. 1210 * and the rest to no.
1204 */ 1211 */
1212 if (mode != def_random) {
1213 for_all_symbols(i, csym) {
1214 if ((sym_is_choice(csym) && !sym_has_value(csym)) ||
1215 sym_is_choice_value(csym))
1216 csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES;
1217 }
1218 }
1219
1205 for_all_symbols(i, csym) { 1220 for_all_symbols(i, csym) {
1206 if (sym_has_value(csym) || !sym_is_choice(csym)) 1221 if (sym_has_value(csym) || !sym_is_choice(csym))
1207 continue; 1222 continue;
1208 1223
1209 sym_calc_value(csym); 1224 sym_calc_value(csym);
1210 if (mode == def_random) 1225 if (mode == def_random)
1211 randomize_choice_values(csym); 1226 has_changed = randomize_choice_values(csym);
1212 else 1227 else {
1213 set_all_choice_values(csym); 1228 set_all_choice_values(csym);
1229 has_changed = true;
1230 }
1214 } 1231 }
1232
1233 return has_changed;
1215} 1234}