Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[sfrench/cifs-2.6.git] / scripts / kconfig / symbol.c
index 3929e5b35e79db7dc0d03083aabaa988e10e1992..4a03191ad17676105395c83564a78f8502dc51e4 100644 (file)
@@ -298,22 +298,30 @@ void sym_calc_value(struct symbol *sym)
                if (sym_is_choice_value(sym) && sym->visible == yes) {
                        prop = sym_get_choice_prop(sym);
                        newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
-               } else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) {
-                       sym->flags |= SYMBOL_WRITE;
-                       if (sym_has_value(sym))
-                               newval.tri = sym->def[S_DEF_USER].tri;
-                       else if (!sym_is_choice(sym)) {
-                               prop = sym_get_default_prop(sym);
-                               if (prop)
-                                       newval.tri = expr_calc_value(prop->expr);
+               } else {
+                       if (sym->visible != no) {
+                               /* if the symbol is visible use the user value
+                                * if available, otherwise try the default value
+                                */
+                               sym->flags |= SYMBOL_WRITE;
+                               if (sym_has_value(sym)) {
+                                       newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
+                                                             sym->visible);
+                                       goto calc_newval;
+                               }
                        }
-                       newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri);
-               } else if (!sym_is_choice(sym)) {
-                       prop = sym_get_default_prop(sym);
-                       if (prop) {
+                       if (sym->rev_dep.tri != no)
                                sym->flags |= SYMBOL_WRITE;
-                               newval.tri = expr_calc_value(prop->expr);
+                       if (!sym_is_choice(sym)) {
+                               prop = sym_get_default_prop(sym);
+                               if (prop) {
+                                       sym->flags |= SYMBOL_WRITE;
+                                       newval.tri = EXPR_AND(expr_calc_value(prop->expr),
+                                                             prop->visible.tri);
+                               }
                        }
+               calc_newval:
+                       newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
                }
                if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
                        newval.tri = yes;