kconfig: remove tristate choice supportI previously submitted a fix for a bug in the choice feature [1], whereI mentioned, "Another (much cleaner) approach would be to remove thetristate choice s
kconfig: remove tristate choice supportI previously submitted a fix for a bug in the choice feature [1], whereI mentioned, "Another (much cleaner) approach would be to remove thetristate choice support entirely".There are more issues in the tristate choice feature. For example, youcan 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" endchoiceBug 1: the 'default' property is not correctly processed'make alldefconfig' produces: CONFIG_MODULES=y # CONFIG_A is not set # CONFIG_B is not setHowever, the correct output should be: CONFIG_MODULES=y CONFIG_A=y # CONFIG_B is not setThe unit test file, scripts/kconfig/tests/choice/alldef_expected_config,is wrong as well.Bug 2: choice members never get 'y' with randconfigFor 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 asensible syntax to specify the default for the tristate choice.The default for the choice must be one of the choice members, whichcannot 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 allowsme 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 suspiciousbecause it did not address the root cause but introduced inconsistencyin visibility between choice members and other symbols.[1]: https://lore.kernel.org/linux-kbuild/[email protected]/T/#m0a1bb6992581462ceca861b409bb33cb8fd7dbaeSigned-off-by: Masahiro Yamada <[email protected]>Reviewed-by: Nicolas Schier <[email protected]>
show more ...
kconfig: remove 'optional' property supportThe 'choice' statement is primarily used to exclusively select oneoption, but the 'optional' property allows all entries to be disabled.In the followin
kconfig: remove 'optional' property supportThe 'choice' statement is primarily used to exclusively select oneoption, but the 'optional' property allows all entries to be disabled.In the following example, both A and B can be disabled simultaneously: choice prompt "choose A, B, or nothing" optional config A bool "A" config B bool "B" endchoiceYou can achieve the equivalent outcome by other means.A common solution is to add another option to guard the choice block.In the following example, you can set ENABLE_A_B_CHOICE=n to disablethe entire choice block: choice prompt "choose A or B" depends on ENABLE_A_B_CHOICE config A bool "A" config B bool "B" endchoiceAnother approach is to insert one more entry: choice prompt "choose A, B, or disable both" config A bool "A" config B bool "B" config DISABLE_A_AND_B bool "choose this to disable both A and B" endchoiceSome real examples are DEBUG_INFO_NONE, INITRAMFS_COMPRESSION_NONE,LTO_NONE, etc.The 'optional' property is even more unnecessary for a tristate choice.Without the 'optional' property, you can disable A and B; you can set'm' in the choice prompt, and disable A and B individually: choice prompt "choose one built-in or make them modular" config A tristate "A" config B tristate "B" endchoiceIn conclusion, the 'optional' property was unneeded.Signed-off-by: Masahiro Yamada <[email protected]>Reviewed-by: Nicolas Schier <[email protected]>
kconfig: change "modules" from sub-option to first-level attributeNow "modules" is the only member of the "option" property.Remove "option", and move "modules" to the top level property.Signed-
kconfig: change "modules" from sub-option to first-level attributeNow "modules" is the only member of the "option" property.Remove "option", and move "modules" to the top level property.Signed-off-by: Masahiro Yamada <[email protected]>
kconfig: convert to SPDX License IdentifierAll files in lxdialog/ are licensed under GPL-2.0+, and the rest areunder GPL-2.0. I added GPL-2.0 tags to test scripts in tests/.Documentation/process
kconfig: convert to SPDX License IdentifierAll files in lxdialog/ are licensed under GPL-2.0+, and the rest areunder GPL-2.0. I added GPL-2.0 tags to test scripts in tests/.Documentation/process/license-rules.rst does not suggest anythingabout 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 forzconf.l, and so for zconf.y for consistency.Signed-off-by: Masahiro Yamada <[email protected]>
kconfig: tests: add basic choice testsThe calculation of 'choice' is a bit complicated part in Kconfig.The behavior of 'y' choice is intuitive. If choice values are tristate,the choice can be '
kconfig: tests: add basic choice testsThe calculation of 'choice' is a bit complicated part in Kconfig.The behavior of 'y' choice is intuitive. If choice values are tristate,the choice can be 'm' where each value can be enabled independently.Also, if a choice is marked as 'optional', the whole choice can beinvisible.Test basic functionality of choice.Signed-off-by: Masahiro Yamada <[email protected]>Reviewed-by: Ulf Magnusson <[email protected]>