18c2ecf20Sopenharmony_ci# Simple Kconfig recursive issue 28c2ecf20Sopenharmony_ci# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38c2ecf20Sopenharmony_ci# 48c2ecf20Sopenharmony_ci# Test with: 58c2ecf20Sopenharmony_ci# 68c2ecf20Sopenharmony_ci# make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig 78c2ecf20Sopenharmony_ci# 88c2ecf20Sopenharmony_ci# This Kconfig file has a simple recursive dependency issue. In order to 98c2ecf20Sopenharmony_ci# understand why this recursive dependency issue occurs lets consider what 108c2ecf20Sopenharmony_ci# Kconfig needs to address. We iterate over what Kconfig needs to address 118c2ecf20Sopenharmony_ci# by stepping through the questions it needs to address sequentially. 128c2ecf20Sopenharmony_ci# 138c2ecf20Sopenharmony_ci# * What values are possible for CORE? 148c2ecf20Sopenharmony_ci# 158c2ecf20Sopenharmony_ci# CORE_BELL_A_ADVANCED selects CORE, which means that it influences the values 168c2ecf20Sopenharmony_ci# that are possible for CORE. So for example if CORE_BELL_A_ADVANCED is 'y', 178c2ecf20Sopenharmony_ci# CORE must be 'y' too. 188c2ecf20Sopenharmony_ci# 198c2ecf20Sopenharmony_ci# * What influences CORE_BELL_A_ADVANCED ? 208c2ecf20Sopenharmony_ci# 218c2ecf20Sopenharmony_ci# As the name implies CORE_BELL_A_ADVANCED is an advanced feature of 228c2ecf20Sopenharmony_ci# CORE_BELL_A so naturally it depends on CORE_BELL_A. So if CORE_BELL_A is 'y' 238c2ecf20Sopenharmony_ci# we know CORE_BELL_A_ADVANCED can be 'y' too. 248c2ecf20Sopenharmony_ci# 258c2ecf20Sopenharmony_ci# * What influences CORE_BELL_A ? 268c2ecf20Sopenharmony_ci# 278c2ecf20Sopenharmony_ci# CORE_BELL_A depends on CORE, so CORE influences CORE_BELL_A. 288c2ecf20Sopenharmony_ci# 298c2ecf20Sopenharmony_ci# But that is a problem, because this means that in order to determine 308c2ecf20Sopenharmony_ci# what values are possible for CORE we ended up needing to address questions 318c2ecf20Sopenharmony_ci# regarding possible values of CORE itself again. Answering the original 328c2ecf20Sopenharmony_ci# question of what are the possible values of CORE would make the kconfig 338c2ecf20Sopenharmony_ci# tools run in a loop. When this happens Kconfig exits and complains about 348c2ecf20Sopenharmony_ci# the "recursive dependency detected" error. 358c2ecf20Sopenharmony_ci# 368c2ecf20Sopenharmony_ci# Reading the Documentation/kbuild/Kconfig.recursion-issue-01 file it may be 378c2ecf20Sopenharmony_ci# obvious that an easy to solution to this problem should just be the removal 388c2ecf20Sopenharmony_ci# of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already 398c2ecf20Sopenharmony_ci# since CORE_BELL_A depends on CORE. Recursive dependency issues are not always 408c2ecf20Sopenharmony_ci# so trivial to resolve, we provide another example below of practical 418c2ecf20Sopenharmony_ci# implications of this recursive issue where the solution is perhaps not so 428c2ecf20Sopenharmony_ci# easy to understand. Note that matching semantics on the dependency on 438c2ecf20Sopenharmony_ci# CORE also consist of a solution to this recursive problem. 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cimainmenu "Simple example to demo kconfig recursive dependency issue" 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciconfig CORE 488c2ecf20Sopenharmony_ci tristate 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciconfig CORE_BELL_A 518c2ecf20Sopenharmony_ci tristate 528c2ecf20Sopenharmony_ci depends on CORE 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciconfig CORE_BELL_A_ADVANCED 558c2ecf20Sopenharmony_ci tristate 568c2ecf20Sopenharmony_ci depends on CORE_BELL_A 578c2ecf20Sopenharmony_ci select CORE 58