aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/kconfig/confdata.c8
-rw-r--r--scripts/kconfig/expr.c16
-rw-r--r--scripts/kconfig/expr.h5
-rw-r--r--scripts/kconfig/menu.c2
-rw-r--r--scripts/kconfig/symbol.c13
5 files changed, 24 insertions, 20 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 497a19e85a07..ee5fe943d58d 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -312,7 +312,7 @@ load:
312 312
313int conf_read(const char *name) 313int conf_read(const char *name)
314{ 314{
315 struct symbol *sym; 315 struct symbol *sym, *choice_sym;
316 struct property *prop; 316 struct property *prop;
317 struct expr *e; 317 struct expr *e;
318 int i, flags; 318 int i, flags;
@@ -353,9 +353,9 @@ int conf_read(const char *name)
353 */ 353 */
354 prop = sym_get_choice_prop(sym); 354 prop = sym_get_choice_prop(sym);
355 flags = sym->flags; 355 flags = sym->flags;
356 for (e = prop->expr; e; e = e->left.expr) 356 expr_list_for_each_sym(prop->expr, e, choice_sym)
357 if (e->right.sym->visible != no) 357 if (choice_sym->visible != no)
358 flags &= e->right.sym->flags; 358 flags &= choice_sym->flags;
359 sym->flags &= flags | ~SYMBOL_DEF_USER; 359 sym->flags &= flags | ~SYMBOL_DEF_USER;
360 } 360 }
361 361
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index c8793d1d908f..13788ada5228 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -87,7 +87,7 @@ struct expr *expr_copy(struct expr *org)
87 break; 87 break;
88 case E_AND: 88 case E_AND:
89 case E_OR: 89 case E_OR:
90 case E_CHOICE: 90 case E_LIST:
91 e->left.expr = expr_copy(org->left.expr); 91 e->left.expr = expr_copy(org->left.expr);
92 e->right.expr = expr_copy(org->right.expr); 92 e->right.expr = expr_copy(org->right.expr);
93 break; 93 break;
@@ -217,7 +217,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
217 expr_free(e2); 217 expr_free(e2);
218 trans_count = old_count; 218 trans_count = old_count;
219 return res; 219 return res;
220 case E_CHOICE: 220 case E_LIST:
221 case E_RANGE: 221 case E_RANGE:
222 case E_NONE: 222 case E_NONE:
223 /* panic */; 223 /* panic */;
@@ -648,7 +648,7 @@ struct expr *expr_transform(struct expr *e)
648 case E_EQUAL: 648 case E_EQUAL:
649 case E_UNEQUAL: 649 case E_UNEQUAL:
650 case E_SYMBOL: 650 case E_SYMBOL:
651 case E_CHOICE: 651 case E_LIST:
652 break; 652 break;
653 default: 653 default:
654 e->left.expr = expr_transform(e->left.expr); 654 e->left.expr = expr_transform(e->left.expr);
@@ -932,7 +932,7 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb
932 break; 932 break;
933 case E_SYMBOL: 933 case E_SYMBOL:
934 return expr_alloc_comp(type, e->left.sym, sym); 934 return expr_alloc_comp(type, e->left.sym, sym);
935 case E_CHOICE: 935 case E_LIST:
936 case E_RANGE: 936 case E_RANGE:
937 case E_NONE: 937 case E_NONE:
938 /* panic */; 938 /* panic */;
@@ -1000,9 +1000,9 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
1000 if (t2 == E_OR) 1000 if (t2 == E_OR)
1001 return 1; 1001 return 1;
1002 case E_OR: 1002 case E_OR:
1003 if (t2 == E_CHOICE) 1003 if (t2 == E_LIST)
1004 return 1; 1004 return 1;
1005 case E_CHOICE: 1005 case E_LIST:
1006 if (t2 == 0) 1006 if (t2 == 0)
1007 return 1; 1007 return 1;
1008 default: 1008 default:
@@ -1053,11 +1053,11 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1053 fn(data, NULL, " && "); 1053 fn(data, NULL, " && ");
1054 expr_print(e->right.expr, fn, data, E_AND); 1054 expr_print(e->right.expr, fn, data, E_AND);
1055 break; 1055 break;
1056 case E_CHOICE: 1056 case E_LIST:
1057 fn(data, e->right.sym, e->right.sym->name); 1057 fn(data, e->right.sym, e->right.sym->name);
1058 if (e->left.expr) { 1058 if (e->left.expr) {
1059 fn(data, NULL, " ^ "); 1059 fn(data, NULL, " ^ ");
1060 expr_print(e->left.expr, fn, data, E_CHOICE); 1060 expr_print(e->left.expr, fn, data, E_LIST);
1061 } 1061 }
1062 break; 1062 break;
1063 case E_RANGE: 1063 case E_RANGE:
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 1ee8b1642d3b..b6f922c77e0b 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -31,7 +31,7 @@ typedef enum tristate {
31} tristate; 31} tristate;
32 32
33enum expr_type { 33enum expr_type {
34 E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE 34 E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE
35}; 35};
36 36
37union expr_data { 37union expr_data {
@@ -48,6 +48,9 @@ struct expr {
48#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) 48#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
49#define EXPR_NOT(dep) (2-(dep)) 49#define EXPR_NOT(dep) (2-(dep))
50 50
51#define expr_list_for_each_sym(l, e, s) \
52 for (e = (l); e && (s = e->right.sym); e = e->left.expr)
53
51struct expr_value { 54struct expr_value {
52 struct expr *expr; 55 struct expr *expr;
53 tristate tri; 56 tristate tri;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index e9deebe22eed..3637d1057e13 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -331,7 +331,7 @@ void menu_finalize(struct menu *parent)
331 prop = sym_get_choice_prop(sym); 331 prop = sym_get_choice_prop(sym);
332 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr) 332 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
333 ; 333 ;
334 *ep = expr_alloc_one(E_CHOICE, NULL); 334 *ep = expr_alloc_one(E_LIST, NULL);
335 (*ep)->right.sym = menu->sym; 335 (*ep)->right.sym = menu->sym;
336 } 336 }
337 if (menu->list && (!menu->prompt || !menu->prompt->text)) { 337 if (menu->list && (!menu->prompt || !menu->prompt->text)) {
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index add068c8e513..a7dfc82fc858 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -247,8 +247,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
247 247
248 /* just get the first visible value */ 248 /* just get the first visible value */
249 prop = sym_get_choice_prop(sym); 249 prop = sym_get_choice_prop(sym);
250 for (e = prop->expr; e; e = e->left.expr) { 250 expr_list_for_each_sym(prop->expr, e, def_sym) {
251 def_sym = e->right.sym;
252 sym_calc_visibility(def_sym); 251 sym_calc_visibility(def_sym);
253 if (def_sym->visible != no) 252 if (def_sym->visible != no)
254 return def_sym; 253 return def_sym;
@@ -361,12 +360,14 @@ void sym_calc_value(struct symbol *sym)
361 } 360 }
362 361
363 if (sym_is_choice(sym)) { 362 if (sym_is_choice(sym)) {
363 struct symbol *choice_sym;
364 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); 364 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
365
365 prop = sym_get_choice_prop(sym); 366 prop = sym_get_choice_prop(sym);
366 for (e = prop->expr; e; e = e->left.expr) { 367 expr_list_for_each_sym(prop->expr, e, choice_sym) {
367 e->right.sym->flags |= flags; 368 choice_sym->flags |= flags;
368 if (flags & SYMBOL_CHANGED) 369 if (flags & SYMBOL_CHANGED)
369 sym_set_changed(e->right.sym); 370 sym_set_changed(choice_sym);
370 } 371 }
371 } 372 }
372} 373}
@@ -849,7 +850,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
849struct symbol *prop_get_symbol(struct property *prop) 850struct symbol *prop_get_symbol(struct property *prop)
850{ 851{
851 if (prop->expr && (prop->expr->type == E_SYMBOL || 852 if (prop->expr && (prop->expr->type == E_SYMBOL ||
852 prop->expr->type == E_CHOICE)) 853 prop->expr->type == E_LIST))
853 return prop->expr->left.sym; 854 return prop->expr->left.sym;
854 return NULL; 855 return NULL;
855} 856}