linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kconfig: tristate choice with depender choice
@ 2012-02-07  0:16 Atsushi Nemoto
  2012-02-07 10:35 ` Michal Marek
  2012-02-09  5:08 ` Arnaud Lacombe
  0 siblings, 2 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2012-02-07  0:16 UTC (permalink / raw)
  To: Michal Marek, Sam Ravnborg; +Cc: linux-kbuild, linux-kernel

If a tristate choice has another choice dependers, kconfig produce
wrong value.

Example:

choice
	prompt "choice list AB"
config A
	tristate "a"
config B
	tristate "b"
endchoice
choice
	prompt "choice list CD"
	depends on A
config C
       	bool "c"
config D
       	bool "d"
endchoice

kconfig outputs CONFIG_A=m from defconfig with CONFIG_A=y.

This happens if the choice list CD depends on A.
Also, if defconfig contains CONFIG_A=y and "# CONFIG_B is not set",
output is correct.

I found commit a64b44ea ("kconfig: fix tristate choice with minimal
config"), but this problem still exists on v3.3-rc1.  More fix is
needed for choice with dependers?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: kconfig: tristate choice with depender choice
  2012-02-07  0:16 kconfig: tristate choice with depender choice Atsushi Nemoto
@ 2012-02-07 10:35 ` Michal Marek
  2012-02-09  5:08 ` Arnaud Lacombe
  1 sibling, 0 replies; 6+ messages in thread
From: Michal Marek @ 2012-02-07 10:35 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: Sam Ravnborg, linux-kbuild, linux-kernel, Arnaud Lacombe

(added Arnaud to CC)

On 7.2.2012 01:16, Atsushi Nemoto wrote:
> If a tristate choice has another choice dependers, kconfig produce
> wrong value.
> 
> Example:
> 
> choice
> 	prompt "choice list AB"
> config A
> 	tristate "a"
> config B
> 	tristate "b"
> endchoice
> choice
> 	prompt "choice list CD"
> 	depends on A
> config C
>        	bool "c"
> config D
>        	bool "d"
> endchoice
> 
> kconfig outputs CONFIG_A=m from defconfig with CONFIG_A=y.
> 
> This happens if the choice list CD depends on A.
> Also, if defconfig contains CONFIG_A=y and "# CONFIG_B is not set",
> output is correct.
> 
> I found commit a64b44ea ("kconfig: fix tristate choice with minimal
> config"), but this problem still exists on v3.3-rc1.  More fix is
> needed for choice with dependers?
> 
> ---
> Atsushi Nemoto


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: kconfig: tristate choice with depender choice
  2012-02-07  0:16 kconfig: tristate choice with depender choice Atsushi Nemoto
  2012-02-07 10:35 ` Michal Marek
@ 2012-02-09  5:08 ` Arnaud Lacombe
  2012-02-09  5:26   ` Arnaud Lacombe
  1 sibling, 1 reply; 6+ messages in thread
From: Arnaud Lacombe @ 2012-02-09  5:08 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: Michal Marek, Sam Ravnborg, linux-kbuild, linux-kernel

Hi,

On Mon, Feb 6, 2012 at 7:16 PM, Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> If a tristate choice has another choice dependers, kconfig produce
> wrong value.
>
> Example:
>
> choice
>        prompt "choice list AB"
> config A
>        tristate "a"
> config B
>        tristate "b"
> endchoice
> choice
>        prompt "choice list CD"
>        depends on A
> config C
>        bool "c"
> config D
>        bool "d"
> endchoice
>
> kconfig outputs CONFIG_A=m from defconfig with CONFIG_A=y.
>
> This happens if the choice list CD depends on A.
> Also, if defconfig contains CONFIG_A=y and "# CONFIG_B is not set",
> output is correct.
>
confirmed.

> I found commit a64b44ea ("kconfig: fix tristate choice with minimal
> config"), but this problem still exists on v3.3-rc1.  More fix is
> needed for choice with dependers?
>
it would seem so.

 - Arnaud

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: kconfig: tristate choice with depender choice
  2012-02-09  5:08 ` Arnaud Lacombe
@ 2012-02-09  5:26   ` Arnaud Lacombe
  2012-02-09 14:30     ` Atsushi Nemoto
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaud Lacombe @ 2012-02-09  5:26 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: Michal Marek, Sam Ravnborg, linux-kbuild, linux-kernel

Hi,

On Thu, Feb 9, 2012 at 12:08 AM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Mon, Feb 6, 2012 at 7:16 PM, Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
>> If a tristate choice has another choice dependers, kconfig produce
>> wrong value.
>>
>> Example:
>>
>> choice
>>        prompt "choice list AB"
>> config A
>>        tristate "a"
>> config B
>>        tristate "b"
>> endchoice
>> choice
>>        prompt "choice list CD"
>>        depends on A
>> config C
>>        bool "c"
>> config D
>>        bool "d"
>> endchoice
>>
>> kconfig outputs CONFIG_A=m from defconfig with CONFIG_A=y.
>>
>> This happens if the choice list CD depends on A.
>> Also, if defconfig contains CONFIG_A=y and "# CONFIG_B is not set",
>> output is correct.
>>
> confirmed.
>
actually, not that much. Your reduced testcase is missing a MODULES
symbol to have modules enabled and have them show up in the final
`.config'. If you add:

config MODULES
  boolean
  default y

then you end up with CONFIG_A=m in the `.config'.

Now, I may have missed something.

Do you have a situation where a MODULES symbol is present, enabled,
but CONFIG_A=y still appear from CONFIG_A=m in the defconfig ?

Thanks,
 - Arnaud

>> I found commit a64b44ea ("kconfig: fix tristate choice with minimal
>> config"), but this problem still exists on v3.3-rc1.  More fix is
>> needed for choice with dependers?
>>
> it would seem so.
>
>  - Arnaud

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: kconfig: tristate choice with depender choice
  2012-02-09  5:26   ` Arnaud Lacombe
@ 2012-02-09 14:30     ` Atsushi Nemoto
  2012-02-17 15:14       ` Atsushi Nemoto
  0 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2012-02-09 14:30 UTC (permalink / raw)
  To: lacombar; +Cc: mmarek, sam, linux-kbuild, linux-kernel

On Thu, 9 Feb 2012 00:26:25 -0500, Arnaud Lacombe <lacombar@gmail.com> wrote:
>> confirmed.
>>
> actually, not that much. Your reduced testcase is missing a MODULES
> symbol to have modules enabled and have them show up in the final
> `.config'. If you add:
> 
> config MODULES
>   boolean
>   default y
> 
> then you end up with CONFIG_A=m in the `.config'.

Yes, so it is the problem.  I got CONFIG_A=m in .config from
CONFIG_A=y in defconfig.

> Now, I may have missed something.
> 
> Do you have a situation where a MODULES symbol is present, enabled,
> but CONFIG_A=y still appear from CONFIG_A=m in the defconfig ?

I tested in this way:

1. Add this example to the end of drivers/char/Kconfig file.
-------------------------------------
choice
	prompt "choice list AB"
config A
	tristate "a"
config B
	tristate "b"
endchoice
choice
	prompt "choice list CD"
	depends on A
config C
       	bool "c"
config D
       	bool "d"
endchoice
-------------------------------------

2. Then run commands:

$ cp arch/x86/configs/i386_defconfig arch/x86/configs/test_defconfig
$ echo 'CONFIG_A=y' >> arch/x86/configs/test_defconfig 
$ make O=../build test_defconfig
$ grep CONFIG_A= ../build/.config
CONFIG_A=m

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: kconfig: tristate choice with depender choice
  2012-02-09 14:30     ` Atsushi Nemoto
@ 2012-02-17 15:14       ` Atsushi Nemoto
  0 siblings, 0 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2012-02-17 15:14 UTC (permalink / raw)
  To: lacombar; +Cc: mmarek, sam, linux-kbuild, linux-kernel

On Thu, 09 Feb 2012 23:30:17 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> I tested in this way:
> 
> 1. Add this example to the end of drivers/char/Kconfig file.
> -------------------------------------
> choice
> 	prompt "choice list AB"
> config A
> 	tristate "a"
> config B
> 	tristate "b"
> endchoice
> choice
> 	prompt "choice list CD"
> 	depends on A
> config C
>        	bool "c"
> config D
>        	bool "d"
> endchoice
> -------------------------------------
> 
> 2. Then run commands:
> 
> $ cp arch/x86/configs/i386_defconfig arch/x86/configs/test_defconfig
> $ echo 'CONFIG_A=y' >> arch/x86/configs/test_defconfig 
> $ make O=../build test_defconfig
> $ grep CONFIG_A= ../build/.config
> CONFIG_A=m

I did some investigations.
When this happens, sym_calc_value() was called recursively.

main
  conf_set_all_new_symbols
    sym_calc_value ("choice list CD")
      sym_calc_visibility ("choice list CD")
        expr_calc_value
          sym_calc_value ("A")

On this place in sym_calc_value(), sym->def[S_DEF_USER].tri was 'yes'
and sym->visible was 'mod'.

		newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
				      sym->visible);
		goto calc_newval;

Then new value of CONFIG_A will be 'mod'.

I suppose sym->visible is 'mod' because default value of tristate
choice is 'mod'.  Is this correct?
Any suggestions for fixing or debugging?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-17 15:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07  0:16 kconfig: tristate choice with depender choice Atsushi Nemoto
2012-02-07 10:35 ` Michal Marek
2012-02-09  5:08 ` Arnaud Lacombe
2012-02-09  5:26   ` Arnaud Lacombe
2012-02-09 14:30     ` Atsushi Nemoto
2012-02-17 15:14       ` Atsushi Nemoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).