1. 25 1月, 2018 1 次提交
    • P
      kconfig: make "Selected by:" and "Implied by:" readable · 1ccb2714
      Petr Vorel 提交于
      Reverse dependency expressions can get rather unwieldy, especially if
      a symbol is selected by more than a handful of other symbols. I.e. it's
      possible to have near endless expressions like:
         A && B && !C || D || F && (G || H) || [...]
      
      Chop these expressions into actually readable chunks:
         - A && B && !C
         - D
         - F && (G || H)
         - [...]
      
      I.e. transform the top level OR tokens into newlines and prepend each
      line with a minus. This makes the "Selected by:" and "Implied by:" blurb
      much easier to read. This is done only if there is more than one top
      level OR. "Depends on:" and "Range :" were deliberately left as they are.
      
      Based on idea from Paul Bolle.
      Suggested-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NPetr Vorel <petr.vorel@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      1ccb2714
  2. 22 1月, 2018 2 次提交
  3. 21 1月, 2018 7 次提交
  4. 15 12月, 2017 3 次提交
    • U
      kconfig: Clean up modules handling and fix crash · f77850d3
      Ulf Magnusson 提交于
      Kconfig currently doesn't handle 'm' appearing in a Kconfig file before
      the modules symbol is defined (the symbol with 'option modules'). The
      problem is the following code, which runs during parsing:
      
      	/* change 'm' into 'm' && MODULES */
      	if (e->left.sym == &symbol_mod)
      		return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
      
      If the modules symbol has not yet been defined, modules_sym is NULL,
      giving an invalid expression.
      
      Here is a test file where both BEFORE_1 and BEFORE_2 trigger a segfault.
      If the modules symbol is removed, all symbols trigger segfaults.
      
      	config BEFORE_1
      		def_tristate y if m
      
      	if m
      	config BEFORE_2
      		def_tristate y
      	endif
      
      	config MODULES
      		def_bool y
      		option modules
      
      	config AFTER_1
      		def_tristate y if m
      
      	if m
      	config AFTER_2
      		def_tristate y
      	endif
      
      Fix the issue by rewriting 'm' in menu_finalize() instead. This function
      runs after parsing and is the proper place to do it. The following
      existing code in conf_parse() in zconf.y ensures that the modules symbol
      exists at that point:
      
      	if (!modules_sym)
      		modules_sym = sym_find( "n" );
      
      	...
      
      	menu_finalize(&rootmenu);
      
      The following tests were done to ensure no functional changes for
      configurations that don't reference 'm' before the modules symbol:
      
      	- zconfdump(stdout) was run with ARCH=x86 and ARCH=arm before
      	  and after the change and verified to produce identical output.
      	  This function prints all symbols, choices, and menus together
      	  with their properties and their dependency expressions. A
      	  rewritten 'm' appears as 'm && MODULES'.
      
      	  A small annoyance is that the assert(len != 0) in xfwrite()
      	  needs to be disabled in order to use zconfdump(), because it
      	  chokes on e.g. 'default ""'.
      
      	- The Kconfiglib test suite was run to indirectly verify that
      	  alldefconfig, allyesconfig, allnoconfig, and all defconfigs in
      	  the kernel still generate the same final .config.
      
      	- Valgrind was used to check for memory errors and (new) memory
      	  leaks.
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      f77850d3
    • U
      kconfig: Clarify expression rewriting · fa8cedae
      Ulf Magnusson 提交于
      menu_finalize() is one of the more opaque parts of Kconfig, and I need
      to make some changes to it to fix an issue related to modules. Add some
      comments related to expression rewriting and dependency propagation as a
      review aid. They will also help other people trying to understand the
      code.
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      fa8cedae
    • U
      kconfig: Rename menu_check_dep() to rewrite_m() · 9a826842
      Ulf Magnusson 提交于
      More directly describes the only thing it does.
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      9a826842
  5. 07 12月, 2017 1 次提交
    • U
      kconfig: Warn if choice default is not in choice · 2c37e084
      Ulf Magnusson 提交于
      This will catch mistakes like in the following real-world example, where
      a "CONFIG_" prefix snuck in, making an undefined symbol the default:
      
      	choice
      		prompt "Compiler optimization level"
      		default CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
      
      	config CC_OPTIMIZE_FOR_PERFORMANCE
      		...
      
      	config CC_OPTIMIZE_FOR_SIZE
      		...
      
      	endchoice
      
      This now prints the following warning:
      
      	init/Kconfig:1036:warning: choice default symbol 'CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE' is not contained in the choice
      
      Cases where the default symbol belongs to the wrong choice are also
      detected.
      
      (The mistake is harmless here: Since the default symbol is not visible,
      the choice falls back on using the first visible symbol as the default,
      which is CC_OPTIMIZE_FOR_PERFORMANCE, as intended.)
      
      Discovered while playing around with Kconfiglib
      (https://github.com/ulfalizer/Kconfiglib).
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      2c37e084
  6. 16 11月, 2016 1 次提交
    • N
      Kconfig: Introduce the "imply" keyword · 237e3ad0
      Nicolas Pitre 提交于
      The "imply" keyword is a weak version of "select" where the target
      config symbol can still be turned off, avoiding those pitfalls that come
      with the "select" keyword.
      
      This is useful e.g. with multiple drivers that want to indicate their
      ability to hook into a secondary subsystem while allowing the user to
      configure that subsystem out without also having to unset these drivers.
      
      Currently, the same effect can almost be achieved with:
      
      config DRIVER_A
      	tristate
      
      config DRIVER_B
      	tristate
      
      config DRIVER_C
      	tristate
      
      config DRIVER_D
      	tristate
      
      [...]
      
      config SUBSYSTEM_X
      	tristate
      	default DRIVER_A || DRIVER_B || DRIVER_C || DRIVER_D || [...]
      
      This is unwieldy to maintain especially with a large number of drivers.
      Furthermore, there is no easy way to restrict the choice for SUBSYSTEM_X
      to y or n, excluding m, when some drivers are built-in. The "select"
      keyword allows for excluding m, but it excludes n as well. Hence
      this "imply" keyword.  The above becomes:
      
      config DRIVER_A
      	tristate
      	imply SUBSYSTEM_X
      
      config DRIVER_B
      	tristate
      	imply SUBSYSTEM_X
      
      [...]
      
      config SUBSYSTEM_X
      	tristate
      
      This is much cleaner, and way more flexible than "select". SUBSYSTEM_X
      can still be configured out, and it can be set as a module when none of
      the drivers are configured in or all of them are modular.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Acked-by: NRichard Cochran <richardcochran@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NJohn Stultz <john.stultz@linaro.org>
      Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
      Cc: Paul Bolle <pebolle@tiscali.nl>
      Cc: linux-kbuild@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: Michal Marek <mmarek@suse.com>
      Cc: Edward Cree <ecree@solarflare.com>
      Link: http://lkml.kernel.org/r/1478841010-28605-2-git-send-email-nicolas.pitre@linaro.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      237e3ad0
  7. 05 1月, 2016 1 次提交
  8. 25 2月, 2015 1 次提交
  9. 28 11月, 2014 1 次提交
  10. 10 6月, 2014 1 次提交
  11. 08 4月, 2014 1 次提交
  12. 09 10月, 2013 3 次提交
  13. 05 9月, 2013 2 次提交
    • Y
      kconfig: do not allow more than one symbol to have 'option modules' · e0627813
      Yann E. MORIN 提交于
      Previously, it was possible to have more than one symbol with the
      'option modules' attached to them, although only the last one would
      in fact control tristates.
      
      Since this does not make much sense, only allow at most one symbol to
      control tristates.
      
      Note: it is still possible to have more than one symbol that control
      tristates, but indirectly:
      
          config MOD1
              bool "mod1"
              select MODULES
          config MOD2
              bool "mod2"
              select MODULES
          config MODULES
              bool
              option modules
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      e0627813
    • Y
      kconfig: do not special-case 'MODULES' symbol · 6902dccf
      Yann E. MORIN 提交于
      Currently, the 'MODULES' symbol is hard-coded to be the default symbol
      that enables/disables tristates, if no other symbol was declared with
      'option modules'.
      
      While this used to be needed for the Linux kernel, we now have an
      explicit 'option modules' attached to the 'MODULES' symbol (since
      cset 11097a03), so we no longer need to special-case it in the
      kconfig code.
      
      Furthermore, kconfig is extensively used out of the Linux kernel, and
      other projects may have another meaning for a symbol named 'MODULES'.
      
      This patch changes the way we enable/disable tristates: if a symbol was
      found with 'option modules' attached to it, then that symbol controls
      enabling tristates. Otherwise, tristates are disabled, even if a symbol
      named 'MODULES' exists.
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      6902dccf
  14. 19 6月, 2013 1 次提交
  15. 30 5月, 2013 1 次提交
    • D
      kconfig/menu.c: fix multiple references to expressions in menu_add_prop() · e983b7b1
      Dirk Gouders 提交于
      menu_add_prop() applies upper menus' visibilities to actual prompts
      by AND-ing the prompts visibilities with the upper menus ones.
      
      This creates a further reference to the menu's visibilities and when
      the expression reduction functions do their work, they may remove or
      modify expressions that have multiple references, thus causing
      unpredictable side-effects.
      
      The following example Kconfig constructs a case where this causes
      problems: a menu and a prompt which's visibilities depend on the same
      symbol.  When invoking mconf with this Kconfig and pressing "Z" we
      see a problem caused by a free'd expression still referenced by the
      menu's visibility:
      
      ------------------------------------------------------------------------
      mainmenu "Kconfig Testing Configuration"
      
      config VISIBLE
      	def_bool n
      
      config Placeholder
      	bool "Place holder"
      
      menu "Invisible"
      	visible if VISIBLE
      
      config TEST_VAR
      	bool "Test option" if VISIBLE
      
      endmenu
      ------------------------------------------------------------------------
      
      This patch fixes this problem by creating copies of the menu's
      visibility expressions before AND-ing them with the prompt's one.
      Signed-off-by: NDirk Gouders <dirk@gouders.net>
      [yann.morin.1998@free.fr: move variable into its block-scope,
                                keep lines <80 chars, typo]
      Tested-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Reviewed-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      e983b7b1
  16. 07 5月, 2013 1 次提交
  17. 01 5月, 2013 1 次提交
  18. 20 11月, 2012 1 次提交
  19. 25 10月, 2012 1 次提交
  20. 28 9月, 2012 2 次提交
  21. 08 8月, 2011 2 次提交
  22. 24 6月, 2011 1 次提交
  23. 07 6月, 2011 3 次提交
  24. 30 12月, 2010 1 次提交