1*4882a593Smuzhiyun# Simple Kconfig recursive issue 2*4882a593Smuzhiyun# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun# Test with: 5*4882a593Smuzhiyun# 6*4882a593Smuzhiyun# make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig 7*4882a593Smuzhiyun# 8*4882a593Smuzhiyun# This Kconfig file has a simple recursive dependency issue. In order to 9*4882a593Smuzhiyun# understand why this recursive dependency issue occurs lets consider what 10*4882a593Smuzhiyun# Kconfig needs to address. We iterate over what Kconfig needs to address 11*4882a593Smuzhiyun# by stepping through the questions it needs to address sequentially. 12*4882a593Smuzhiyun# 13*4882a593Smuzhiyun# * What values are possible for CORE? 14*4882a593Smuzhiyun# 15*4882a593Smuzhiyun# CORE_BELL_A_ADVANCED selects CORE, which means that it influences the values 16*4882a593Smuzhiyun# that are possible for CORE. So for example if CORE_BELL_A_ADVANCED is 'y', 17*4882a593Smuzhiyun# CORE must be 'y' too. 18*4882a593Smuzhiyun# 19*4882a593Smuzhiyun# * What influences CORE_BELL_A_ADVANCED ? 20*4882a593Smuzhiyun# 21*4882a593Smuzhiyun# As the name implies CORE_BELL_A_ADVANCED is an advanced feature of 22*4882a593Smuzhiyun# CORE_BELL_A so naturally it depends on CORE_BELL_A. So if CORE_BELL_A is 'y' 23*4882a593Smuzhiyun# we know CORE_BELL_A_ADVANCED can be 'y' too. 24*4882a593Smuzhiyun# 25*4882a593Smuzhiyun# * What influences CORE_BELL_A ? 26*4882a593Smuzhiyun# 27*4882a593Smuzhiyun# CORE_BELL_A depends on CORE, so CORE influences CORE_BELL_A. 28*4882a593Smuzhiyun# 29*4882a593Smuzhiyun# But that is a problem, because this means that in order to determine 30*4882a593Smuzhiyun# what values are possible for CORE we ended up needing to address questions 31*4882a593Smuzhiyun# regarding possible values of CORE itself again. Answering the original 32*4882a593Smuzhiyun# question of what are the possible values of CORE would make the kconfig 33*4882a593Smuzhiyun# tools run in a loop. When this happens Kconfig exits and complains about 34*4882a593Smuzhiyun# the "recursive dependency detected" error. 35*4882a593Smuzhiyun# 36*4882a593Smuzhiyun# Reading the Documentation/kbuild/Kconfig.recursion-issue-01 file it may be 37*4882a593Smuzhiyun# obvious that an easy to solution to this problem should just be the removal 38*4882a593Smuzhiyun# of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already 39*4882a593Smuzhiyun# since CORE_BELL_A depends on CORE. Recursive dependency issues are not always 40*4882a593Smuzhiyun# so trivial to resolve, we provide another example below of practical 41*4882a593Smuzhiyun# implications of this recursive issue where the solution is perhaps not so 42*4882a593Smuzhiyun# easy to understand. Note that matching semantics on the dependency on 43*4882a593Smuzhiyun# CORE also consist of a solution to this recursive problem. 44*4882a593Smuzhiyun 45*4882a593Smuzhiyunmainmenu "Simple example to demo kconfig recursive dependency issue" 46*4882a593Smuzhiyun 47*4882a593Smuzhiyunconfig CORE 48*4882a593Smuzhiyun tristate 49*4882a593Smuzhiyun 50*4882a593Smuzhiyunconfig CORE_BELL_A 51*4882a593Smuzhiyun tristate 52*4882a593Smuzhiyun depends on CORE 53*4882a593Smuzhiyun 54*4882a593Smuzhiyunconfig CORE_BELL_A_ADVANCED 55*4882a593Smuzhiyun tristate 56*4882a593Smuzhiyun depends on CORE_BELL_A 57*4882a593Smuzhiyun select CORE 58