162306a36Sopenharmony_ci# Simple Kconfig recursive issue 262306a36Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362306a36Sopenharmony_ci# 462306a36Sopenharmony_ci# Test with: 562306a36Sopenharmony_ci# 662306a36Sopenharmony_ci# make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig 762306a36Sopenharmony_ci# 862306a36Sopenharmony_ci# This Kconfig file has a simple recursive dependency issue. In order to 962306a36Sopenharmony_ci# understand why this recursive dependency issue occurs lets consider what 1062306a36Sopenharmony_ci# Kconfig needs to address. We iterate over what Kconfig needs to address 1162306a36Sopenharmony_ci# by stepping through the questions it needs to address sequentially. 1262306a36Sopenharmony_ci# 1362306a36Sopenharmony_ci# * What values are possible for CORE? 1462306a36Sopenharmony_ci# 1562306a36Sopenharmony_ci# CORE_BELL_A_ADVANCED selects CORE, which means that it influences the values 1662306a36Sopenharmony_ci# that are possible for CORE. So for example if CORE_BELL_A_ADVANCED is 'y', 1762306a36Sopenharmony_ci# CORE must be 'y' too. 1862306a36Sopenharmony_ci# 1962306a36Sopenharmony_ci# * What influences CORE_BELL_A_ADVANCED ? 2062306a36Sopenharmony_ci# 2162306a36Sopenharmony_ci# As the name implies CORE_BELL_A_ADVANCED is an advanced feature of 2262306a36Sopenharmony_ci# CORE_BELL_A so naturally it depends on CORE_BELL_A. So if CORE_BELL_A is 'y' 2362306a36Sopenharmony_ci# we know CORE_BELL_A_ADVANCED can be 'y' too. 2462306a36Sopenharmony_ci# 2562306a36Sopenharmony_ci# * What influences CORE_BELL_A ? 2662306a36Sopenharmony_ci# 2762306a36Sopenharmony_ci# CORE_BELL_A depends on CORE, so CORE influences CORE_BELL_A. 2862306a36Sopenharmony_ci# 2962306a36Sopenharmony_ci# But that is a problem, because this means that in order to determine 3062306a36Sopenharmony_ci# what values are possible for CORE we ended up needing to address questions 3162306a36Sopenharmony_ci# regarding possible values of CORE itself again. Answering the original 3262306a36Sopenharmony_ci# question of what are the possible values of CORE would make the kconfig 3362306a36Sopenharmony_ci# tools run in a loop. When this happens Kconfig exits and complains about 3462306a36Sopenharmony_ci# the "recursive dependency detected" error. 3562306a36Sopenharmony_ci# 3662306a36Sopenharmony_ci# Reading the Documentation/kbuild/Kconfig.recursion-issue-01 file it may be 3762306a36Sopenharmony_ci# obvious that an easy to solution to this problem should just be the removal 3862306a36Sopenharmony_ci# of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already 3962306a36Sopenharmony_ci# since CORE_BELL_A depends on CORE. Recursive dependency issues are not always 4062306a36Sopenharmony_ci# so trivial to resolve, we provide another example below of practical 4162306a36Sopenharmony_ci# implications of this recursive issue where the solution is perhaps not so 4262306a36Sopenharmony_ci# easy to understand. Note that matching semantics on the dependency on 4362306a36Sopenharmony_ci# CORE also consist of a solution to this recursive problem. 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_cimainmenu "Simple example to demo kconfig recursive dependency issue" 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ciconfig CORE 4862306a36Sopenharmony_ci tristate 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ciconfig CORE_BELL_A 5162306a36Sopenharmony_ci tristate 5262306a36Sopenharmony_ci depends on CORE 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciconfig CORE_BELL_A_ADVANCED 5562306a36Sopenharmony_ci tristate 5662306a36Sopenharmony_ci depends on CORE_BELL_A 5762306a36Sopenharmony_ci select CORE 58