|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5 |
|
| #
a49401be |
| 24-Oct-2024 |
Masahiro Yamada <[email protected]> |
kconfig: document the positional argument in the help message
The positional argument specifies the top-level Kconfig. Include this information in the help message.
Signed-off-by: Masahiro Yamada <
kconfig: document the positional argument in the help message
The positional argument specifies the top-level Kconfig. Include this information in the help message.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5 |
|
| #
bd0db4b6 |
| 18-Jun-2024 |
Masahiro Yamada <[email protected]> |
kconfig: remove sym_get_choice_value()
sym_get_choice_value(menu->sym) is equivalent to sym_calc_choice(menu).
Convert all call sites of sym_get_choice_value() and then remove it.
Signed-off-by: M
kconfig: remove sym_get_choice_value()
sym_get_choice_value(menu->sym) is equivalent to sym_calc_choice(menu).
Convert all call sites of sym_get_choice_value() and then remove it.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
| #
f79dc03f |
| 18-Jun-2024 |
Masahiro Yamada <[email protected]> |
kconfig: refactor choice value calculation
Handling choices has always been in a PITA in Kconfig.
For example, fixes and reverts were repeated for randconfig with KCONFIG_ALLCONFIG:
- 422c809f03f
kconfig: refactor choice value calculation
Handling choices has always been in a PITA in Kconfig.
For example, fixes and reverts were repeated for randconfig with KCONFIG_ALLCONFIG:
- 422c809f03f0 ("kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG") - 23a5dfdad22a ("Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"") - 8357b48549e1 ("kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG") - 490f16171119 ("Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"")
As these commits pointed out, randconfig does not randomize choices when KCONFIG_ALLCONFIG is used. This issue still remains.
[Test Case]
choice prompt "choose"
config A bool "A"
config B bool "B"
endchoice
$ echo > all.config $ make KCONFIG_ALLCONFIG=1 randconfig
The output is always as follows:
CONFIG_A=y # CONFIG_B is not set
Not only randconfig, but other all*config variants are also broken with KCONFIG_ALLCONFIG.
With the same Kconfig,
$ echo '# CONFIG_A is not set' > all.config $ make KCONFIG_ALLCONFIG=1 allyesconfig
You will get this:
CONFIG_A=y # CONFIG_B is not set
This is incorrect because it does not respect all.config.
The correct output should be:
# CONFIG_A is not set CONFIG_B=y
To handle user inputs more accurately, this commit refactors the code based on the following principles:
- When a user value is given, Kconfig must set it immediately. Do not defer it by setting SYMBOL_NEED_SET_CHOICE_VALUES.
- The SYMBOL_DEF_USER flag must not be cleared, unless a new config file is loaded. Kconfig must not forget user inputs.
In addition, user values for choices must be managed with priority. If user inputs conflict within a choice block, the newest value wins. The values given by randconfig have lower priority than explicit user inputs.
This commit implements it by using a linked list. Every time a choice block gets a new input, it is moved to the top of the list.
Let me explain how it works.
Let's say, we have a choice block that consists of five symbols: A, B, C, D, and E.
Initially, the linked list looks like this:
A(=?) --> B(=?) --> C(=?) --> D(=?) --> E(=?)
Suppose randconfig is executed with the following KCONFIG_ALLCONFIG:
CONFIG_C=y # CONFIG_A is not set CONFIG_D=y
First, CONFIG_C=y is read. C is set to 'y' and moved to the top.
C(=y) --> A(=?) --> B(=?) --> D(=?) --> E(=?)
Next, '# CONFIG_A is not set' is read. A is set to 'n' and moved to the top.
A(=n) --> C(=y) --> B(=?) --> D(=?) --> E(=?)
Then, 'CONFIG_D=y' is read. D is set to 'y' and moved to the top.
D(=y) --> A(=n) --> C(=y) --> B(=?) --> E(=?)
Lastly, randconfig shuffles the order of the remaining symbols, resulting in:
D(=y) --> A(=n) --> C(=y) --> B(=y) --> E(=y) or D(=y) --> A(=n) --> C(=y) --> E(=y) --> B(=y)
When calculating the output, the linked list is traversed and the first visible symbol with 'y' is taken. In this case, it is D if visible.
If D is hidden by 'depends on', the next node, A, is examined. Since it is already specified as 'n', it is skipped. Next, C is checked, and selected if it is visible.
If C is also invisible, either B or E is chosen as a result of the randomization.
If B and E are also invisible, the linked list is traversed in the reverse order, and the least prioritized 'n' symbol is chosen. It is A in this case.
Now, Kconfig remembers all user values. This is a big difference from the previous implementation, where Kconfig would forget CONFIG_C=y when CONFIG_D=y appeared in the same input file.
The new appaorch respects user-specified values as much as possible.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc4 |
|
| #
bd988e7c |
| 11-Jun-2024 |
Masahiro Yamada <[email protected]> |
kconfig: introduce choice_set_value() helper
Currently, sym_set_tristate_value() is used to set 'y' to a choice member, which is confusing because it not only sets 'y' to the given symbol but also t
kconfig: introduce choice_set_value() helper
Currently, sym_set_tristate_value() is used to set 'y' to a choice member, which is confusing because it not only sets 'y' to the given symbol but also tweaks flags of other symbols as a side effect.
Add a dedicated function for setting the value of the given choice.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc3, v6.10-rc2 |
|
| #
826ee96d |
| 02-Jun-2024 |
Masahiro Yamada <[email protected]> |
kconfig: refactor conf_set_all_new_symbols() to reduce indentation level
The outer switch statement can be avoided by continue'ing earlier the loop when the symbol type is neither S_BOOLEAN nor S_TR
kconfig: refactor conf_set_all_new_symbols() to reduce indentation level
The outer switch statement can be avoided by continue'ing earlier the loop when the symbol type is neither S_BOOLEAN nor S_TRISTATE.
Remove it to reduce the indentation level by one. In addition, avoid the repetition of sym->def[S_DEF_USER].tri.
No functional change intended.
Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]>
show more ...
|
| #
fde19251 |
| 02-Jun-2024 |
Masahiro Yamada <[email protected]> |
kconfig: remove tristate choice support
I previously submitted a fix for a bug in the choice feature [1], where I mentioned, "Another (much cleaner) approach would be to remove the tristate choice s
kconfig: remove tristate choice support
I previously submitted a fix for a bug in the choice feature [1], where I mentioned, "Another (much cleaner) approach would be to remove the tristate choice support entirely".
There are more issues in the tristate choice feature. For example, you can observe a couple of bugs in the following test code.
[Test Code]
config MODULES def_bool y modules
choice prompt "tristate choice" default A
config A tristate "A"
config B tristate "B"
endchoice
Bug 1: the 'default' property is not correctly processed
'make alldefconfig' produces:
CONFIG_MODULES=y # CONFIG_A is not set # CONFIG_B is not set
However, the correct output should be:
CONFIG_MODULES=y CONFIG_A=y # CONFIG_B is not set
The unit test file, scripts/kconfig/tests/choice/alldef_expected_config, is wrong as well.
Bug 2: choice members never get 'y' with randconfig
For the test code above, the following combinations are possible:
A B (1) y n (2) n y (3) m m (4) m n (5) n m (6) n n
'make randconfig' never produces (1) or (2).
These bugs are fixable, but a more critical problem is the lack of a sensible syntax to specify the default for the tristate choice. The default for the choice must be one of the choice members, which cannot specify any of the patterns (3) through (6) above.
In addition, I have never seen it being used in a useful way.
The following commits removed unnecessary use of tristate choices:
- df8df5e4bc37 ("usb: get rid of 'choice' for legacy gadget drivers") - bfb57ef0544a ("rapidio: remove choice for enumeration")
This commit removes the tristate choice support entirely, which allows me to delete a lot of code, making further refactoring easier.
Note: This includes the revert of commit fa64e5f6a35e ("kconfig/symbol.c: handle choice_values that depend on 'm' symbols"). It was suspicious because it did not address the root cause but introduced inconsistency in visibility between choice members and other symbols.
[1]: https://lore.kernel.org/linux-kbuild/[email protected]/T/#m0a1bb6992581462ceca861b409bb33cb8fd7dbae
Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc1, v6.9, v6.9-rc7 |
|
| #
8c00e580 |
| 04-May-2024 |
Masahiro Yamada <[email protected]> |
kconfig: turn conf_choice() into void function
The return value of conf_choice() is not used.
Signed-off-by: Masahiro Yamada <[email protected]>
|
|
Revision tags: v6.9-rc6, v6.9-rc5 |
|
| #
c2af3d03 |
| 21-Apr-2024 |
Masahiro Yamada <[email protected]> |
kconfig: remove unneeded if-conditional in conf_choice()
All symbols except choices have a name.
child->sym->name never becomes NULL inside choice blocks.
Signed-off-by: Masahiro Yamada <masahiroy
kconfig: remove unneeded if-conditional in conf_choice()
All symbols except choices have a name.
child->sym->name never becomes NULL inside choice blocks.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1 |
|
| #
7e3465f6 |
| 23-Mar-2024 |
Masahiro Yamada <[email protected]> |
kconfig: do not reparent the menu inside a choice block
The boolean 'choice' is used to list exclusively selected config options.
You must not add a dependency between choice members, because such
kconfig: do not reparent the menu inside a choice block
The boolean 'choice' is used to list exclusively selected config options.
You must not add a dependency between choice members, because such a dependency would create an invisible entry.
In the following test case, it is impossible to choose 'C'.
[Test Case 1]
choice prompt "Choose one, but how to choose C?"
config A bool "A"
config B bool "B"
config C bool "C" depends on A
endchoice
Hence, Kconfig shows the following error message:
Kconfig:1:error: recursive dependency detected! Kconfig:1: choice <choice> contains symbol C Kconfig:10: symbol C is part of choice A Kconfig:4: symbol A is part of choice <choice> For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations"
However, Kconfig does not report anything for the following similar code:
[Test Case 2]
choice prompt "Choose one, but how to choose B?"
config A bool "A"
config B bool "B" depends on A
config C bool "C"
endchoice
This is because menu_finalize() reparents the menu tree when an entry depends on the preceding one.
With reparenting, the menu tree:
choice |- A |- B \- C
... will be transformed into the following structure:
choice |- A | \- B \- C
Consequently, Kconfig considers only 'A' and 'C' as choice members. This behavior is awkward. The second test case should be an error too.
This commit stops reparenting inside a choice.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4 |
|
| #
91b69454 |
| 11-Feb-2024 |
Masahiro Yamada <[email protected]> |
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-
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 <[email protected]>
show more ...
|
|
Revision tags: v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3 |
|
| #
15d3f766 |
| 22-Nov-2023 |
Sergey Senozhatsky <[email protected]> |
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.
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 <[email protected]> Signed-off-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc2, v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1, v6.5, v6.5-rc7, v6.5-rc6, v6.5-rc5, v6.5-rc4, v6.5-rc3, v6.5-rc2, v6.5-rc1, v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6, v6.3-rc5, v6.3-rc4, v6.3-rc3, v6.3-rc2, v6.3-rc1, v6.2, v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4, v6.2-rc3, v6.2-rc2, v6.2-rc1, v6.1, v6.1-rc8, v6.1-rc7, v6.1-rc6, v6.1-rc5, v6.1-rc4, v6.1-rc3, v6.1-rc2, v6.1-rc1, v6.0, v6.0-rc7, v6.0-rc6 |
|
| #
efc8338e |
| 14-Sep-2022 |
Zeng Heng <[email protected]> |
Kconfig: remove sym_set_choice_value
sym_set_choice_value could be removed and directly call sym_set_tristate_value instead.
Signed-off-by: Zeng Heng <[email protected]> Suggested-by: Masahiro Y
Kconfig: remove sym_set_choice_value
sym_set_choice_value could be removed and directly call sym_set_tristate_value instead.
Signed-off-by: Zeng Heng <[email protected]> Suggested-by: Masahiro Yamada <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v6.0-rc5, v6.0-rc4, v6.0-rc3, v6.0-rc2, v6.0-rc1, v5.19, v5.19-rc8, v5.19-rc7, v5.19-rc6, v5.19-rc5, v5.19-rc4, v5.19-rc3, v5.19-rc2, v5.19-rc1, v5.18, v5.18-rc7, v5.18-rc6, v5.18-rc5, v5.18-rc4, v5.18-rc3, v5.18-rc2, v5.18-rc1, v5.17, v5.17-rc8, v5.17-rc7, v5.17-rc6, v5.17-rc5, v5.17-rc4, v5.17-rc3, v5.17-rc2, v5.17-rc1, v5.16, v5.16-rc8, v5.16-rc7, v5.16-rc6, v5.16-rc5, v5.16-rc4, v5.16-rc3, v5.16-rc2, v5.16-rc1, v5.15, v5.15-rc7, v5.15-rc6 |
|
| #
c39afe62 |
| 17-Oct-2021 |
Josh Triplett <[email protected]> |
kconfig: Add `make mod2noconfig` to disable module options
When converting a modular kernel to a monolithic kernel, once the kernel works without loading any modules, this helps to quickly disable a
kconfig: Add `make mod2noconfig` to disable module options
When converting a modular kernel to a monolithic kernel, once the kernel works without loading any modules, this helps to quickly disable all the modules before turning off module support entirely.
Refactor conf_rewrite_mod_or_yes to a more general conf_rewrite_tristates that accepts an old and new state.
Signed-off-by: Josh Triplett <[email protected]> Tested-by: Björn Töpel <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v5.15-rc5, v5.15-rc4 |
|
| #
51d792cb |
| 01-Oct-2021 |
Masahiro Yamada <[email protected]> |
kconfig: refactor listnewconfig code
We can reuse __print_symbol() helper to print symbols for listnewconfig. Only the difference is the format for "n" symbols.
This prints "CONFIG_FOO=n" instead o
kconfig: refactor listnewconfig code
We can reuse __print_symbol() helper to print symbols for listnewconfig. Only the difference is the format for "n" symbols.
This prints "CONFIG_FOO=n" instead of "# CONFIG_FOO is not set".
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
| #
229d0cfa |
| 01-Oct-2021 |
Masahiro Yamada <[email protected]> |
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 fr
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 <[email protected]>
show more ...
|
|
Revision tags: v5.15-rc3, v5.15-rc2, v5.15-rc1, v5.14, v5.14-rc7, v5.14-rc6, v5.14-rc5, v5.14-rc4, v5.14-rc3, v5.14-rc2, v5.14-rc1, v5.13, v5.13-rc7, v5.13-rc6, v5.13-rc5, v5.13-rc4 |
|
| #
43ac7110 |
| 28-May-2021 |
Masahiro Yamada <[email protected]> |
kconfig: constify long_opts
getopt_long() does not modify the long_opts structure.
Signed-off-by: Masahiro Yamada <[email protected]>
|
|
Revision tags: v5.13-rc3, v5.13-rc2, v5.13-rc1, v5.12, v5.12-rc8, v5.12-rc7, v5.12-rc6, v5.12-rc5, v5.12-rc4, v5.12-rc3 |
|
| #
ab838577 |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: remove allnoconfig_y option
Now that the only user, CONFIG_EMBEDDED has stopped using this option, remove it entirely.
Signed-off-by: Masahiro Yamada <[email protected]>
|
| #
98f8475c |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: move conf_set_all_new_symbols() to conf.c
This function is only used in conf.c. Move it there together with the randomize_choice_values() helper.
Define 'enum conf_def_mode' locally in con
kconfig: move conf_set_all_new_symbols() to conf.c
This function is only used in conf.c. Move it there together with the randomize_choice_values() helper.
Define 'enum conf_def_mode' locally in conf.c as well.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
| #
15e68d09 |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: move conf_rewrite_mod_or_yes() to conf.c
This function is only used in conf.c.
Signed-off-by: Masahiro Yamada <[email protected]>
|
| #
9a3c3bc8 |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: remove assignment for Kconfig file
Pass av[optind] to conf_parse() directly.
Signed-off-by: Masahiro Yamada <[email protected]>
|
| #
ee4c6f00 |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: add help messages for --help (-h) and --silent (-s)
Add missing options and make the help message more readable.
Signed-off-by: Masahiro Yamada <[email protected]>
|
| #
bafc4791 |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: add long options --help and --silent
They are long options for -h and -s, respectively.
Signed-off-by: Masahiro Yamada <[email protected]>
|
| #
ed562c53 |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: refactor option parse code
The current option parse code is clumsy.
The 's' option is separately handled in an if-conditional due to the following code:
input_mode = (enum input_mode)
kconfig: refactor option parse code
The current option parse code is clumsy.
The 's' option is separately handled in an if-conditional due to the following code:
input_mode = (enum input_mode)opt;
If 's' is moved to the switch statement, the invalid value 's' would be assigned to the input_mode.
Another potential problem is that we are mixing 'enum input_mode' and ASCII characters. They could overwrap if we add more input modes.
To separate them out, set the flag field of long options to a pointer of input_mode_opt. For mode select options, getopt_long() returns 0, which never causes overwrap with ASCII characters that represent short options.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
| #
89145649 |
| 13-Mar-2021 |
Masahiro Yamada <[email protected]> |
kconfig: split randconfig setup code into set_randconfig_seed()
This code is too big to be placed in the switch statement.
Move the code into a new helper function. I slightly refactor the code wit
kconfig: split randconfig setup code into set_randconfig_seed()
This code is too big to be placed in the switch statement.
Move the code into a new helper function. I slightly refactor the code without changing the behavior.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|
|
Revision tags: v5.12-rc2, v5.12-rc1, v5.12-rc1-dontuse |
|
| #
ae8da72b |
| 21-Feb-2021 |
Masahiro Yamada <[email protected]> |
kconfig: omit --oldaskconfig option for 'make config'
scripts/kconfig/conf.c line 39 defines the default of input_mode as oldaskconfig. Hence, 'make config' works in the same way even without the --
kconfig: omit --oldaskconfig option for 'make config'
scripts/kconfig/conf.c line 39 defines the default of input_mode as oldaskconfig. Hence, 'make config' works in the same way even without the --oldaskconfig option given. Note this in the help message.
This will be helpful to unify build rules in Makefile in the next commit.
Signed-off-by: Masahiro Yamada <[email protected]>
show more ...
|