Re: [PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-24 Thread Sam Ravnborg
On Thu, Jan 24, 2008 at 11:57:03AM +, Jan Beulich wrote:
> >menu_finalize as it stand today is already too complicated.
> >
> >Could we have this additional functionlity factored out or at least commented
> >so mare humans have a small chance to understand what is going on.
> 
> I'd prefer leaving the factoring-out to Roman, in fear of breaking
> something if I do it myself. I sent out an updated patch just a second
> ago, which adds a comment as you requested and also fixes another
> problem (not one the patch introduced) that utilizing the new
> functionality elsewhere uncovered.

Thanks - I will give Roman a few days and if I see no complains
then I will add it to kbuild.git.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-24 Thread Jan Beulich
>menu_finalize as it stand today is already too complicated.
>
>Could we have this additional functionlity factored out or at least commented
>so mare humans have a small chance to understand what is going on.

I'd prefer leaving the factoring-out to Roman, in fear of breaking
something if I do it myself. I sent out an updated patch just a second
ago, which adds a comment as you requested and also fixes another
problem (not one the patch introduced) that utilizing the new
functionality elsewhere uncovered.

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tristate choices with mixed tristate and boolean values (v3)

2008-01-24 Thread Jan Beulich
Change kconfig behavior so that mixing bool and tristate config
settings in a choice is possible and has the desired effect of offering
just the tristate options individually if the choice gets set to M, and
a normal boolean selection if the choice gets set to Y.

Also fix scripts/kconfig/conf's handling of children of choice values -
there may be more than one immediate child, and all of them need to be
processed.

Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>

---
 scripts/kconfig/conf.c |4 ++--
 scripts/kconfig/expr.c |   10 --
 scripts/kconfig/menu.c |   33 ++---
 3 files changed, 45 insertions(+), 7 deletions(-)

--- linux-2.6.24-rc8/scripts/kconfig/conf.c
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/conf.c
@@ -399,9 +399,9 @@ static int conf_choice(struct menu *menu
continue;
}
sym_set_choice_value(sym, child->sym);
-   if (child->list) {
+   for (child = child->list; child; child = child->next) {
indent += 2;
-   conf(child->list);
+   conf(child);
indent -= 2;
}
return 1;
--- linux-2.6.24-rc8/scripts/kconfig/expr.c
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/expr.c
@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*f
expr_print(e->left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
-   fn(data, e->left.sym, e->left.sym->name);
+   if (e->left.sym->name)
+   fn(data, e->left.sym, e->left.sym->name);
+   else
+   fn(data, NULL, "");
fn(data, NULL, "=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_UNEQUAL:
-   fn(data, e->left.sym, e->left.sym->name);
+   if (e->left.sym->name)
+   fn(data, e->left.sym, e->left.sym->name);
+   else
+   fn(data, NULL, "");
fn(data, NULL, "!=");
fn(data, e->right.sym, e->right.sym->name);
break;
--- linux-2.6.24-rc8/scripts/kconfig/menu.c
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/menu.c
@@ -239,9 +239,11 @@ void menu_finalize(struct menu *parent)
for (menu = parent->list; menu; menu = menu->next) {
if (menu->sym) {
current_entry = parent;
-   menu_set_type(menu->sym->type);
+   if (sym->type == S_UNKNOWN)
+   menu_set_type(menu->sym->type);
current_entry = menu;
-   menu_set_type(sym->type);
+   if (menu->sym->type == S_UNKNOWN)
+   menu_set_type(sym->type);
break;
}
}
@@ -326,7 +328,37 @@ void menu_finalize(struct menu *parent)
"values not supported");
}
current_entry = menu;
-   menu_set_type(sym->type);
+   if (menu->sym->type == S_UNKNOWN)
+   menu_set_type(sym->type);
+   /* Non-tristate choice values of tristate choices must
+* depend on the choice being set to Y. The choice
+* values' dependencies were propagated to their
+* properties above, so the change here must be re-
+* propagated. */
+   if (sym->type == S_TRISTATE && menu->sym->type != 
S_TRISTATE) {
+   basedep = expr_alloc_comp(E_EQUAL, sym, 
_yes);
+   basedep = expr_alloc_and(basedep, menu->dep);
+   basedep = expr_eliminate_dups(basedep);
+   menu->dep = basedep;
+   for (prop = menu->sym->prop; prop; prop = 
prop->next) {
+   if (prop->menu != menu)
+   continue;
+   dep = expr_alloc_and(expr_copy(basedep),
+
prop->visible.expr);
+   dep = expr_eliminate_dups(dep);
+   dep = expr_trans_bool(dep);
+   prop->visible.expr = dep;
+   if (prop->type == P_SELECT) {
+   struct symbol *es = 

[PATCH] tristate choices with mixed tristate and boolean values (v3)

2008-01-24 Thread Jan Beulich
Change kconfig behavior so that mixing bool and tristate config
settings in a choice is possible and has the desired effect of offering
just the tristate options individually if the choice gets set to M, and
a normal boolean selection if the choice gets set to Y.

Also fix scripts/kconfig/conf's handling of children of choice values -
there may be more than one immediate child, and all of them need to be
processed.

Signed-off-by: Jan Beulich [EMAIL PROTECTED]

---
 scripts/kconfig/conf.c |4 ++--
 scripts/kconfig/expr.c |   10 --
 scripts/kconfig/menu.c |   33 ++---
 3 files changed, 45 insertions(+), 7 deletions(-)

--- linux-2.6.24-rc8/scripts/kconfig/conf.c
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/conf.c
@@ -399,9 +399,9 @@ static int conf_choice(struct menu *menu
continue;
}
sym_set_choice_value(sym, child-sym);
-   if (child-list) {
+   for (child = child-list; child; child = child-next) {
indent += 2;
-   conf(child-list);
+   conf(child);
indent -= 2;
}
return 1;
--- linux-2.6.24-rc8/scripts/kconfig/expr.c
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/expr.c
@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*f
expr_print(e-left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
-   fn(data, e-left.sym, e-left.sym-name);
+   if (e-left.sym-name)
+   fn(data, e-left.sym, e-left.sym-name);
+   else
+   fn(data, NULL, choice);
fn(data, NULL, =);
fn(data, e-right.sym, e-right.sym-name);
break;
case E_UNEQUAL:
-   fn(data, e-left.sym, e-left.sym-name);
+   if (e-left.sym-name)
+   fn(data, e-left.sym, e-left.sym-name);
+   else
+   fn(data, NULL, choice);
fn(data, NULL, !=);
fn(data, e-right.sym, e-right.sym-name);
break;
--- linux-2.6.24-rc8/scripts/kconfig/menu.c
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/menu.c
@@ -239,9 +239,11 @@ void menu_finalize(struct menu *parent)
for (menu = parent-list; menu; menu = menu-next) {
if (menu-sym) {
current_entry = parent;
-   menu_set_type(menu-sym-type);
+   if (sym-type == S_UNKNOWN)
+   menu_set_type(menu-sym-type);
current_entry = menu;
-   menu_set_type(sym-type);
+   if (menu-sym-type == S_UNKNOWN)
+   menu_set_type(sym-type);
break;
}
}
@@ -326,7 +328,37 @@ void menu_finalize(struct menu *parent)
values not supported);
}
current_entry = menu;
-   menu_set_type(sym-type);
+   if (menu-sym-type == S_UNKNOWN)
+   menu_set_type(sym-type);
+   /* Non-tristate choice values of tristate choices must
+* depend on the choice being set to Y. The choice
+* values' dependencies were propagated to their
+* properties above, so the change here must be re-
+* propagated. */
+   if (sym-type == S_TRISTATE  menu-sym-type != 
S_TRISTATE) {
+   basedep = expr_alloc_comp(E_EQUAL, sym, 
symbol_yes);
+   basedep = expr_alloc_and(basedep, menu-dep);
+   basedep = expr_eliminate_dups(basedep);
+   menu-dep = basedep;
+   for (prop = menu-sym-prop; prop; prop = 
prop-next) {
+   if (prop-menu != menu)
+   continue;
+   dep = expr_alloc_and(expr_copy(basedep),
+
prop-visible.expr);
+   dep = expr_eliminate_dups(dep);
+   dep = expr_trans_bool(dep);
+   prop-visible.expr = dep;
+   if (prop-type == P_SELECT) {
+   struct symbol *es = 
prop_get_symbol(prop);
+ 

Re: [PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-24 Thread Jan Beulich
menu_finalize as it stand today is already too complicated.

Could we have this additional functionlity factored out or at least commented
so mare humans have a small chance to understand what is going on.

I'd prefer leaving the factoring-out to Roman, in fear of breaking
something if I do it myself. I sent out an updated patch just a second
ago, which adds a comment as you requested and also fixes another
problem (not one the patch introduced) that utilizing the new
functionality elsewhere uncovered.

Jan

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-24 Thread Sam Ravnborg
On Thu, Jan 24, 2008 at 11:57:03AM +, Jan Beulich wrote:
 menu_finalize as it stand today is already too complicated.
 
 Could we have this additional functionlity factored out or at least commented
 so mare humans have a small chance to understand what is going on.
 
 I'd prefer leaving the factoring-out to Roman, in fear of breaking
 something if I do it myself. I sent out an updated patch just a second
 ago, which adds a comment as you requested and also fixes another
 problem (not one the patch introduced) that utilizing the new
 functionality elsewhere uncovered.

Thanks - I will give Roman a few days and if I see no complains
then I will add it to kbuild.git.

Sam
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-23 Thread Sam Ravnborg
On Wed, Jan 23, 2008 at 04:44:40PM +, Jan Beulich wrote:
> Change kconfig behavior so that mixing bool and tristate config
> settings in a choice is possible and has the desired effect of offering
> just the tristate options individually if the choice gets set to M, and
> a normal boolean selection if the choice gets set to Y.
> 
> Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>
> 
> ---
>  scripts/kconfig/expr.c |   10 --
>  scripts/kconfig/menu.c |   33 ++---
>  2 files changed, 38 insertions(+), 5 deletions(-)
> 
> --- linux-2.6.24-rc8/scripts/kconfig/expr.c   2006-09-20 05:42:06.0 
> +0200
> +++ 2.6.24-rc8-tristate-choices/scripts/kconfig/expr.c2008-01-21 
> 13:32:44.0 +0100
> @@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*f
>   expr_print(e->left.expr, fn, data, E_NOT);
>   break;
>   case E_EQUAL:
> - fn(data, e->left.sym, e->left.sym->name);
> + if (e->left.sym->name)
> + fn(data, e->left.sym, e->left.sym->name);
> + else
> + fn(data, NULL, "");
>   fn(data, NULL, "=");
>   fn(data, e->right.sym, e->right.sym->name);
>   break;
>   case E_UNEQUAL:
> - fn(data, e->left.sym, e->left.sym->name);
> + if (e->left.sym->name)
> + fn(data, e->left.sym, e->left.sym->name);
> + else
> + fn(data, NULL, "");
>   fn(data, NULL, "!=");
>   fn(data, e->right.sym, e->right.sym->name);
>   break;
> --- linux-2.6.24-rc8/scripts/kconfig/menu.c   2007-10-09 22:31:38.0 
> +0200
> +++ 2.6.24-rc8-tristate-choices/scripts/kconfig/menu.c2008-01-22 
> 09:36:59.0 +0100
> @@ -239,9 +239,11 @@ void menu_finalize(struct menu *parent)
>   for (menu = parent->list; menu; menu = menu->next) {
>   if (menu->sym) {
>   current_entry = parent;
> - menu_set_type(menu->sym->type);
> + if (sym->type == S_UNKNOWN)
> + menu_set_type(menu->sym->type);
>   current_entry = menu;
> - menu_set_type(sym->type);
> + if (menu->sym->type == S_UNKNOWN)
> + menu_set_type(sym->type);
>   break;
>   }
>   }
> @@ -326,7 +328,32 @@ void menu_finalize(struct menu *parent)
>   "values not supported");
>   }
>   current_entry = menu;
> - menu_set_type(sym->type);
> + if (menu->sym->type == S_UNKNOWN)
> + menu_set_type(sym->type);
> + if (sym->type == S_TRISTATE && menu->sym->type != 
> S_TRISTATE) {
> + basedep = expr_alloc_comp(E_EQUAL, sym, 
> _yes);
> + basedep = expr_alloc_and(basedep, menu->dep);
> + basedep = expr_eliminate_dups(basedep);
> + menu->dep = basedep;
> + for (prop = menu->sym->prop; prop; prop = 
> prop->next) {
> + if (prop->menu != menu)
> + continue;
> + dep = expr_alloc_and(expr_copy(basedep),
> +  
> prop->visible.expr);
> + dep = expr_eliminate_dups(dep);
> + dep = expr_trans_bool(dep);
> + prop->visible.expr = dep;
> + if (prop->type == P_SELECT) {
> + struct symbol *es = 
> prop_get_symbol(prop);
> + dep2 = 
> expr_alloc_symbol(menu->sym);
> + dep = expr_alloc_and(dep2,
> +  
> expr_copy(dep));
> + dep = 
> expr_alloc_or(es->rev_dep.expr, dep);
> + dep = expr_eliminate_dups(dep);
> + es->rev_dep.expr = dep;
> + }
> + }
> + }
>   menu_add_symbol(P_CHOICE, sym, NULL);
>   prop = sym_get_choice_prop(sym);
>   for (ep = >expr; *ep; ep = &(*ep)->left.expr)
menu_finalize as it 

[PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-23 Thread Jan Beulich
Change kconfig behavior so that mixing bool and tristate config
settings in a choice is possible and has the desired effect of offering
just the tristate options individually if the choice gets set to M, and
a normal boolean selection if the choice gets set to Y.

Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>

---
 scripts/kconfig/expr.c |   10 --
 scripts/kconfig/menu.c |   33 ++---
 2 files changed, 38 insertions(+), 5 deletions(-)

--- linux-2.6.24-rc8/scripts/kconfig/expr.c 2006-09-20 05:42:06.0 
+0200
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/expr.c  2008-01-21 
13:32:44.0 +0100
@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*f
expr_print(e->left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
-   fn(data, e->left.sym, e->left.sym->name);
+   if (e->left.sym->name)
+   fn(data, e->left.sym, e->left.sym->name);
+   else
+   fn(data, NULL, "");
fn(data, NULL, "=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_UNEQUAL:
-   fn(data, e->left.sym, e->left.sym->name);
+   if (e->left.sym->name)
+   fn(data, e->left.sym, e->left.sym->name);
+   else
+   fn(data, NULL, "");
fn(data, NULL, "!=");
fn(data, e->right.sym, e->right.sym->name);
break;
--- linux-2.6.24-rc8/scripts/kconfig/menu.c 2007-10-09 22:31:38.0 
+0200
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/menu.c  2008-01-22 
09:36:59.0 +0100
@@ -239,9 +239,11 @@ void menu_finalize(struct menu *parent)
for (menu = parent->list; menu; menu = menu->next) {
if (menu->sym) {
current_entry = parent;
-   menu_set_type(menu->sym->type);
+   if (sym->type == S_UNKNOWN)
+   menu_set_type(menu->sym->type);
current_entry = menu;
-   menu_set_type(sym->type);
+   if (menu->sym->type == S_UNKNOWN)
+   menu_set_type(sym->type);
break;
}
}
@@ -326,7 +328,32 @@ void menu_finalize(struct menu *parent)
"values not supported");
}
current_entry = menu;
-   menu_set_type(sym->type);
+   if (menu->sym->type == S_UNKNOWN)
+   menu_set_type(sym->type);
+   if (sym->type == S_TRISTATE && menu->sym->type != 
S_TRISTATE) {
+   basedep = expr_alloc_comp(E_EQUAL, sym, 
_yes);
+   basedep = expr_alloc_and(basedep, menu->dep);
+   basedep = expr_eliminate_dups(basedep);
+   menu->dep = basedep;
+   for (prop = menu->sym->prop; prop; prop = 
prop->next) {
+   if (prop->menu != menu)
+   continue;
+   dep = expr_alloc_and(expr_copy(basedep),
+
prop->visible.expr);
+   dep = expr_eliminate_dups(dep);
+   dep = expr_trans_bool(dep);
+   prop->visible.expr = dep;
+   if (prop->type == P_SELECT) {
+   struct symbol *es = 
prop_get_symbol(prop);
+   dep2 = 
expr_alloc_symbol(menu->sym);
+   dep = expr_alloc_and(dep2,
+
expr_copy(dep));
+   dep = 
expr_alloc_or(es->rev_dep.expr, dep);
+   dep = expr_eliminate_dups(dep);
+   es->rev_dep.expr = dep;
+   }
+   }
+   }
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = >expr; *ep; ep = &(*ep)->left.expr)



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  

[PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-23 Thread Jan Beulich
Change kconfig behavior so that mixing bool and tristate config
settings in a choice is possible and has the desired effect of offering
just the tristate options individually if the choice gets set to M, and
a normal boolean selection if the choice gets set to Y.

Signed-off-by: Jan Beulich [EMAIL PROTECTED]

---
 scripts/kconfig/expr.c |   10 --
 scripts/kconfig/menu.c |   33 ++---
 2 files changed, 38 insertions(+), 5 deletions(-)

--- linux-2.6.24-rc8/scripts/kconfig/expr.c 2006-09-20 05:42:06.0 
+0200
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/expr.c  2008-01-21 
13:32:44.0 +0100
@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*f
expr_print(e-left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
-   fn(data, e-left.sym, e-left.sym-name);
+   if (e-left.sym-name)
+   fn(data, e-left.sym, e-left.sym-name);
+   else
+   fn(data, NULL, choice);
fn(data, NULL, =);
fn(data, e-right.sym, e-right.sym-name);
break;
case E_UNEQUAL:
-   fn(data, e-left.sym, e-left.sym-name);
+   if (e-left.sym-name)
+   fn(data, e-left.sym, e-left.sym-name);
+   else
+   fn(data, NULL, choice);
fn(data, NULL, !=);
fn(data, e-right.sym, e-right.sym-name);
break;
--- linux-2.6.24-rc8/scripts/kconfig/menu.c 2007-10-09 22:31:38.0 
+0200
+++ 2.6.24-rc8-tristate-choices/scripts/kconfig/menu.c  2008-01-22 
09:36:59.0 +0100
@@ -239,9 +239,11 @@ void menu_finalize(struct menu *parent)
for (menu = parent-list; menu; menu = menu-next) {
if (menu-sym) {
current_entry = parent;
-   menu_set_type(menu-sym-type);
+   if (sym-type == S_UNKNOWN)
+   menu_set_type(menu-sym-type);
current_entry = menu;
-   menu_set_type(sym-type);
+   if (menu-sym-type == S_UNKNOWN)
+   menu_set_type(sym-type);
break;
}
}
@@ -326,7 +328,32 @@ void menu_finalize(struct menu *parent)
values not supported);
}
current_entry = menu;
-   menu_set_type(sym-type);
+   if (menu-sym-type == S_UNKNOWN)
+   menu_set_type(sym-type);
+   if (sym-type == S_TRISTATE  menu-sym-type != 
S_TRISTATE) {
+   basedep = expr_alloc_comp(E_EQUAL, sym, 
symbol_yes);
+   basedep = expr_alloc_and(basedep, menu-dep);
+   basedep = expr_eliminate_dups(basedep);
+   menu-dep = basedep;
+   for (prop = menu-sym-prop; prop; prop = 
prop-next) {
+   if (prop-menu != menu)
+   continue;
+   dep = expr_alloc_and(expr_copy(basedep),
+
prop-visible.expr);
+   dep = expr_eliminate_dups(dep);
+   dep = expr_trans_bool(dep);
+   prop-visible.expr = dep;
+   if (prop-type == P_SELECT) {
+   struct symbol *es = 
prop_get_symbol(prop);
+   dep2 = 
expr_alloc_symbol(menu-sym);
+   dep = expr_alloc_and(dep2,
+
expr_copy(dep));
+   dep = 
expr_alloc_or(es-rev_dep.expr, dep);
+   dep = expr_eliminate_dups(dep);
+   es-rev_dep.expr = dep;
+   }
+   }
+   }
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = prop-expr; *ep; ep = (*ep)-left.expr)



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read 

Re: [PATCH] tristate choices with mixed tristate and boolean values (v2)

2008-01-23 Thread Sam Ravnborg
On Wed, Jan 23, 2008 at 04:44:40PM +, Jan Beulich wrote:
 Change kconfig behavior so that mixing bool and tristate config
 settings in a choice is possible and has the desired effect of offering
 just the tristate options individually if the choice gets set to M, and
 a normal boolean selection if the choice gets set to Y.
 
 Signed-off-by: Jan Beulich [EMAIL PROTECTED]
 
 ---
  scripts/kconfig/expr.c |   10 --
  scripts/kconfig/menu.c |   33 ++---
  2 files changed, 38 insertions(+), 5 deletions(-)
 
 --- linux-2.6.24-rc8/scripts/kconfig/expr.c   2006-09-20 05:42:06.0 
 +0200
 +++ 2.6.24-rc8-tristate-choices/scripts/kconfig/expr.c2008-01-21 
 13:32:44.0 +0100
 @@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*f
   expr_print(e-left.expr, fn, data, E_NOT);
   break;
   case E_EQUAL:
 - fn(data, e-left.sym, e-left.sym-name);
 + if (e-left.sym-name)
 + fn(data, e-left.sym, e-left.sym-name);
 + else
 + fn(data, NULL, choice);
   fn(data, NULL, =);
   fn(data, e-right.sym, e-right.sym-name);
   break;
   case E_UNEQUAL:
 - fn(data, e-left.sym, e-left.sym-name);
 + if (e-left.sym-name)
 + fn(data, e-left.sym, e-left.sym-name);
 + else
 + fn(data, NULL, choice);
   fn(data, NULL, !=);
   fn(data, e-right.sym, e-right.sym-name);
   break;
 --- linux-2.6.24-rc8/scripts/kconfig/menu.c   2007-10-09 22:31:38.0 
 +0200
 +++ 2.6.24-rc8-tristate-choices/scripts/kconfig/menu.c2008-01-22 
 09:36:59.0 +0100
 @@ -239,9 +239,11 @@ void menu_finalize(struct menu *parent)
   for (menu = parent-list; menu; menu = menu-next) {
   if (menu-sym) {
   current_entry = parent;
 - menu_set_type(menu-sym-type);
 + if (sym-type == S_UNKNOWN)
 + menu_set_type(menu-sym-type);
   current_entry = menu;
 - menu_set_type(sym-type);
 + if (menu-sym-type == S_UNKNOWN)
 + menu_set_type(sym-type);
   break;
   }
   }
 @@ -326,7 +328,32 @@ void menu_finalize(struct menu *parent)
   values not supported);
   }
   current_entry = menu;
 - menu_set_type(sym-type);
 + if (menu-sym-type == S_UNKNOWN)
 + menu_set_type(sym-type);
 + if (sym-type == S_TRISTATE  menu-sym-type != 
 S_TRISTATE) {
 + basedep = expr_alloc_comp(E_EQUAL, sym, 
 symbol_yes);
 + basedep = expr_alloc_and(basedep, menu-dep);
 + basedep = expr_eliminate_dups(basedep);
 + menu-dep = basedep;
 + for (prop = menu-sym-prop; prop; prop = 
 prop-next) {
 + if (prop-menu != menu)
 + continue;
 + dep = expr_alloc_and(expr_copy(basedep),
 +  
 prop-visible.expr);
 + dep = expr_eliminate_dups(dep);
 + dep = expr_trans_bool(dep);
 + prop-visible.expr = dep;
 + if (prop-type == P_SELECT) {
 + struct symbol *es = 
 prop_get_symbol(prop);
 + dep2 = 
 expr_alloc_symbol(menu-sym);
 + dep = expr_alloc_and(dep2,
 +  
 expr_copy(dep));
 + dep = 
 expr_alloc_or(es-rev_dep.expr, dep);
 + dep = expr_eliminate_dups(dep);
 + es-rev_dep.expr = dep;
 + }
 + }
 + }
   menu_add_symbol(P_CHOICE, sym, NULL);
   prop = sym_get_choice_prop(sym);
   for (ep = prop-expr; *ep; ep = (*ep)-left.expr)
menu_finalize as it stand today is already too complicated.

Could we have this additional functionlity factored out or at least commented
so mare humans have a small 

Re: [PATCH] tristate choices with mixed tristate and boolean values

2007-09-17 Thread Jan Beulich
>>> Roman Zippel <[EMAIL PROTECTED]> 16.09.07 19:29 >>>
>On Mon, 10 Sep 2007, Jan Beulich wrote:
>
>> --- linux-2.6.23-rc5/scripts/kconfig/menu.c  2007-09-07 16:48:23.0 
>> +0200
>> +++ 2.6.23-rc5-tristate-choices/scripts/kconfig/menu.c   2007-09-03 
>> 10:29:41.0 +0200
>> @@ -235,16 +235,23 @@ void menu_finalize(struct menu *parent)
>>  sym = parent->sym;
>>  if (parent->list) {
>>  if (sym && sym_is_choice(sym)) {
>> -/* find the first choice value and find out choice type 
>> */
>> +/* find out choice type */
>> +enum symbol_type type = S_UNKNOWN;
>> +
>>  for (menu = parent->list; menu; menu = menu->next) {
>> -if (menu->sym) {
>> -current_entry = parent;
>> -menu_set_type(menu->sym->type);
>> -current_entry = menu;
>> -menu_set_type(sym->type);
>> -break;
>> +if (menu->sym && menu->sym->type != S_UNKNOWN) {
>> +if (type == S_UNKNOWN)
>> +type = menu->sym->type;
>> +if (type != S_BOOLEAN)
>> +break;
>> +if (menu->sym->type == S_TRISTATE) {
>> +type = S_TRISTATE;
>> +break;
>> +}
>>  }
>>  }
>> +current_entry = parent;
>> +menu_set_type(type);
>>  parentdep = expr_alloc_symbol(sym);
>>  } else if (parent->prompt)
>>  parentdep = parent->prompt->visible.expr;
>
>If I understand it correctly this makes possible to override the type of 
>choice symbol, so this loop should only be done if the type is not 
>S_UNKNOWN.

I think it is better to do it this way, as it results in a (correct) warning 
from
menu_set_type() if the choice type is inconsistently being overridden.

>> @@ -253,7 +260,16 @@ void menu_finalize(struct menu *parent)
>>  
>>  for (menu = parent->list; menu; menu = menu->next) {
>>  basedep = expr_transform(menu->dep);
>> -basedep = expr_alloc_and(expr_copy(parentdep), basedep);
>> +dep = parentdep;
>> +if (sym && sym_is_choice(sym) && menu->sym) {
>> +enum symbol_type type = menu->sym->type;
>> +
>> +if (type == S_UNKNOWN)
>> +type = sym->type;
>> + if (type != S_TRISTATE)
>> +dep = expr_alloc_comp(E_EQUAL, sym, 
>> _yes);
>> +}
>> +basedep = expr_alloc_and(expr_copy(dep), basedep);
>>  basedep = expr_eliminate_dups(basedep);
>>  menu->dep = basedep;
>>  if (menu->sym)
>
>Hmm, if you want to do it this way, I'd prefer you add a parentdep_bool 
>and simply do:
>
>   dep = (menu->sym && menu->sym->type != S_TRISTATE) ? 
>   parentdep_bool : parentdep;

That would lose the S_UNKNOWN compare (menu->sym->type may not be set
at this point, yet, and would later get defaulted to tristate if the choice is 
such).

>Otherwise it looks ok.

Jan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values

2007-09-17 Thread Jan Beulich
 Roman Zippel [EMAIL PROTECTED] 16.09.07 19:29 
On Mon, 10 Sep 2007, Jan Beulich wrote:

 --- linux-2.6.23-rc5/scripts/kconfig/menu.c  2007-09-07 16:48:23.0 
 +0200
 +++ 2.6.23-rc5-tristate-choices/scripts/kconfig/menu.c   2007-09-03 
 10:29:41.0 +0200
 @@ -235,16 +235,23 @@ void menu_finalize(struct menu *parent)
  sym = parent-sym;
  if (parent-list) {
  if (sym  sym_is_choice(sym)) {
 -/* find the first choice value and find out choice type 
 */
 +/* find out choice type */
 +enum symbol_type type = S_UNKNOWN;
 +
  for (menu = parent-list; menu; menu = menu-next) {
 -if (menu-sym) {
 -current_entry = parent;
 -menu_set_type(menu-sym-type);
 -current_entry = menu;
 -menu_set_type(sym-type);
 -break;
 +if (menu-sym  menu-sym-type != S_UNKNOWN) {
 +if (type == S_UNKNOWN)
 +type = menu-sym-type;
 +if (type != S_BOOLEAN)
 +break;
 +if (menu-sym-type == S_TRISTATE) {
 +type = S_TRISTATE;
 +break;
 +}
  }
  }
 +current_entry = parent;
 +menu_set_type(type);
  parentdep = expr_alloc_symbol(sym);
  } else if (parent-prompt)
  parentdep = parent-prompt-visible.expr;

If I understand it correctly this makes possible to override the type of 
choice symbol, so this loop should only be done if the type is not 
S_UNKNOWN.

I think it is better to do it this way, as it results in a (correct) warning 
from
menu_set_type() if the choice type is inconsistently being overridden.

 @@ -253,7 +260,16 @@ void menu_finalize(struct menu *parent)
  
  for (menu = parent-list; menu; menu = menu-next) {
  basedep = expr_transform(menu-dep);
 -basedep = expr_alloc_and(expr_copy(parentdep), basedep);
 +dep = parentdep;
 +if (sym  sym_is_choice(sym)  menu-sym) {
 +enum symbol_type type = menu-sym-type;
 +
 +if (type == S_UNKNOWN)
 +type = sym-type;
 + if (type != S_TRISTATE)
 +dep = expr_alloc_comp(E_EQUAL, sym, 
 symbol_yes);
 +}
 +basedep = expr_alloc_and(expr_copy(dep), basedep);
  basedep = expr_eliminate_dups(basedep);
  menu-dep = basedep;
  if (menu-sym)

Hmm, if you want to do it this way, I'd prefer you add a parentdep_bool 
and simply do:

   dep = (menu-sym  menu-sym-type != S_TRISTATE) ? 
   parentdep_bool : parentdep;

That would lose the S_UNKNOWN compare (menu-sym-type may not be set
at this point, yet, and would later get defaulted to tristate if the choice is 
such).

Otherwise it looks ok.

Jan

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values

2007-09-16 Thread Roman Zippel
Hi,

On Mon, 10 Sep 2007, Jan Beulich wrote:

> --- linux-2.6.23-rc5/scripts/kconfig/menu.c   2007-09-07 16:48:23.0 
> +0200
> +++ 2.6.23-rc5-tristate-choices/scripts/kconfig/menu.c2007-09-03 
> 10:29:41.0 +0200
> @@ -235,16 +235,23 @@ void menu_finalize(struct menu *parent)
>   sym = parent->sym;
>   if (parent->list) {
>   if (sym && sym_is_choice(sym)) {
> - /* find the first choice value and find out choice type 
> */
> + /* find out choice type */
> + enum symbol_type type = S_UNKNOWN;
> +
>   for (menu = parent->list; menu; menu = menu->next) {
> - if (menu->sym) {
> - current_entry = parent;
> - menu_set_type(menu->sym->type);
> - current_entry = menu;
> - menu_set_type(sym->type);
> - break;
> + if (menu->sym && menu->sym->type != S_UNKNOWN) {
> + if (type == S_UNKNOWN)
> + type = menu->sym->type;
> + if (type != S_BOOLEAN)
> + break;
> + if (menu->sym->type == S_TRISTATE) {
> + type = S_TRISTATE;
> + break;
> + }
>   }
>   }
> + current_entry = parent;
> + menu_set_type(type);
>   parentdep = expr_alloc_symbol(sym);
>   } else if (parent->prompt)
>   parentdep = parent->prompt->visible.expr;

If I understand it correctly this makes possible to override the type of 
choice symbol, so this loop should only be done if the type is not 
S_UNKNOWN.

> @@ -253,7 +260,16 @@ void menu_finalize(struct menu *parent)
>  
>   for (menu = parent->list; menu; menu = menu->next) {
>   basedep = expr_transform(menu->dep);
> - basedep = expr_alloc_and(expr_copy(parentdep), basedep);
> + dep = parentdep;
> + if (sym && sym_is_choice(sym) && menu->sym) {
> + enum symbol_type type = menu->sym->type;
> +
> + if (type == S_UNKNOWN)
> + type = sym->type;
> +  if (type != S_TRISTATE)
> + dep = expr_alloc_comp(E_EQUAL, sym, 
> _yes);
> + }
> + basedep = expr_alloc_and(expr_copy(dep), basedep);
>   basedep = expr_eliminate_dups(basedep);
>   menu->dep = basedep;
>   if (menu->sym)

Hmm, if you want to do it this way, I'd prefer you add a parentdep_bool 
and simply do:

dep = (menu->sym && menu->sym->type != S_TRISTATE) ? 
parentdep_bool : parentdep;

Otherwise it looks ok.

bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values

2007-09-16 Thread Sam Ravnborg
On Mon, Sep 10, 2007 at 01:58:02PM +0100, Jan Beulich wrote:
> Change kconfig behavior so that mixing bool and tristate config
> settings in a choice is possible and has the desired effect of
> offering just the tristate options individually if the choice gets set
> to M, and a normal boolean selection if the choice gets set to Y.
> 
> Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>

Applied after fixing whitespace issue (spaces -> tabs)

Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values

2007-09-16 Thread Sam Ravnborg
On Mon, Sep 10, 2007 at 01:58:02PM +0100, Jan Beulich wrote:
 Change kconfig behavior so that mixing bool and tristate config
 settings in a choice is possible and has the desired effect of
 offering just the tristate options individually if the choice gets set
 to M, and a normal boolean selection if the choice gets set to Y.
 
 Signed-off-by: Jan Beulich [EMAIL PROTECTED]

Applied after fixing whitespace issue (spaces - tabs)

Sam
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tristate choices with mixed tristate and boolean values

2007-09-16 Thread Roman Zippel
Hi,

On Mon, 10 Sep 2007, Jan Beulich wrote:

 --- linux-2.6.23-rc5/scripts/kconfig/menu.c   2007-09-07 16:48:23.0 
 +0200
 +++ 2.6.23-rc5-tristate-choices/scripts/kconfig/menu.c2007-09-03 
 10:29:41.0 +0200
 @@ -235,16 +235,23 @@ void menu_finalize(struct menu *parent)
   sym = parent-sym;
   if (parent-list) {
   if (sym  sym_is_choice(sym)) {
 - /* find the first choice value and find out choice type 
 */
 + /* find out choice type */
 + enum symbol_type type = S_UNKNOWN;
 +
   for (menu = parent-list; menu; menu = menu-next) {
 - if (menu-sym) {
 - current_entry = parent;
 - menu_set_type(menu-sym-type);
 - current_entry = menu;
 - menu_set_type(sym-type);
 - break;
 + if (menu-sym  menu-sym-type != S_UNKNOWN) {
 + if (type == S_UNKNOWN)
 + type = menu-sym-type;
 + if (type != S_BOOLEAN)
 + break;
 + if (menu-sym-type == S_TRISTATE) {
 + type = S_TRISTATE;
 + break;
 + }
   }
   }
 + current_entry = parent;
 + menu_set_type(type);
   parentdep = expr_alloc_symbol(sym);
   } else if (parent-prompt)
   parentdep = parent-prompt-visible.expr;

If I understand it correctly this makes possible to override the type of 
choice symbol, so this loop should only be done if the type is not 
S_UNKNOWN.

 @@ -253,7 +260,16 @@ void menu_finalize(struct menu *parent)
  
   for (menu = parent-list; menu; menu = menu-next) {
   basedep = expr_transform(menu-dep);
 - basedep = expr_alloc_and(expr_copy(parentdep), basedep);
 + dep = parentdep;
 + if (sym  sym_is_choice(sym)  menu-sym) {
 + enum symbol_type type = menu-sym-type;
 +
 + if (type == S_UNKNOWN)
 + type = sym-type;
 +  if (type != S_TRISTATE)
 + dep = expr_alloc_comp(E_EQUAL, sym, 
 symbol_yes);
 + }
 + basedep = expr_alloc_and(expr_copy(dep), basedep);
   basedep = expr_eliminate_dups(basedep);
   menu-dep = basedep;
   if (menu-sym)

Hmm, if you want to do it this way, I'd prefer you add a parentdep_bool 
and simply do:

dep = (menu-sym  menu-sym-type != S_TRISTATE) ? 
parentdep_bool : parentdep;

Otherwise it looks ok.

bye, Roman
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tristate choices with mixed tristate and boolean values

2007-09-10 Thread Jan Beulich
Change kconfig behavior so that mixing bool and tristate config
settings in a choice is possible and has the desired effect of
offering just the tristate options individually if the choice gets set
to M, and a normal boolean selection if the choice gets set to Y.

Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>

 scripts/kconfig/menu.c |   35 ++-
 1 file changed, 26 insertions(+), 9 deletions(-)

--- linux-2.6.23-rc5/scripts/kconfig/menu.c 2007-09-07 16:48:23.0 
+0200
+++ 2.6.23-rc5-tristate-choices/scripts/kconfig/menu.c  2007-09-03 
10:29:41.0 +0200
@@ -235,16 +235,23 @@ void menu_finalize(struct menu *parent)
sym = parent->sym;
if (parent->list) {
if (sym && sym_is_choice(sym)) {
-   /* find the first choice value and find out choice type 
*/
+   /* find out choice type */
+   enum symbol_type type = S_UNKNOWN;
+
for (menu = parent->list; menu; menu = menu->next) {
-   if (menu->sym) {
-   current_entry = parent;
-   menu_set_type(menu->sym->type);
-   current_entry = menu;
-   menu_set_type(sym->type);
-   break;
+   if (menu->sym && menu->sym->type != S_UNKNOWN) {
+   if (type == S_UNKNOWN)
+   type = menu->sym->type;
+   if (type != S_BOOLEAN)
+   break;
+   if (menu->sym->type == S_TRISTATE) {
+   type = S_TRISTATE;
+   break;
+   }
}
}
+   current_entry = parent;
+   menu_set_type(type);
parentdep = expr_alloc_symbol(sym);
} else if (parent->prompt)
parentdep = parent->prompt->visible.expr;
@@ -253,7 +260,16 @@ void menu_finalize(struct menu *parent)
 
for (menu = parent->list; menu; menu = menu->next) {
basedep = expr_transform(menu->dep);
-   basedep = expr_alloc_and(expr_copy(parentdep), basedep);
+   dep = parentdep;
+   if (sym && sym_is_choice(sym) && menu->sym) {
+   enum symbol_type type = menu->sym->type;
+
+   if (type == S_UNKNOWN)
+   type = sym->type;
+if (type != S_TRISTATE)
+   dep = expr_alloc_comp(E_EQUAL, sym, 
_yes);
+   }
+   basedep = expr_alloc_and(expr_copy(dep), basedep);
basedep = expr_eliminate_dups(basedep);
menu->dep = basedep;
if (menu->sym)
@@ -326,7 +342,8 @@ void menu_finalize(struct menu *parent)
"values not supported");
}
current_entry = menu;
-   menu_set_type(sym->type);
+   if (menu->sym->type == S_UNKNOWN)
+   menu_set_type(sym->type);
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = >expr; *ep; ep = &(*ep)->left.expr)



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tristate choices with mixed tristate and boolean values

2007-09-10 Thread Jan Beulich
Change kconfig behavior so that mixing bool and tristate config
settings in a choice is possible and has the desired effect of
offering just the tristate options individually if the choice gets set
to M, and a normal boolean selection if the choice gets set to Y.

Signed-off-by: Jan Beulich [EMAIL PROTECTED]

 scripts/kconfig/menu.c |   35 ++-
 1 file changed, 26 insertions(+), 9 deletions(-)

--- linux-2.6.23-rc5/scripts/kconfig/menu.c 2007-09-07 16:48:23.0 
+0200
+++ 2.6.23-rc5-tristate-choices/scripts/kconfig/menu.c  2007-09-03 
10:29:41.0 +0200
@@ -235,16 +235,23 @@ void menu_finalize(struct menu *parent)
sym = parent-sym;
if (parent-list) {
if (sym  sym_is_choice(sym)) {
-   /* find the first choice value and find out choice type 
*/
+   /* find out choice type */
+   enum symbol_type type = S_UNKNOWN;
+
for (menu = parent-list; menu; menu = menu-next) {
-   if (menu-sym) {
-   current_entry = parent;
-   menu_set_type(menu-sym-type);
-   current_entry = menu;
-   menu_set_type(sym-type);
-   break;
+   if (menu-sym  menu-sym-type != S_UNKNOWN) {
+   if (type == S_UNKNOWN)
+   type = menu-sym-type;
+   if (type != S_BOOLEAN)
+   break;
+   if (menu-sym-type == S_TRISTATE) {
+   type = S_TRISTATE;
+   break;
+   }
}
}
+   current_entry = parent;
+   menu_set_type(type);
parentdep = expr_alloc_symbol(sym);
} else if (parent-prompt)
parentdep = parent-prompt-visible.expr;
@@ -253,7 +260,16 @@ void menu_finalize(struct menu *parent)
 
for (menu = parent-list; menu; menu = menu-next) {
basedep = expr_transform(menu-dep);
-   basedep = expr_alloc_and(expr_copy(parentdep), basedep);
+   dep = parentdep;
+   if (sym  sym_is_choice(sym)  menu-sym) {
+   enum symbol_type type = menu-sym-type;
+
+   if (type == S_UNKNOWN)
+   type = sym-type;
+if (type != S_TRISTATE)
+   dep = expr_alloc_comp(E_EQUAL, sym, 
symbol_yes);
+   }
+   basedep = expr_alloc_and(expr_copy(dep), basedep);
basedep = expr_eliminate_dups(basedep);
menu-dep = basedep;
if (menu-sym)
@@ -326,7 +342,8 @@ void menu_finalize(struct menu *parent)
values not supported);
}
current_entry = menu;
-   menu_set_type(sym-type);
+   if (menu-sym-type == S_UNKNOWN)
+   menu_set_type(sym-type);
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = prop-expr; *ep; ep = (*ep)-left.expr)



-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/