From 5f3d307155f4db035b652738e9fc49ad8be0c792 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 25 Sep 2017 20:24:11 +0200 Subject: Fix 'default' on non-visible choice symbols Previously, 'default CHOICE_SYM [if ]' in a choice would skip any following 'default' properties if was non-'n'. However, those other defaults should still be considered if CHOICE_SYM has visibility 'n'. Previously, we'd immediately fall back to selecting the first visible symbol in the choice in that case. get_selection_from_defaults() now exactly mirrors sym_choice_default() from the C implementation, and got less convoluted too. Nothing in the kernel defconfigs triggered this. Add a new test case too. --- tests/Kchoice | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/Kchoice b/tests/Kchoice index 1e841ca..e80e222 100644 --- a/tests/Kchoice +++ b/tests/Kchoice @@ -75,6 +75,26 @@ config OPT_4 tristate "OPT_4" endchoice +choice DEFAULTS_NOT_VISIBLE + bool "defaults not visible" + # Skipped due to condition + default OPT_6 if n + # Skipped because OPT_7 is not visible + default OPT_7 + # This one should apply + default OPT_8 +config OPT_5 + tristate "OPT_5" +config OPT_6 + tristate "OPT_6" +config OPT_7 + tristate "OPT_7" if n +config OPT_8 + tristate "OPT_8" +config OPT_9 + tristate "OPT_9" +endchoice + # Choices without an explicitly specified type should get the type of the first # symbol with a type -- cgit v1.2.3