History log of /linux-master/scripts/kconfig/symbol.c
Revision Date Author Comments
# e0492219 02-Mar-2024 Masahiro Yamada <masahiroy@kernel.org>

kconfig: link menus to a symbol

Currently, there is no direct link from (struct symbol) to (struct menu).

It is still possible to access associated menus through the P_SYMBOL
property, because property::menu is the relevant menu entry, but it
results in complex code, as seen in get_symbol_str().

Use a linked list for simpler traversal of relevant menus.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# 91b69454 11-Feb-2024 Masahiro Yamada <masahiroy@kernel.org>

kconfig: use generic macros to implement symbol hashtable

Use helper macros in hashtable.h for generic hashtable implementation.

We can git rid of the hash head index of for_all_symbols().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 7c4aa901 02-Feb-2024 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move strhash() to util.c as a global function

Remove the 'static' qualifier from strhash() so that it can be accessed
from other files. Move it to util.c, which is a more appropriate location.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 1a90b0cd 02-Feb-2024 Masahiro Yamada <masahiroy@kernel.org>

kconfig: associate struct property with file name directly

struct property is linked to struct file for diagnostic purposes.
It is always used to retrieve the file name through prop->file->name.

Associate struct property with the file name directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 40bab83a 02-Feb-2024 Masahiro Yamada <masahiroy@kernel.org>

kconfig: associate struct menu with file name directly

struct menu is linked to struct file for diagnostic purposes.
It is always used to retrieve the file name through menu->file->name.

Associate struct menu with the file name directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# bfef491d 26-Jan-2024 Masahiro Yamada <masahiroy@kernel.org>

kconfig: initialize sym->curr.tri to 'no' for all symbol types again

Geert Uytterhoeven reported that commit 4e244c10eab3 ("kconfig: remove
unneeded symbol_empty variable") changed the default value of
CONFIG_LOG_CPU_MAX_BUF_SHIFT from 12 to 0.

As it turned out, this is an undefined behavior because sym_calc_value()
stopped setting the sym->curr.tri field for 'int', 'hex', and 'string'
symbols.

This commit restores the original behavior, where 'int', 'hex', 'string'
symbols are interpreted as false if used in boolean contexts.

CONFIG_LOG_CPU_MAX_BUF_SHIFT will default to 12 again, irrespective
of CONFIG_BASE_SMALL. Presumably, this is not the intended behavior,
as already reported [1], but this is another issue that should be
addressed by a separate patch.

[1]: https://lore.kernel.org/all/f6856be8-54b7-0fa0-1d17-39632bf29ada@oracle.com/

Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable")
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 15d3f766 21-Nov-2023 Sergey Senozhatsky <senozhatsky@chromium.org>

kconfig: WERROR unmet symbol dependency

When KCONFIG_WERROR env variable is set treat unmet direct
symbol dependency as a terminal condition (error).

Suggested-by: Stefan Reinauer <reinauer@google.com>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 6262afa1 25-Nov-2023 Masahiro Yamada <masahiroy@kernel.org>

kconfig: default to zero if int/hex symbol lacks default property

When a default property is missing in an int or hex symbol, it defaults
to an empty string, which is not a valid symbol value.

It results in an incorrect .config, and can also lead to an infinite
loop in scripting.

Use "0" for int and "0x0" for hex as a default value.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>


# 4e244c10 25-Nov-2023 Masahiro Yamada <masahiroy@kernel.org>

kconfig: remove unneeded symbol_empty variable

This is used only for initializing other variables.

Use the empty string "" directly.

Please note newval.tri is unused for S_INT/HEX/STRING.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# ae1eff03 14-Nov-2023 Masahiro Yamada <masahiroy@kernel.org>

kconfig: fix memory leak from range properties

Currently, sym_validate_range() duplicates the range string using
xstrdup(), which is overwritten by a subsequent sym_calc_value() call.
It results in a memory leak.

Instead, only the pointer should be copied.

Below is a test case, with a summary from Valgrind.

[Test Kconfig]

config FOO
int "foo"
range 10 20

[Test .config]

CONFIG_FOO=0

[Before]

LEAK SUMMARY:
definitely lost: 3 bytes in 1 blocks
indirectly lost: 0 bytes in 0 blocks
possibly lost: 0 bytes in 0 blocks
still reachable: 17,465 bytes in 21 blocks
suppressed: 0 bytes in 0 blocks

[After]

LEAK SUMMARY:
definitely lost: 0 bytes in 0 blocks
indirectly lost: 0 bytes in 0 blocks
possibly lost: 0 bytes in 0 blocks
still reachable: 17,462 bytes in 20 blocks
suppressed: 0 bytes in 0 blocks

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 80f7bc77 30-Sep-2021 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move sym_escape_string_value() to confdata.c

Now that sym_escape_string_value() is only used in confdata.c
it can be a 'static' function.

Rename it escape_string_value() because it is agnostic about
(struct sym *).

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 229d0cfa 30-Sep-2021 Masahiro Yamada <masahiroy@kernel.org>

kconfig: remove 'const' from the return type of sym_escape_string_value()

sym_escape_string_value() returns a malloc'ed memory, but as
(const char *). So, it must be casted to (void *) when it is free'd.
This is odd.

The return type of sym_escape_string_value() should be (char *).

I exploited that free(NULL) has no effect.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 5ee54659 10-Apr-2021 Masahiro Yamada <masahiroy@kernel.org>

kconfig: change sym_change_count to a boolean flag

sym_change_count has no good reason to be 'int' type.

sym_set_change_count() compares the old and new values after casting
both of them to (bool). I do not see any practical diffrence between
sym_set_change_count(1) and sym_add_change_count(1).

Use the boolean flag, conf_changed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# b75b0a81 13-Mar-2021 Masahiro Yamada <masahiroy@kernel.org>

kconfig: change defconfig_list option to environment variable

"defconfig_list" is a weird option that defines a static symbol that
declares the list of base config files in case the .config does not
exist yet.

This is quite different from other normal symbols; we just abused the
"string" type and the "default" properties to list out the input files.
They must be fixed values since these are searched for and loaded in
the parse stage.

It is an ugly hack, and should not exist in the first place. Providing
this feature as an environment variable is a saner approach.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 78cb0907 23-Nov-2020 Boris Kolpackov <boris@codesynthesis.com>

kconfig: clean up header inclusion

- Add missing includes.
- Remove no longer necessary includes.

Signed-off-by: Boris Kolpackov <boris@codesynthesis.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# d41809ff 28-Jul-2020 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add 'static' to some file-local data

Fix some warnings from sparce like follows:

warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# cfc6eea9 13-Apr-2020 Masahiro Yamada <masahiroy@kernel.org>

kconfig: do not use OR-assignment for zero-cleared structure

The simple assignment is enough because memset() three lines above
has zero-cleared the structure.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 3a9dd3ec 01-Mar-2020 Masahiro Yamada <masahiroy@kernel.org>

kconfig: make 'imply' obey the direct dependency

The 'imply' statement may create unmet direct dependency when the
implied symbol depends on m.

[Test Code]

config FOO
tristate "foo"
imply BAZ

config BAZ
tristate "baz"
depends on BAR

config BAR
def_tristate m

config MODULES
def_bool y
option modules

If you set FOO=y, BAZ is also promoted to y, which results in the
following .config file:

CONFIG_FOO=y
CONFIG_BAZ=y
CONFIG_BAR=m
CONFIG_MODULES=y

This does not meet the dependency 'BAZ depends on BAR'.

Unlike 'select', what is worse, Kconfig never shows the
'WARNING: unmet direct dependencies detected for ...' for this case.

Because 'imply' is considered to be weaker than 'depends on', Kconfig
should take the direct dependency into account.

For clarification, describe this case in kconfig-language.rst too.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>


# def2fbff 01-Mar-2020 Masahiro Yamada <masahiroy@kernel.org>

kconfig: allow symbols implied by y to become m

The 'imply' keyword restricts a symbol to y or n, excluding m
when it is implied by y. This is the original behavior since
commit 237e3ad0f195 ("Kconfig: Introduce the "imply" keyword").

However, the author of this feature, Nicolas Pitre, stated that
the 'imply' keyword should not impose any restrictions.
(https://lkml.org/lkml/2020/2/19/714)

I agree, and want to get rid of this tricky behavior.

Suggested-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>


# adf7c5bd 16-Dec-2019 Masahiro Yamada <masahiroy@kernel.org>

kconfig: squash prop_alloc() into menu_add_prop()

prop_alloc() is only called from menu_add_prop(). Squash it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 6397d96b 16-Dec-2019 Masahiro Yamada <masahiroy@kernel.org>

kconfig: remove sym from struct property

struct property can reference to the symbol that it is associated with
by prop->menu->sym.

Fix up the one usage of prop->sym, and remove sym from struct property.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# baa23ec8 03-Jul-2019 Marco Ammon <marco.ammon@fau.de>

kconfig: Fix spelling of sym_is_changable

There is a spelling mistake in "changable", it is corrected to
"changeable" and all call sites are updated accordingly.

Signed-off-by: Marco Ammon <marco.ammon@fau.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# cd238eff 12-Jun-2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

docs: kbuild: convert docs to ReST and rename to *.rst

The kbuild documentation clearly shows that the documents
there are written at different times: some use markdown,
some use their own peculiar logic to split sections.

Convert everything to ReST without affecting too much
the author's style and avoiding adding uneeded markups.

The conversion is actually:
- add blank lines and identation in order to identify paragraphs;
- fix tables markups;
- add some lists markups;
- mark literal blocks;
- adjust title markups.

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>


# 558e78e3 21-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: split some C files out of zconf.y

I want to compile each C file independently instead of including all
of them from zconf.y.

Split out confdata.c, expr.c, symbol.c, and preprocess.c .
These are low-hanging fruits.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 0c874100 18-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: convert to SPDX License Identifier

All files in lxdialog/ are licensed under GPL-2.0+, and the rest are
under GPL-2.0. I added GPL-2.0 tags to test scripts in tests/.

Documentation/process/license-rules.rst does not suggest anything
about the flex/bison files. Because flex does not accept the C++
comment style at the very top of a file, I used the C style for
zconf.l, and so for zconf.y for consistency.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 2aabbed6 30-Nov-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: remove S_OTHER symbol type and correct dependency tracking

The S_OTHER type could be set only when conf_read_simple() is reading
include/config/auto.conf file.

For example, CONFIG_FOO=y exists in include/config/auto.conf but it is
missing from the currently parsed Kconfig files, sym_lookup() allocates
a new symbol, and sets its type to S_OTHER.

Strangely, it will be set to S_STRING by conf_set_sym_val() a few lines
below while it is obviously bool or tristate type. On the other hand,
when CONFIG_BAR="bar" is being dropped from include/config/auto.conf,
its type remains S_OTHER. Because for_all_symbols() omits S_OTHER
symbols, conf_touch_deps() misses to touch include/config/bar.h

This behavior has been a pretty mystery for me, and digging the git
histroy did not help. At least, touching depfiles is broken for string
type symbols.

I removed S_OTHER entirely, and reimplemented it more simply.

If CONFIG_FOO was visible in the previous syncconfig, but is missing
now, what we want to do is quite simple; just call conf_touch_dep()
to touch include/config/foo.h instead of allocating a new symbol data.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# f498926c 14-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: improve the recursive dependency report

This commit improves the messages of the recursive dependency.
Currently, sym->dir_dep.expr is not checked. Hence, any dependency
in property visibility is regarded as the dependency of the symbol.

[Test Code 1]

config A
bool "a"
depends on B

config B
bool "b"
depends on A

[Test Code 2]

config A
bool "a" if B

config B
bool "b"
depends on A

For both cases above, the same message is displayed:

symbol B depends on A
symbol A depends on B

This commit changes the message for the latter, like this:

symbol B depends on A
symbol A prompt is visible depending on B

Also, 'select' and 'imply' are distinguished.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Dirk Gouders <dirk@gouders.net>


# 5e8c5299 14-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: report recursive dependency involving 'imply'

Currently, Kconfig does not complain about the recursive dependency
where 'imply' keywords are involved.

[Test Code]

config A
bool "a"

config B
bool "b"
imply A
depends on A

In the code above, Kconfig cannot calculate the symbol values correctly
due to the circular dependency. For example, allyesconfig followed by
syncconfig results in an odd behavior because CONFIG_B becomes visible
in syncconfig.

$ make allyesconfig
scripts/kconfig/conf --allyesconfig Kconfig
#
# configuration written to .config
#
$ cat .config
#
# Automatically generated file; DO NOT EDIT.
# Main menu
#
CONFIG_A=y
$ make syncconfig
scripts/kconfig/conf --syncconfig Kconfig
*
* Restart config...
*
*
* Main menu
*
a (A) [Y/n/?] y
b (B) [N/y/?] (NEW)

To detect this correctly, sym_check_expr_deps() should recurse to
not only sym->rev_dep.expr but also sym->implied.expr .

At this moment, sym_check_print_recursive() cannot distinguish
'select' and 'imply' since it does not know the precise context
where the recursive dependency has been hit. This will be solved
by the next commit.

In fact, even the document and the unit-test are confused. Using
'imply' does not solve recursive dependency since 'imply' addresses
the unmet direct dependency, which 'select' could cause.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Dirk Gouders <dirk@gouders.net>


# f1575595 14-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: error out when seeing recursive dependency

Originally, recursive dependency was a fatal error for Kconfig
because Kconfig cannot compute symbol values in such a situation.

Commit d595cea62403 ("kconfig: print more info when we see a recursive
dependency") changed it to a warning, which I guess was not intentional.

Get it back to an error again.

Also, rename the unit test directory "warn_recursive_dep" to
"err_recursive_dep" so that it matches to the behavior.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Dirk Gouders <dirk@gouders.net>


# 18808612 13-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: remove P_ENV property type

This property is not set by anyone since commit 104daea149c4 ("kconfig:
reference environment variables directly and remove 'option env='").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>


# c151272d 13-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: remove unused sym_get_env_prop() function

This function is unused since commit 104daea149c4 ("kconfig: reference
environment variables directly and remove 'option env='").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>


# 693359f7 03-Jul-2018 Dirk Gouders <dirk@gouders.net>

kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE

Over time, the use of the flag SYMBOL_AUTO changed from initially
marking three automatically generated symbols ARCH, KERNELRELEASE and
UNAME_RELEASE to today's effect of protecting symbols from being
written out.

Currently, only symbols of type CHOICE and those with option
defconf_list set have that flag set.

Reflect that change in semantics in the flag's name.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 5b31a974 28-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: remove sym_expand_string_value()

There is no more caller of sym_expand_string_value().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Kees Cook <keescook@chromium.org>


# 104daea1 28-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: reference environment variables directly and remove 'option env='

To get access to environment variables, Kconfig needs to define a
symbol using "option env=" syntax. It is tedious to add a symbol entry
for each environment variable given that we need to define much more
such as 'CC', 'AS', 'srctree' etc. to evaluate the compiler capability
in Kconfig.

Adding '$' for symbol references is grammatically inconsistent.
Looking at the code, the symbols prefixed with 'S' are expanded by:
- conf_expand_value()
This is used to expand 'arch/$ARCH/defconfig' and 'defconfig_list'
- sym_expand_string_value()
This is used to expand strings in 'source' and 'mainmenu'

All of them are fixed values independent of user configuration. So,
they can be changed into the direct expansion instead of symbols.

This change makes the code much cleaner. The bounce symbols 'SRCARCH',
'ARCH', 'SUBARCH', 'KERNELVERSION' are gone.

sym_init() hard-coding 'UNAME_RELEASE' is also gone. 'UNAME_RELEASE'
should be replaced with an environment variable.

ARCH_DEFCONFIG is a normal symbol, so it should be simply referenced
without '$' prefix.

The new syntax is addicted by Make. The variable reference needs
parentheses, like $(FOO), but you can omit them for single-letter
variables, like $F. Yet, in Makefiles, people tend to use the
parenthetical form for consistency / clarification.

At this moment, only the environment variable is supported, but I will
extend the concept of 'variable' later on.

The variables are expanded in the lexer so we can simplify the token
handling on the parser side.

For example, the following code works.

[Example code]

config MY_TOOLCHAIN_LIST
string
default "My tools: CC=$(CC), AS=$(AS), CPP=$(CPP)"

[Result]

$ make -s alldefconfig && tail -n 1 .config
CONFIG_MY_TOOLCHAIN_LIST="My tools: CC=gcc, AS=as, CPP=gcc -E"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Kees Cook <keescook@chromium.org>


# f8f69dc0 13-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: make unmet dependency warnings readable

Currently, the unmet dependency warnings end up with endlessly long
expressions, most of which are false positives.

Here is test code to demonstrate how it currently works.

[Test Case]

config DEP1
def_bool y

config DEP2
bool "DEP2"

config A
bool "A"
select E

config B
bool "B"
depends on DEP2
select E

config C
bool "C"
depends on DEP1 && DEP2
select E

config D
def_bool n
select E

config E
bool
depends on DEP1 && DEP2

[Result]

$ make config
scripts/kconfig/conf --oldaskconfig Kconfig
*
* Linux Kernel Configuration
*
DEP2 (DEP2) [N/y/?] (NEW) n
A (A) [N/y/?] (NEW) y
warning: (A && B && D) selects E which has unmet direct
dependencies (DEP1 && DEP2)

Here, I see some points to be improved.

First, '(A || B || D)' would make more sense than '(A && B && D)'.
I am not sure if this is intentional, but expr_simplify_unmet_dep()
turns OR expressions into AND, like follows:

case E_OR:
return expr_alloc_and(

Second, we see false positives. 'A' is a real unmet dependency.
'B' is false positive because 'DEP1' is fixed to 'y', and 'B' depends
on 'DEP2'. 'C' was correctly dropped by expr_simplify_unmet_dep().
'D' is also false positive because it has no chance to be enabled.
Current expr_simplify_unmet_dep() cannot avoid those false positives.

After all, I decided to use the same helpers as used for printing
reverse dependencies in the help.

With this commit, unreadable warnings (most of the reported symbols are
false positives) in the real world:

$ make ARCH=score allyesconfig
scripts/kconfig/conf --allyesconfig Kconfig
warning: (HWSPINLOCK_QCOM && AHCI_MTK && STMMAC_PLATFORM &&
DWMAC_IPQ806X && DWMAC_LPC18XX && DWMAC_OXNAS && DWMAC_ROCKCHIP &&
DWMAC_SOCFPGA && DWMAC_STI && TI_CPSW && PINCTRL_GEMINI &&
PINCTRL_OXNAS && PINCTRL_ROCKCHIP && PINCTRL_DOVE &&
PINCTRL_ARMADA_37XX && PINCTRL_STM32 && S3C2410_WATCHDOG &&
VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK && RTC_DRV_AT91SAM9 &&
LPC18XX_DMAMUX && VIDEO_OMAP4 && COMMON_CLK_GEMINI &&
COMMON_CLK_ASPEED && COMMON_CLK_NXP && COMMON_CLK_OXNAS &&
COMMON_CLK_BOSTON && QCOM_ADSP_PIL && QCOM_Q6V5_PIL && QCOM_GSBI &&
ATMEL_EBI && ST_IRQCHIP && RESET_IMX7 && PHY_HI6220_USB &&
PHY_RALINK_USB && PHY_ROCKCHIP_PCIE && PHY_DA8XX_USB) selects
MFD_SYSCON which has unmet direct dependencies (HAS_IOMEM)
warning: (PINCTRL_AT91 && PINCTRL_AT91PIO4 && PINCTRL_OXNAS &&
PINCTRL_PISTACHIO && PINCTRL_PIC32 && PINCTRL_MESON &&
PINCTRL_NOMADIK && PINCTRL_MTK && PINCTRL_MT7622 && GPIO_TB10X)
selects OF_GPIO which has unmet direct dependencies (GPIOLIB && OF &&
HAS_IOMEM)
warning: (FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && LOCKDEP)
selects FRAME_POINTER which has unmet direct dependencies
(DEBUG_KERNEL && (CRIS || M68K || FRV || UML || SUPERH || BLACKFIN ||
MN10300 || METAG) || ARCH_WANT_FRAME_POINTERS)

will be turned into:

$ make ARCH=score allyesconfig
scripts/kconfig/conf --allyesconfig Kconfig

WARNING: unmet direct dependencies detected for MFD_SYSCON
Depends on [n]: HAS_IOMEM [=n]
Selected by [y]:
- PINCTRL_STM32 [=y] && PINCTRL [=y] && (ARCH_STM32 ||
COMPILE_TEST [=y]) && OF [=y]
- RTC_DRV_AT91SAM9 [=y] && RTC_CLASS [=y] && (ARCH_AT91 ||
COMPILE_TEST [=y])
- RESET_IMX7 [=y] && RESET_CONTROLLER [=y]
- PHY_HI6220_USB [=y] && (ARCH_HISI && ARM64 ||
COMPILE_TEST [=y])
- PHY_RALINK_USB [=y] && (RALINK || COMPILE_TEST [=y])
- PHY_ROCKCHIP_PCIE [=y] && (ARCH_ROCKCHIP && OF [=y] ||
COMPILE_TEST [=y])

WARNING: unmet direct dependencies detected for OF_GPIO
Depends on [n]: GPIOLIB [=y] && OF [=y] && HAS_IOMEM [=n]
Selected by [y]:
- PINCTRL_MTK [=y] && PINCTRL [=y] && (ARCH_MEDIATEK ||
COMPILE_TEST [=y]) && OF [=y]
- PINCTRL_MT7622 [=y] && PINCTRL [=y] && (ARCH_MEDIATEK ||
COMPILE_TEST [=y]) && OF [=y] && (ARM64 || COMPILE_TEST [=y])

WARNING: unmet direct dependencies detected for FRAME_POINTER
Depends on [n]: DEBUG_KERNEL [=y] && (CRIS || M68K || FRV || UML ||
SUPERH || BLACKFIN || MN10300 || METAG) || ARCH_WANT_FRAME_POINTERS [=n]
Selected by [y]:
- LATENCYTOP [=y] && DEBUG_KERNEL [=y] && STACKTRACE_SUPPORT [=y] &&
PROC_FS [=y] && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND &&
!ARC && !X86

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>


# f622f827 13-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: warn unmet direct dependency of tristate symbols selected by y

Commit 246cf9c26bf1 ("kbuild: Warn on selecting symbols with unmet
direct dependencies") forcibly promoted ->dir_dep.tri to yes from mod.
So, the unmet direct dependencies of tristate symbols are not reported.

[Test Case]

config MODULES
def_bool y
option modules

config A
def_bool y
select B

config B
tristate "B"
depends on m

This causes unmet dependency because 'B' is forced 'y' ignoring
'depends on m'. This should be warned.

On the other hand, the following case ('B' is bool) should not be
warned, so 'depends on m' for bool symbols should be naturally treated
as 'depends on y'.

[Test Case2 (not unmet dependency)]

config MODULES
def_bool y
option modules

config A
def_bool y
select B

config B
bool "B"
depends on m

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# f467c564 22-Feb-2018 Ulf Magnusson <ulfalizer@gmail.com>

kconfig: only write '# CONFIG_FOO is not set' for visible symbols

=== Background ===

- Visible n-valued bool/tristate symbols generate a
'# CONFIG_FOO is not set' line in the .config file. The idea is to
remember the user selection without having to set a Makefile
variable. Having n correspond to the variable being undefined in the
Makefiles makes for easy CONFIG_* tests.

- Invisible n-valued bool/tristate symbols normally do not generate a
'# CONFIG_FOO is not set' line, because user values from .config
files have no effect on invisible symbols anyway.

Currently, there is one exception to this rule: Any bool/tristate symbol
that gets the value n through a 'default' property generates a
'# CONFIG_FOO is not set' line, even if the symbol is invisible.

Note that this only applies to explicitly given defaults, and not when
the symbol implicitly defaults to n (like bool/tristate symbols without
'default' properties do).

This is inconsistent, and seems redundant:

- As mentioned, the '# CONFIG_FOO is not set' won't affect the symbol
once the .config is read back in.

- Even if the symbol is invisible at first but becomes visible later,
there shouldn't be any harm in recalculating the default value
rather than viewing the '# CONFIG_FOO is not set' as a previous
user value of n.

=== Changes ===

Change sym_calc_value() to only set SYMBOL_WRITE (write to .config) for
non-n-valued 'default' properties.

Note that SYMBOL_WRITE is always set for visible symbols regardless of whether
they have 'default' properties or not, so this change only affects invisible
symbols.

This reduces the size of the x86 .config on my system by about 1% (due
to removed '# CONFIG_FOO is not set' entries).

One side effect of (and the main motivation for) this change is making
the following two definitions behave exactly the same:

config FOO
bool

config FOO
bool
default n

With this change, neither of these will generate a
'# CONFIG_FOO is not set' line (assuming FOO isn't selected/implied).
That might make it clearer to people that a bare 'default n' is
redundant.

This change only affects generated .config files and not autoconf.h:
autoconf.h only includes #defines for non-n bool/tristate symbols.

=== Testing ===

The following testing was done with the x86 Kconfigs:

- .config files generated before and after the change were compared to
verify that the only difference is some '# CONFIG_FOO is not set'
entries disappearing. A couple of these were inspected manually, and
most turned out to be from redundant 'default n/def_bool n'
properties.

- The generated include/generated/autoconf.h was compared before and
after the change and verified to be identical.

- As a sanity check, the same modification was done to Kconfiglib.
The Kconfiglib test suite was then run to check for any mismatches
against the output of the C implementation.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# cd81fc82 16-Feb-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add xstrdup() helper

We already have xmalloc(), xcalloc(), and xrealloc((). Add xstrdup()
as well to save tedious error handling.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 523ca58b 08-Feb-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: remove const qualifier from sym_expand_string_value()

This function returns realloc'ed memory, so the returned pointer
must be passed to free() when done. So, 'const' qualifier is odd.
It is allowed to modify the expanded string.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# d717f24d 08-Feb-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add xrealloc() helper

We already have xmalloc(), xcalloc(). Add xrealloc() as well
to save tedious error handling.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 9e3e10c7 05-Feb-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: send error messages to stderr

These messages should be directed to stderr.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>


# cb67ab2c 05-Feb-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: do not write choice values when their dependency becomes n

"# CONFIG_... is not set" for choice values are wrongly written into
the .config file if they are once visible, then become invisible later.

Test case
---------

---------------------------(Kconfig)----------------------------
config A
bool "A"

choice
prompt "Choice ?"
depends on A

config CHOICE_B
bool "Choice B"

config CHOICE_C
bool "Choice C"

endchoice
----------------------------------------------------------------

---------------------------(.config)----------------------------
CONFIG_A=y
----------------------------------------------------------------

With the Kconfig and .config above,

$ make config
scripts/kconfig/conf --oldaskconfig Kconfig
*
* Linux Kernel Configuration
*
A (A) [Y/n] n
#
# configuration written to .config
#
$ cat .config
#
# Automatically generated file; DO NOT EDIT.
# Linux Kernel Configuration
#
# CONFIG_A is not set
# CONFIG_CHOICE_B is not set
# CONFIG_CHOICE_C is not set

Here,

# CONFIG_CHOICE_B is not set
# CONFIG_CHOICE_C is not set

should not be written into the .config file because their dependency
"depends on A" is unmet.

Currently, there is no code that clears SYMBOL_WRITE of choice values.

Clear SYMBOL_WRITE for all symbols in sym_calc_value(), then set it
again after calculating visibility. To simplify the logic, set the
flag if they have non-n visibility, regardless of types, and regardless
of whether they are choice values or not.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>


# b92d804a 15-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: drop 'boolean' keyword

No more users of this keyword. Drop it according to the notice by
commit 6341e62b212a ("kconfig: use bool instead of boolean for type
definition attributes").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>


# 24161a67 08-Oct-2017 Ulf Magnusson <ulfalizer@gmail.com>

kconfig: Don't leak 'source' filenames during parsing

The 'source_stmt' nonterminal takes a 'prompt', which consists of either
a T_WORD or a T_WORD_QUOTE, both of which are always allocated on the
heap in zconf.l and need to have their associated strings freed. Free
them.

The existing code already makes sure to always copy the string, but add
a warning to sym_expand_string_value() to make it clear that the string
must be copied, just in case.

Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:

LEAK SUMMARY:
definitely lost: 387,504 bytes in 15,545 blocks
...

Summary after the fix:

LEAK SUMMARY:
definitely lost: 344,616 bytes in 14,355 blocks
...

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# e3b03bf2 15-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: display recursive dependency resolution hint just once

Commit 1c199f2878f6 ("kbuild: document recursive dependency limitation
/ resolution") probably intended to show a hint along with "recursive
dependency detected!" error, but it missed to add {...} guard, and the
hint is displayed in every loop of the dep_stack traverse, annoyingly.

This error was detected by GCC's -Wmisleading-indentation when switching
to build-time generation of lexer/parser.

scripts/kconfig/symbol.c: In function ‘sym_check_print_recursive’:
scripts/kconfig/symbol.c:1150:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (stack->sym == last_sym)
^~
scripts/kconfig/symbol.c:1153:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n");
^~~~~~~

I could simply add {...} to surround the three fprintf(), but I rather
chose to move the hint after the loop to make the whole message readable.

Fixes: 1c199f2878f6 ("kbuild: document recursive dependency limitation / resolution"
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>


# 88127dae 08-Nov-2017 Heinrich Schuchardt <xypron.glpk@gmx.de>

kconfig/symbol.c: use correct pointer type argument for sizeof

sym_arr is of type struct symbol **.
So in malloc we need sizeof(struct symbol *).

The problem was indicated by coccinelle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 237e3ad0 10-Nov-2016 Nicolas Pitre <nico@fluxnic.net>

Kconfig: Introduce the "imply" keyword

The "imply" keyword is a weak version of "select" where the target
config symbol can still be turned off, avoiding those pitfalls that come
with the "select" keyword.

This is useful e.g. with multiple drivers that want to indicate their
ability to hook into a secondary subsystem while allowing the user to
configure that subsystem out without also having to unset these drivers.

Currently, the same effect can almost be achieved with:

config DRIVER_A
tristate

config DRIVER_B
tristate

config DRIVER_C
tristate

config DRIVER_D
tristate

[...]

config SUBSYSTEM_X
tristate
default DRIVER_A || DRIVER_B || DRIVER_C || DRIVER_D || [...]

This is unwieldy to maintain especially with a large number of drivers.
Furthermore, there is no easy way to restrict the choice for SUBSYSTEM_X
to y or n, excluding m, when some drivers are built-in. The "select"
keyword allows for excluding m, but it excludes n as well. Hence
this "imply" keyword. The above becomes:

config DRIVER_A
tristate
imply SUBSYSTEM_X

config DRIVER_B
tristate
imply SUBSYSTEM_X

[...]

config SUBSYSTEM_X
tristate

This is much cleaner, and way more flexible than "select". SUBSYSTEM_X
can still be configured out, and it can be set as a module when none of
the drivers are configured in or all of them are modular.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: linux-kbuild@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: Michal Marek <mmarek@suse.com>
Cc: Edward Cree <ecree@solarflare.com>
Link: http://lkml.kernel.org/r/1478841010-28605-2-git-send-email-nicolas.pitre@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


# fa64e5f6 29-Apr-2016 Dirk Gouders <dirk@gouders.net>

kconfig/symbol.c: handle choice_values that depend on 'm' symbols

If choices consist of choice_values of type tristate that depend on
symbols set to 'm', those choice_values are not set to 'n' if the
choice is changed from 'm' to 'y' (in which case only one active
choice_value is allowed). Those values are also written to the config
file causing modules to be built when they should not.

The following config can be used to reproduce and examine the problem;
with the frontend of your choice set "Choice 0" and "Choice 1" to 'm',
then set "Tristate Choice" to 'y' and save the configuration:

config modules
boolean modules
default y
option modules

config dependency
tristate "Dependency"
default m

choice
prompt "Tristate Choice"
default choice0

config choice0
tristate "Choice 0"

config choice1
tristate "Choice 1"
depends on dependency

endchoice

This patch sets tristate choice_values' visibility that depend on
symbols set to 'm' to 'n' if the corresponding choice is set to 'y'.

This makes them disappear from the choice list and will also cause the
choice_values' value set to 'n' in sym_calc_value() and as a result
they are written as "not set" to the resulting .config file.

Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Dirk Gouders <dirk@gouders.net>
Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Tested-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Michal Marek <mmarek@suse.com>


# 1c199f28 07-Oct-2015 Luis R. Rodriguez <mcgrof@suse.com>

kbuild: document recursive dependency limitation / resolution

Recursive dependency issues with kconfig are unavoidable due to
some limitations with kconfig, since these issues are recurring
provide a hint to the user how they can resolve these dependency
issues and also document why such limitation exists.

While at it also document a bit of future prospects of ways to
enhance Kconfig, including providing formal semantics and evaluation
of use of a SAT solver. If you're interested in this work or prospects
of it check out the kconfig-sat project wiki [0] and mailing list [1].

[0] http://kernelnewbies.org/KernelProjects/kconfig-sat
[1] https://groups.google.com/d/forum/kconfig-sat

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: James Bottomley <jbottomley@odin.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Mate Soos <soos.mate@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Michal Marek <mmarek@suse.com>


# 35ffd08d 07-Jul-2015 Markus Elfring <elfring@users.sourceforge.net>

kconfig: Delete unnecessary checks before the function call "sym_calc_value"

The sym_calc_value() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Michal Marek <mmarek@suse.com>


# 31847b67 15-Jun-2015 Jan Beulich <JBeulich@suse.com>

kconfig: allow use of relations other than (in)equality

Over the years I found it desirable to be able to use all sorts of
relations, not just (in)equality. And apparently I'm not the only one,
as there's at least one example in the tree where the programmer
assumed this would work (see DEBUG_UART_8250_WORD in
arch/arm/Kconfig.debug). Another possible use would e.g. be to fold the
two SMP/NR_CPUS prompts into one: SMP could be promptless, simply
depending on NR_CPUS > 1.

A (desirable) side effect of this change - resulting from numeric
values now necessarily being compared as numbers rather than as
strings - is that comparing hex values now works as expected: Other
than int ones (which aren't allowed to have leading zeroes), zeroes
following the 0x prefix made them compare unequal even if their values
were equal.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# ad8d40cd 24-Feb-2015 Michal Marek <mmarek@suse.cz>

kconfig: Remove unnecessary prototypes from headers

Signed-off-by: Michal Marek <mmarek@suse.cz>


# 8d9dfe82 03-Oct-2013 Martin Walch <walch.martin@web.de>

kconfig: fix trivial typos and update mconf documentation

This fixes lots of typos in comments and strings.

It also updates the documentation strings in mconf to reflect the changes in
the user interface from the two commits

6364fd0cb1e4c7f72b974613e0cf5744ae4d2cb2
menuconfig: Add Save/Load buttons
1bdbac478a858d2aa73a6784c7c2e09de0f6d06b
menuconfig: Get rid of the top-level entries for "Load an Alternate/Save an Alternate"

And it updates the layout of the example search result, i. e. moves down the
"Defined at" and "Depends on" lines and adds a symbol state ([=n]) to the
symbol in the "Selected by" line.

Furthermore, the help texts now should fit in 80 columns again when viewed
in mconf.

Signed-off-by: Martin Walch <walch.martin@web.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Wang YanQing <udknight@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>


# 129784ab 18-Jul-2013 Kees Cook <keescook@chromium.org>

kconfig: switch to "long long" for sanity

Instead of using "long" for kconfig "hex" and "range" values, which may
change in size depending on the host architecture, use "long long". This
will allow values greater than INT_MAX on 32-bit hosts when cross
compiling.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>


# 508382a0 16-Jul-2013 Yann E. MORIN <yann.morin.1998@free.fr>

kconfig: simplify symbol-search code

There is no need for a double indirection in the temporary array that
stores the internediate search results.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Jean Delvare <jdelvare@suse.de>


# 1407f97a 16-Jul-2013 Yann E. MORIN <yann.morin.1998@free.fr>

kconfig: don't allocate n+1 elements in temporary array

The temporary array that stores the search results is not NULL-terminated,
so there is no reason to allocate n+1 elements.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Jean Delvare <jdelvare@suse.de>


# 803b3519 16-Jul-2013 Yann E. MORIN <yann.morin.1998@free.fr>

kconfig: minor style fixes in symbol-search code

Two minor style fixes:
- no space before/after parenthesis in function definition
- no {} for single-line if()

And one grammar fix in a comment.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>


# 26e933e3 13-Jul-2013 Yann E. MORIN <yann.morin.1998@free.fr>

kconfig: avoid multiple calls to strlen

Calls to strlen are costly, so avoid calling strln as much as we can.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>


# b57caaae 28-Jun-2013 Kees Cook <keescook@chromium.org>

kconfig: allow "hex" and "range" to support longs

The parsing routines for Kconfig files use strtol(), but store and
render values as int. Switch types and formating to long to support a
wider range of values. For example, 0x80000000 wasn't representable.

Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>


# 193b40ae 06-May-2013 Yann E. MORIN <yann.morin.1998@free.fr>

kconfig: sort found symbols by relevance

When searching for symbols, return the symbols sorted by relevance.

Sorting is done as thus:
- first, symbols that match exactly
- then, alphabetical sort

Since the search can be a regexp, it is possible that more than one symbol
matches exactly. In this case, we can't decide which to sort first, so we
fallback to alphabeticall sort.

Explain this (new!) sorting heuristic in the documentation.

Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Roland Eggner <edvx1@systemanalysen.net>
Cc: Wang YanQing <udknight@gmail.com>

--
Changes v1->v2:
- drop the previous, complex heuristic in favour of a simpler heuristic
that is both easier to understand, *and* to maintain (Jean)
- explain sorting heuristic in the doc (Jean)


# fbe98bb9 06-Jun-2013 Arve Hjønnevåg <arve@android.com>

kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on

The defconfig and Kconfig combination below, which is based on 3.10-rc4
Kconfigs, resulted in several options getting set to "m" instead of "y".

defconfig.choice:
---8<---
CONFIG_MODULES=y
CONFIG_USB_ZERO=y
---8<---

Kconfig.choice:
---8<---
menuconfig MODULES
bool "Enable loadable module support"

config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"

config OCFS2_FS
tristate "OCFS2 file system support"
depends on CONFIGFS_FS
select CRC32

config USB_LIBCOMPOSITE
tristate
select CONFIGFS_FS

choice
tristate "USB Gadget Drivers"
default USB_ETH

config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)"
select USB_LIBCOMPOSITE

config USB_ETH
tristate "Ethernet Gadget (with CDC Ethernet support)"
select USB_LIBCOMPOSITE

endchoice

config CRC32
tristate "CRC32/CRC32c functions"
default y

choice
prompt "CRC32 implementation"
depends on CRC32
default CRC32_SLICEBY8

config CRC32_SLICEBY8
bool "Slice by 8 bytes"

endchoice
---8<---

$ scripts/kconfig/conf --defconfig=defconfig.choice Kconfig.choice

would result in:

.config:
---8<---
CONFIG_MODULES=y
CONFIG_CONFIGFS_FS=m
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_ZERO=m
CONFIG_CRC32=y
CONFIG_CRC32_SLICEBY8=y
---8<---

when the expected result would be:

.config:
---8<---
CONFIG_MODULES=y
CONFIG_CONFIGFS_FS=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_ZERO=y
CONFIG_CRC32=y
CONFIG_CRC32_SLICEBY8=y
---8<---

Signed-off-by: Arve Hjønnevåg <arve@android.com>
[yann.morin.1998@free.fr: add the resulting .config to commit log,
remove unneeded USB_GADGET from the defconfig]
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>


# 177acf78 06-Nov-2012 Alan Cox <alan@linux.intel.com>

kconfig: Fix malloc handling in conf tools

(and get them out of the noise in the audit work)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 5d09598d 23-Jan-2012 Arnaud Lacombe <lacombar@gmail.com>

kconfig: fix new choices being skipped upon config update

Running `oldconfig' after any of the following configuration change:

either trivial addition, such as:

config A
bool "A"

choice
prompt "Choice ?"
depends on A

config CHOICE_B
bool "Choice B"

config CHOICE_C
bool "Choice C"
endchoice

or more tricky change:

OLD KCONFIG | NEW KCONFIG
|
| config A
| bool "A"
|
choice | choice
prompt "Choice ?" | prompt "Choice ?"
|
config CHOICE_C | config CHOICE_C
bool "Choice C" | bool "Choice C"
|
config CHOICE_D | config CHOICE_D
bool "Choice D" | bool "Choice D"
endchoice |
| config CHOICE_E
| bool "Choice E"
| depends on A
| endchoice

will not cause the choice to be considered as NEW, and thus not be
asked. The cause of this behavior is that choice's novelty are computed
statically right after the saved configuration has been read. At this
point, the new dependency's value is still unknown and asserted to be
`no'. Moreover, no update to this decision is made afterward.

Correct this by dynamically evaluating a choice's novelty, and removing the
static evaluation.

Reported-and-tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# e54e692b 15-May-2011 Arnaud Lacombe <lacombar@gmail.com>

kconfig: introduce specialized printer

Make conf_write_symbol() grammar agnostic to be able to use it from different
code path. These path pass a printer callback which will print a symbol's name
and its value in different format.

conf_write_symbol()'s job become mostly only to prepare a string for the
printer. This avoid to have to pass specialized flag to generic
functions

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
[mmarek: rebased on top of de12518 (kconfig: autogenerated config_is_xxx
macro)]
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 5a6f8d2b 01-Jun-2011 Arnaud Lacombe <lacombar@gmail.com>

kconfig: nuke LKC_DIRECT_LINK cruft

This interface is not (and has never been ?) used by any frontend, just get rid
of it.

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>


# 1137c56b 26-Sep-2010 Arnaud Lacombe <lacombar@gmail.com>

kconfig: simplify select-with-unmet-direct-dependency warning

This is an attempt to simplify the expressing printed by kconfig when a
symbol is selected but still has direct unmet dependency.

First, the symbol reverse dependency is split in sub-expression. Then,
each sub-expression is checked to ensure that it does not contains the
unmet dependency. This removes the false-positive symbols and fixed symbol
which already have the correct dependency. Finally, only the symbol
responsible of the "select" is printed, instead of its full dependency tree.

CC: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 579fb8e7 04-Dec-2010 Arnaud Lacombe <lacombar@gmail.com>

kconfig: fix typos

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 020e773f 01-Nov-2010 Andy Whitcroft <apw@canonical.com>

kconfig: sym_expand_string_value: allow for string termination when reallocing

When expanding a parameterised string we may run out of space, this
triggers a realloc. When computing the new allocation size we do not
allow for the terminating '\0'. Allow for this when calculating the new
length.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# b1f7d6e1 12-Oct-2010 Michal Marek <mmarek@suse.cz>

Revert "kconfig: Temporarily disable dependency warnings"

This reverts commit 71ebc01, which was a 2.6.36-only stopgap solution.

Signed-off-by: Michal Marek <mmarek@suse.cz>


# 71ebc01d 08-Oct-2010 Michal Marek <mmarek@suse.cz>

kconfig: Temporarily disable dependency warnings

After fixing a use-after-free bug in kconfig, a 'make defconfig' or
'make allmodconfig' fills the screen with warnings that were not
detected before. Given that we are close to the release now, disable the
warnings temporarily and deal with them after 2.6.36.

Signed-off-by: Michal Marek <mmarek@suse.cz>


# 19c29f32 30-Sep-2010 Michal Marek <mmarek@suse.cz>

kconfig: Fix realloc usage()

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 76a54095 17-Aug-2010 Arnaud Lacombe <lacombar@gmail.com>

kconfig: add a symbol string expansion helper

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Michal Marek <mmarek@suse.cz>


# 3643f849 14-Aug-2010 Sam Ravnborg <sam@ravnborg.org>

kconfig: fix segfault when detecting recursive dependency

Following sample Kconfig generated a segfault:

config FOO
bool
select PERF_EVENTS if HAVE_HW_BREAKPOINT

config PERF_EVENTS
bool

config HAVE_HW_BREAKPOINT
bool
depends on PERF_EVENTS

Fix by reverting back to a valid property if there was no
property on the stack of symbols.

The above pattern were seen in sh Kconfig.
A fix for the Kconfig file has been sent to the sh folks.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 7cf3d73b 31-Jul-2010 Sam Ravnborg <sam@ravnborg.org>

kconfig: add savedefconfig

savedefconfig will save a minimal config to a file
named "defconfig".

The config symbols are saved in the same order as
they appear in the menu structure so it should
be possible to map them to the relevant menus
if desired.

The implementation was tested against several minimal
configs for arm which was created using brute-force.

There was one regression related to default numbers
which had their valid range further limited by another symbol.

Sample:

config FOO
int "foo"
default 4

config BAR
int "bar"
range 0 FOO

If FOO is set to 3 then BAR cannot take a value higher than 3.
But the current implementation will set BAR equal to 4.

This is seldomly used and the final configuration is OK,
and the fix was non-trivial.
So it was documented in the code and left as is.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# c252147d 31-Jul-2010 Sam Ravnborg <sam@ravnborg.org>

kconfig: refactor code in symbol.c

Move logic to determine default for a choice to
a separate function.
No functional changes.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# d595cea6 31-Jul-2010 Roman Zippel <zippel@linux-m68k.org>

kconfig: print more info when we see a recursive dependency

Consider following kconfig file:

config TEST1
bool "test 1"
depends on TEST2

config TEST2
bool "test 2"
depends on TEST1

Previously kconfig would report:

foo:6:error: found recursive dependency: TEST2 -> TEST1 -> TEST2

With the following patch kconfig reports:
foo:5:error: recursive dependency detected!
foo:5: symbol TEST2 depends on TEST1
foo:1: symbol TEST1 depends on TEST2

Note that we now report where the offending symbols are defined.
This can be a great help for complex situations involving
several files.

Patch is originally from Roman Zippel with a few adjustments by Sam.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 59e89e3d 31-Jul-2010 Sam Ravnborg <sam@ravnborg.org>

kconfig: save location of config symbols

When we add a new config symbol save the file/line
so we later can refer to their location.

The information is saved as a property to a config symbol
because we may have multiple definitions of the same symbol.

This has the side-effect that a symbol always has
at least one property.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 0a28c47b 30-Jun-2010 Jan Beulich <JBeulich@novell.com>

kconfig: Don't write invisible choice values

This makes it so "make oldconfig" really prompts for any choice where
options that previously weren't visible just became so. Previously one
would have to remember to go over all choice values and check whether
some that previously couldn't be selected now can be.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 246cf9c2 08-Jun-2010 Catalin Marinas <catalin.marinas@arm.com>

kbuild: Warn on selecting symbols with unmet direct dependencies

The "select" statement in Kconfig files allows the enabling of options
even if they have unmet direct dependencies (i.e. "depends on" expands
to "no"). Currently, the "depends on" clauses are used in calculating
the visibility but they do not affect the reverse dependencies in any
way.

The patch introduces additional tracking of the "depends on" statements
and prints a warning on selecting an option if its direct dependencies
are not met.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# da6df879 19-Mar-2010 Li Zefan <lizf@cn.fujitsu.com>

kconfig: recalc symbol value before showing search results

A symbol's value won't be recalc-ed until we save config file or
enter the menu where the symbol sits.

So If I enable OPTIMIZE_FOR_SIZE, and search FUNCTION_GRAPH_TRACER:

Symbol: FUNCTION_GRAPH_TRACER [=y]
Prompt: Kernel Function Graph Tracer
Defined at kernel/trace/Kconfig:140
Depends on: ... [=y] && (!X86_32 [=y] || !CC_OPTIMIZE_FOR_SIZE [=y])
...

From the dependency it should result in FUNCTION_GRAPH_TRACER=n,
but it still shows FUNCTION_GRAPH_TRACER=y.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# e66f25d7 13-Jan-2010 Andi Kleen <andi@firstfloor.org>

Improve kconfig symbol hashing

While looking for something else I noticed that the symbol
hash function used by kconfig is quite poor. It doesn't
use any of the standard hash techniques but simply
adds up the string and then uses power of two masking,
which is both known to perform poorly.

The current x86 kconfig has over 7000 symbols.

When I instrumented it showed that the minimum hash chain
length was 16 and a significant number of them was over
30.

It didn't help that the hash table size was only 256 buckets.

This patch increases the hash table size to a larger prime
and switches to a FNV32 hash. I played around with a couple of hash
functions, but that one seemed to perform best with reasonable
hash table sizes.

Increasing the hash table size even further didn't
seem like a good idea, because there are a couple of global
walks which walk the complete hash table.

I also moved the unnamed bucket to 0. It's still the longest
of all the buckets (44 entries), but hopefully it's not
often hit except for the global walk which doesn't care.

The result is a much nicer distribution:
(first column bucket length, second number of buckets with that length)

1: 3505
2: 1236
3: 294
4: 52
5: 3
47: 1 <--- this is the unnamed symbols bucket

There are still some 5+ buckets, but increasing the hash table
even more would be likely not worth it.

This also cleans up the code slightly by removing hard coded
magic numbers.

I didn't notice a big performance difference either way
on my Nehalem system, but I presume it'll help somewhat
on slower systems.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 4356f489 18-Sep-2009 Trevor Keith <tsrk@tsrk.net>

kbuild: add static to prototypes

Warnings found via gcc -Wmissing-prototypes.

Signed-off-by: Trevor Keith <tsrk@tsrk.net>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 5a1aa8a1 28-Feb-2008 Roman Zippel <zippel@linux-m68k.org>

kconfig: add named choice group

As choice dependency are now fully checked, it's quite easy to add support
for named choices. This lifts the restriction that a choice value can only
appear once, although it still has to be within the same group,
but multiple choices can be joined by giving them a name.
While at it I cleaned up a little the choice type logic to simplify it a
bit.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 48981178 28-Feb-2008 Roman Zippel <zippel@linux-m68k.org>

kconfig: fix choice dependency check

Properly check the dependency of choices as a group.
Also fix that sym_check_deps() correctly terminates the dependency loop
error check (otherwise it would continue printing the dependency chain).

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 587c9061 11-Feb-2008 Roman Zippel <zippel@linux-m68k.org>

kconfig: fix select in combination with default

> The attached .config (with current -git) results in a compile
> error since it contains:
>
> CONFIG_X86=y
> # CONFIG_EMBEDDED is not set
> CONFIG_SERIO=m
> CONFIG_SERIO_I8042=y
>
> Looking at drivers/input/serio/Kconfig I simply don't get how this
> can happen.

You've hit the rather subtle rules of select vs default. What happened is
that SERIO is selected to m, but SERIO_I8042 isn't selected so the default
of y is used instead.
We already had the problem in the past that select and default don't work
well together, so this patch cleans this up and makes the rule hopefully
more straightforward. Basically now the value is calculated like this:

(value && dependency) || select

where the value is the user choice (if available and the symbol is
visible) or default.

In this case it means SERIO and SERIO_I8042 are both set to y due to their
default and if SERIO didn't had the default, then the SERIO_I8042 value
would be limited to m due to the dependency.

I tested this patch with more 10000 random configs and above case is the
only the difference that showed up, so I hope there is nothing that
depended on the old more complex and subtle rules.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Tested-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 80daa560 13-Jan-2008 Roman Zippel <zippel@linux-m68k.org>

kconfig: use environment option

Use the environment option to provide the ARCH symbol
and the KERNELVERSION symbol.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 93449082 13-Jan-2008 Roman Zippel <zippel@linux-m68k.org>

kconfig: environment symbol support

Add the possibility to import a value from the environment into kconfig
via the option syntax. Beside flexibility this has the advantage
providing proper dependencies.
Documented the options syntax.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 7a962923 13-Jan-2008 Roman Zippel <zippel@linux-m68k.org>

kconfig: explicitly introduce expression list

Rename E_CHOICE to E_LIST to explicitly add support for expression
lists. Add a helper macro expr_list_for_each_sym to more easily iterate
over the list.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# d6ee3576 07-Jan-2008 Sam Ravnborg <sam@ravnborg.org>

kconfig: rename E_OR & friends to avoid name clash

We had macros named the same as a set of enumeration values.
It is legal code but very confusing to read - so rename
the macros from E_* to EXPR_*

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>


# 5447d34b 06-May-2007 Sam Ravnborg <sam@ravnborg.org>

kconfig: error out if recursive dependencies are found

Sample:
config FOO
bool "This is foo"
depends on BAR

config BAR
bool "This is bar"
depends on FOO

This will result in following error message:
error: found recursive dependency: FOO -> BAR -> FOO

And will then exit with exit code equal 1 so make will stop.
Inspired by patch from: Adrian Bunk <bunk@stusta.de>

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@stusta.de>
Cc: Roman Zippel <zippel@linux-m68k.org>


# bfc10001 13-Dec-2006 Karsten Wiese <annabellesgarden@yahoo.de>

[PATCH] kconfig: make sym_change_count static, let it be altered by 2 functions only

Those two functions are
void sym_set_change_count(int count)
and
void sym_add_change_count(int count)

All write accesses to sym_change_count are replaced by calls to above
functions.

Variable and changer-functions are moved to confdata.c. IMO thats ok, as
sym_change_count is an attribute of the .config's change state.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# face4374 08-Jun-2006 Roman Zippel <zippel@linux-m68k.org>

kconfig: add defconfig_list/module option

This makes it possible to change two options which were hardcoded sofar.
1. Any symbol can now take the role of CONFIG_MODULES
2. The more useful option is to change the list of default file names,
which kconfig uses to load the base configuration if .config isn't
available.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 669bfad9 08-Jun-2006 Roman Zippel <zippel@linux-m68k.org>

kconfig: allow loading multiple configurations

Extend conf_read_simple() so it can load multiple configurations.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 0c1822e6 08-Jun-2006 Roman Zippel <zippel@linux-m68k.org>

kconfig: allow multiple default values per symbol

Extend struct symbol to allow storing multiple default values, which can be
used to hold multiple configurations.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# c0e150ac 08-Jun-2006 Roman Zippel <zippel@linux-m68k.org>

kconfig: remove SYMBOL_{YES,MOD,NO}

The SYMBOL_{YES,MOD,NO} are not really used anymore (they were more used be
the cml1 converter), so just remove them.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 2244cbd8 15-Jan-2006 Sam Ravnborg <sam@mars.ravnborg.org>

kbuild: create .kernelrelease at *config step

To enable 'make kernelrelease' earlier now create .kernelrelease when
one of the *config targets are used.
Also introduce KERNELVERSION - only user is kconfig.
KERNELVERSION was needed to display kernel version in menuconfig -
KERNELRELEASE is not valid until configuration has completed.
kconfig files modified to use KERNELVERSION.
Bug reported by: Rene Rebe <rene@exactcode.de>

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 4cf3cbe2 08-Nov-2005 Roman Zippel <zippel@linux-m68k.org>

[PATCH] kconfig: allow variable argumnts for range

This allows variable arguments in the range option for int and hex config
symbols.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 3f23ca2b 08-Nov-2005 Roman Zippel <zippel@linux-m68k.org>

[PATCH] kconfig: fix restart for choice symbols

The restart check whether new symbols became visible, didn't always work for
choice symbols. Even if a choice symbol itself isn't changable, the childs
are. This also requires to update the new status of all choice values, once
one of them is set.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 3f04e7dd 08-Nov-2005 David Gibson <david@gibson.dropbear.id.au>

[PATCH] kconfig: Fix Kconfig performance bug

When doing its recursive dependency check, scripts/kconfig/conf uses the flag
SYMBOL_CHECK_DONE to avoid rechecking a symbol it has already checked.
However, that flag is only set at the top level, so if a symbol is first
encountered as a dependency of another symbol it will be rechecked every time
it is encountered until it's encountered at the top level.

This patch adjusts the flag setting so that each symbol will only be checked
once, regardless of whether it is first encountered at the top level, or while
recursing down from another symbol. On complex configurations, this vastly
speeds up scripts/kconfig/conf. The config in the powerpc merge tree is
particularly bad: this patch reduces the time for 'scripts/kconfig/conf -o
arch/powerpc/Kconfig' by a factor of 40 on a G5. That's even including the
time to print the config, so the speedup in the actual checking is more likely
2 or 3 orders of magnitude.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!