Back to home page

OSCL-LXR

 
 

    


0001 # Simple Kconfig recursive issue
0002 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0003 #
0004 # Test with:
0005 #
0006 # make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
0007 #
0008 # This Kconfig file has a simple recursive dependency issue. In order to
0009 # understand why this recursive dependency issue occurs lets consider what
0010 # Kconfig needs to address. We iterate over what Kconfig needs to address
0011 # by stepping through the questions it needs to address sequentially.
0012 #
0013 #  * What values are possible for CORE?
0014 #
0015 # CORE_BELL_A_ADVANCED selects CORE, which means that it influences the values
0016 # that are possible for CORE. So for example if CORE_BELL_A_ADVANCED is 'y',
0017 # CORE must be 'y' too.
0018 #
0019 #  * What influences CORE_BELL_A_ADVANCED ?
0020 #
0021 # As the name implies CORE_BELL_A_ADVANCED is an advanced feature of
0022 # CORE_BELL_A so naturally it depends on CORE_BELL_A. So if CORE_BELL_A is 'y'
0023 # we know CORE_BELL_A_ADVANCED can be 'y' too.
0024 #
0025 #   * What influences CORE_BELL_A ?
0026 #
0027 # CORE_BELL_A depends on CORE, so CORE influences CORE_BELL_A.
0028 #
0029 # But that is a problem, because this means that in order to determine
0030 # what values are possible for CORE we ended up needing to address questions
0031 # regarding possible values of CORE itself again. Answering the original
0032 # question of what are the possible values of CORE would make the kconfig
0033 # tools run in a loop. When this happens Kconfig exits and complains about
0034 # the "recursive dependency detected" error.
0035 #
0036 # Reading the Documentation/kbuild/Kconfig.recursion-issue-01 file it may be
0037 # obvious that an easy to solution to this problem should just be the removal
0038 # of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already
0039 # since CORE_BELL_A depends on CORE. Recursive dependency issues are not always
0040 # so trivial to resolve, we provide another example below of practical
0041 # implications of this recursive issue where the solution is perhaps not so
0042 # easy to understand. Note that matching semantics on the dependency on
0043 # CORE also consist of a solution to this recursive problem.
0044 
0045 mainmenu "Simple example to demo kconfig recursive dependency issue"
0046 
0047 config CORE
0048         tristate
0049 
0050 config CORE_BELL_A
0051         tristate
0052         depends on CORE
0053 
0054 config CORE_BELL_A_ADVANCED
0055         tristate
0056         depends on CORE_BELL_A
0057         select CORE