1. 16 8月, 2013 1 次提交
    • Y
      kconfig: silence warning when parsing auto.conf when a symbol has changed type · 04b19b77
      Yann E. MORIN 提交于
      When a symbol changes type from tristate to bool, and was previously set to
      'm', a subsequent silentoldconfig would warn about inconsistency, such as:
      
          include/config/auto.conf:3014:warning: symbol value 'm' invalid for
          HOTPLUG_PCI_PCIE
      
      Seen by Linus with the merge in aa8032b6 (sequence to reproduce by Michal):
          git checkout 1fe0135b
          make mrproper
          make allmodconfig
          make silentoldconfig
          git checkout aa8032b6
          make allmodconfig
          make silentoldconfig
      
      Since HOTPLUG_PCI_PCIE changed from tristate to bool in aa8032b6, it was
      previously set to 'm' in auto.conf by the first allmodconfig+silentoldconfig,
      but then was set to 'y' by the second allmodconfig. Then the second
      silentoldconfig prints the warning.
      
      The warning in this case is a spurious warning, which happens at the time
      kconfig tries to detect symbols that have changed, to touch the empty
      header files in include/config used for dependency-tracking by make.
      
      Silence the warning when we read the old auto.conf file, since it is
      perfectly legit that a symbol changed type since the previous call.
      
      Thread in:
          http://marc.info/?l=linux-pci&m=137569198904000&w=2Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      04b19b77
  2. 26 6月, 2013 1 次提交
  3. 25 6月, 2013 2 次提交
    • Y
      kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG · 8357b485
      Yann E. MORIN 提交于
      Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
      is specified.
      
      For example, given those two files (Thomas' test-case):
      
          ---8<--- Config.test.in
          config OPTIONA
              bool "Option A"
      
          choice
              prompt "This is a choice"
      
          config CHOICE_OPTIONA
              bool "Choice Option A"
      
          config CHOICE_OPTIONB
              bool "Choice Option B"
      
          endchoice
      
          config OPTIONB
              bool "Option B"
          ---8<--- Config.test.in
      
          ---8<--- config.defaults
          CONFIG_OPTIONA=y
          ---8<--- config.defaults
      
      And running:
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does properly randomise the two choice symbols (and the two booleans).
      
      However, running:
          KCONFIG_ALLCONFIG=config.defaults \
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
      will ever be selected. (OPTIONA will always be set (expected), and
      OPTIONB will be be properly randomised (expected).)
      
      This patch defers setting that a choice has a value until a symbol for
      that choice is indeed set, so that choices are properly randomised when
      KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.
      Reported-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      
      ---
      Changes v3 -> v4
        - fix previous issue where some choices would not be set, which would
          cause silentoldconfig to ask for them and was then breaking this
          workflow (as reported by Arnd and Sedat):
              KCONFIG_ALLCONFIG=foo.defconfig make randconfig
              make silentoldconfig </dev/nullo
          which I have tested (3h28min!) with:
              touch defconfig
              for(( i=0; i<10000; i++ )); do
                  KCONFIG_ALLCONFIG=$(pwd)/defconfig make randconfig >/dev/null 2>&1
                  make silentoldconfig </dev/null >/dev/null 2>&1 || break
              done
          which did not break at all.
        - change done in v3 (below) is already fixed by a previous patch
      
      Changes v2 -> v3
        - ensure only one symbol is set in a choice
      
      Changes v1 -> v2:
        - further postpone setting that a choice has a value until
          one is indeed set
        - do not print symbols that are part of an invisible choice
      8357b485
    • Y
      kconfig: loop as long as we changed some symbols in randconfig · 3b9a19e0
      Yann E. MORIN 提交于
      Because of choice-in-a-choice constructs, it can happen that not all
      symbols are assigned a value during randconfig, leading in rare cases
      to this situation:
      
          ---8<--- choice-in-choice.in
          choice
              bool "A/B/C"
          config A
              bool "A"
      
          config B
              bool "B"
          if B
          choice
              bool "E/F"
          config E
              bool "E"
          config F
              bool "F"
          endchoice
          endif # B
      
          config C
              bool "C"
          endchoice
          ---8<---
      
          $ ./scripts/kconfig/conf --randconfig choice-in-choice.in
          [--SNIP--]
          $ ./scripts/kconfig/conf --silentoldconfig choice-in-choice.in </dev/null
          [--SNIP--]
          A/B/C
            1. A (A)
          > 2. B (B)
            3. C (C)
          choice[1-3]: 2
            E/F
            > 1. E (E) (NEW)
              2. F (F) (NEW)
            choice[1-2]: aborted!
      
          Console input/output is redirected. Run 'make oldconfig' to update
          configuration.
      
      Fix this by looping in randconfig for as long as some symbol gets assigned
      a value.
      
      Note: this was spotted with the USB EHCI Debug Device Gadget (USB_G_DBGP),
      which uses this choice-in-a-choice construct, and exhibits this problem.
      The example above is just a stripped-down minimalist test-case.
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      3b9a19e0
  4. 19 6月, 2013 1 次提交
    • Y
      kconfig/conf: fix randconfig setting multiple symbols in a choice · e6abf12a
      Yann E. MORIN 提交于
      Currently, randconfig may set more than one symbol in a given choice.
      Given this config file:
          config A
              bool "A"
          if A
          choice
              bool "B/C/D"
          config B
              bool "B"
          config C
              bool "C"
          config D
              bool "D"
          endchoice
          endif # A
      
      Then randconfig generates such .config files (case where A is not set is not
      shown below for brevity), and where only the right-most .config is valid:
        CONFIG_A=y                  CONFIG_A=y                  CONFIG_A=y
        CONFIG_B=y                  CONFIG_B=y                  CONFIG_B=y
        CONFIG_C=y                  # CONFIG_C is not set       # CONFIG_C is not set
        # CONFIG_D is not set       CONFIG_D=y                  # CONFIG_D is not set
      
      That is, in a randomised choice, the first symbol is always selected,
      and at most one other symbol may be selected.
      
      This is due to symbol randomised in a choice not being properly flagged
      as having a value.
      
      Fix that by flagging those symbols adequately: have a user-defined value,
      and be not valid (to force recalculation of the symbol).
      
      Note: if the choice is not conditional, then the randomisation is properly
      done.
      Reported-by: NMatthieu CASTET <matthieu.castet@parrot.com>
      Signed-off-by: NMatthieu CASTET <matthieu.castet@parrot.com>
      [yann.morin.1998@free.fr: independently re-done the same patch as Matthieu,
                                as pointed out by Sedat]
      Cc: Arnaud Lacombe <lacombar@gmail.com>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      e6abf12a
  5. 16 6月, 2013 1 次提交
    • A
      kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on · fbe98bb9
      Arve Hjønnevåg 提交于
      The defconfig and Kconfig combination below, which is based on 3.10-rc4
      Kconfigs, resulted in several options getting set to "m" instead of "y".
      
      defconfig.choice:
      ---8<---
      CONFIG_MODULES=y
      CONFIG_USB_ZERO=y
      ---8<---
      
      Kconfig.choice:
      ---8<---
      menuconfig MODULES
      	bool "Enable loadable module support"
      
      config CONFIGFS_FS
      	tristate "Userspace-driven configuration filesystem"
      
      config OCFS2_FS
              tristate "OCFS2 file system support"
              depends on CONFIGFS_FS
              select CRC32
      
      config USB_LIBCOMPOSITE
      	tristate
      	select CONFIGFS_FS
      
      choice
      	tristate "USB Gadget Drivers"
      	default USB_ETH
      
      config USB_ZERO
      	tristate "Gadget Zero (DEVELOPMENT)"
      	select USB_LIBCOMPOSITE
      
      config USB_ETH
      	tristate "Ethernet Gadget (with CDC Ethernet support)"
      	select USB_LIBCOMPOSITE
      
      endchoice
      
      config CRC32
              tristate "CRC32/CRC32c functions"
              default y
      
      choice
              prompt "CRC32 implementation"
              depends on CRC32
              default CRC32_SLICEBY8
      
      config CRC32_SLICEBY8
              bool "Slice by 8 bytes"
      
      endchoice
      ---8<---
      
      $ scripts/kconfig/conf --defconfig=defconfig.choice Kconfig.choice
      
      would result in:
      
      .config:
      ---8<---
      CONFIG_MODULES=y
      CONFIG_CONFIGFS_FS=m
      CONFIG_USB_LIBCOMPOSITE=m
      CONFIG_USB_ZERO=m
      CONFIG_CRC32=y
      CONFIG_CRC32_SLICEBY8=y
      ---8<---
      
      when the expected result would be:
      
      .config:
      ---8<---
      CONFIG_MODULES=y
      CONFIG_CONFIGFS_FS=y
      CONFIG_USB_LIBCOMPOSITE=y
      CONFIG_USB_ZERO=y
      CONFIG_CRC32=y
      CONFIG_CRC32_SLICEBY8=y
      ---8<---
      Signed-off-by: NArve Hjønnevåg <arve@android.com>
      [yann.morin.1998@free.fr: add the resulting .config to commit log,
                                remove unneeded USB_GADGET from the defconfig]
      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: NYann E. MORIN <yann.morin.1998@free.fr>
      fbe98bb9
  6. 27 4月, 2013 1 次提交
  7. 25 4月, 2013 4 次提交
    • Y
      kconfig: implement KCONFIG_PROBABILITY for randconfig · e43956e6
      Yann E. MORIN 提交于
      Currently the odds to set each symbol is (rounded):
          booleans:   y: 50%          n: 50%
          tristates:  y: 33%  m: 33%  n: 33%
      
      Introduce a KCONFIG_PROBABILITY environment variable to tweak the
      probabilities (in percentage), as such:
          KCONFIG_PROBABILITY     y:n split           y:m:n split
          -----------------------------------------------------------------
      [1] unset or empty          50  : 50            33  : 33  : 34
      [2] N                        N  : 100-N         N/2 : N/2 : 100-N
          N:M                     N+M : 100-(N+M)      N  :  M  : 100-(N+M)
          N:M:L                    N  : 100-N          M  :  L  : 100-(M+L)
      
      [1] The current behaviour is kept as default, for backward compatibility
      [2] The solution initially implemented by Peter for Buildroot, see:
          http://git.buildroot.org/buildroot/commit/?id=3435c1afb5Signed-off-by: NPeter Korsgaard <jacmet@uclibc.org>
      [yann.morin.1998@free.fr: add to Documentation/]
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      e43956e6
    • Y
      kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG · 422c809f
      Yann E. MORIN 提交于
      Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
      is specified.
      
      For example, given those two files (Thomas' test-case):
      
          ---8<--- Config.test.in
          config OPTIONA
              bool "Option A"
      
          choice
              prompt "This is a choice"
      
          config CHOICE_OPTIONA
              bool "Choice Option A"
      
          config CHOICE_OPTIONB
              bool "Choice Option B"
      
          endchoice
      
          config OPTIONB
              bool "Option B"
          ---8<--- Config.test.in
      
          ---8<--- config.defaults
          CONFIG_OPTIONA=y
          ---8<--- config.defaults
      
      And running:
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does properly randomise the two choice symbols (and the two booleans).
      
      However, running:
          KCONFIG_ALLCONFIG=config.defaults \
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
      will ever be selected. (OPTIONA will always be set (expected), and
      OPTIONB will be be properly randomised (expected).)
      
      This patch defers setting that a choice has a value until a symbol for
      that choice is indeed set, so that choices are properly randomised when
      KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.
      
      Also, as a side-efect, this patch fixes the following case:
      
          ---8<---
          choice
          config OPTION_A
              bool "Option A"
          config OPTION_B
              bool "Option B"
          config OPTION_C
              bool "Option C"
          endchoice
          ---8<---
      
      which could previously generate such .config files:
      
          ---8<---                            ---8<---
          CONFIG_OPTION_A=y                   CONFIG_OPTION_A=y
          CONFIG_OPTION_B=y                   # CONFIG_OPTION_B is not set
          # CONFIG_OPTION_C is not set        CONFIG_OPTION_C=y
          ---8<---                            ---8<---
      
      Ie., the first entry in a choice is always set, plus zero or one of
      the other options may be set.
      
      This patch ensures that only one option may be set for a choice.
      Reported-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Arnaud Lacombe <lacombar@gmail.com>
      
      ---
      Changes v2 -> v3
        - ensure only one symbol is set in a choice
      
      Changes v1 -> v2:
        - further postpone setting that a choice has a value until
          one is indeed set
        - do not print symbols that are part of an invisible choice
      422c809f
    • Y
      kconfig: do not override symbols already set · cfa98f2e
      Yann E. MORIN 提交于
      For randconfig, if a list of required symbols is specified with
      KCONFIG_ALLCONFIG, such symbols do not "have a value" as per
      sym_has_value(), but have the "valid" flag set.
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      cfa98f2e
    • Y
      kconfig: fix randconfig tristate detection · 61fa0e17
      Yann E. MORIN 提交于
      Because the modules' symbole (CONFIG_MODULES) may not yet be set when
      we check a symbol's tristate capabilty, we'll always find that tristate
      symbols are booleans, even if we randomly decided that to enable modules:
      sym_get_type(sym) always return boolean for tristates when modules_sym
      has not been previously set to 'y' *and* its value calculated *and* its
      visibility calculated, both of which only occur after we randomly assign
      values to symbols.
      
      Fix that by looking at the raw type of symbols. Tristate set to 'm' will
      be promoted to 'y' when their values will be later calculated.
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      61fa0e17
  8. 14 7月, 2012 1 次提交
  9. 13 4月, 2012 2 次提交
  10. 26 1月, 2012 1 次提交
    • A
      kconfig: fix new choices being skipped upon config update · 5d09598d
      Arnaud Lacombe 提交于
      Running `oldconfig' after any of the following configuration change:
      
      either trivial addition, such as:
      
      config A
      	bool "A"
      
      choice
      	prompt "Choice ?"
      	depends on A
      
      	config CHOICE_B
      		bool "Choice B"
      
      	config CHOICE_C
      		bool "Choice C"
      endchoice
      
      or more tricky change:
      
      OLD KCONFIG                      |  NEW KCONFIG
                                       |
                                       |  config A
                                       |          bool "A"
                                       |
      choice                           |  choice
              prompt "Choice ?"        |          prompt "Choice ?"
                                       |
              config CHOICE_C          |          config CHOICE_C
                      bool "Choice C"  |                  bool "Choice C"
                                       |
              config CHOICE_D          |          config CHOICE_D
                      bool "Choice D"  |                  bool "Choice D"
      endchoice                        |
                                       |          config CHOICE_E
                                       |                  bool "Choice E"
                                       |                  depends on A
                                       |  endchoice
      
      will not cause the choice to be considered as NEW, and thus not be
      asked. The cause of this behavior is that choice's novelty are computed
      statically right after the saved configuration has been read. At this
      point, the new dependency's value is still unknown and asserted to be
      `no'. Moreover, no update to this decision is made afterward.
      
      Correct this by dynamically evaluating a choice's novelty, and removing the
      static evaluation.
      Reported-and-tested-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NArnaud Lacombe <lacombar@gmail.com>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      5d09598d
  11. 19 12月, 2011 1 次提交
    • P
      kconfig: use xfwrite wrapper function to silence warnings · 70cc01e7
      Peter Foley 提交于
      Use the xfwrite wrapper function defined in lkc.h to check the return value of
      fwrite and silence these warnings.
      
        HOSTCC  scripts/kconfig/zconf.tab.o
      scripts/kconfig/zconf.tab.c: In function 'header_print_comment':
      /usr/src/lto/scripts/kconfig/confdata.c:551:10: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
      scripts/kconfig/zconf.tab.c: In function 'kconfig_print_comment':
      /usr/src/lto/scripts/kconfig/confdata.c:467:10: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
      Signed-off-by: NPeter Foley <pefoley2@verizon.net>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      70cc01e7
  12. 30 8月, 2011 1 次提交
  13. 30 7月, 2011 1 次提交
  14. 18 7月, 2011 1 次提交
  15. 01 7月, 2011 1 次提交
    • A
      kconfig: introduce specialized printer · e54e692b
      Arnaud Lacombe 提交于
      Make conf_write_symbol() grammar agnostic to be able to use it from different
      code path. These path pass a printer callback which will print a symbol's name
      and its value in different format.
      
      conf_write_symbol()'s job become mostly only to prepare a string for the
      printer. This avoid to have to pass specialized flag to generic
      functions
      Signed-off-by: NArnaud Lacombe <lacombar@gmail.com>
      [mmarek: rebased on top of de125187 (kconfig: autogenerated config_is_xxx
      macro)]
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      e54e692b
  16. 07 6月, 2011 4 次提交
  17. 25 5月, 2011 1 次提交
  18. 24 5月, 2011 1 次提交
  19. 17 5月, 2011 1 次提交
  20. 18 4月, 2011 1 次提交
  21. 15 12月, 2010 3 次提交
  22. 02 11月, 2010 1 次提交
  23. 04 10月, 2010 1 次提交
  24. 01 10月, 2010 1 次提交
    • N
      kconfig: Don't go out from read config loop when you read new symbol · 8bea7548
      Naohiro Aota 提交于
      commit 8baefd30 of linux-next replaced
      a `switch()' statement with some `if()' statements, but left `break's
      in the `switch()' statement untouched. This cause read config loop to
      exit and so "make oldconfig" is not much usable (see below).
      
      > $ make oldconfig
      ><snip>
      > scripts/kconfig/conf --oldconfig Kconfig
      > #
      > # using defaults found in /boot/config-2.6.34-ccs-r1
      > #
      > *
      > * Restart config...
      > *
      > *
      > * General setup
      > *
      > Prompt for development and/or incomplete code/drivers (EXPERIMENTAL) [N/y/?] (NEW)
      
      (I've already have "CONFIG_EXPERIMENTAL=y" in the old config file. But
      that's not read here.)
      
      This patch should fix this problem.
      Signed-off-by: NNaohiro Aota <naota@elisp.net>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      8bea7548
  25. 20 9月, 2010 3 次提交
  26. 17 8月, 2010 2 次提交
  27. 15 8月, 2010 1 次提交
    • S
      kconfig: fix savedefconfig with choice marked optional · 84062dd3
      Sam Ravnborg 提交于
      savedefconfig failed to save the correct minimal config
      when it encountered a choice marked optional.
      
      Consider following minimal configuration:
      $cat Kconfig
      choice
      	prompt "choice"
      	optional
      
      config A
      	bool "a"
      
      config B
      	bool "b"
      
      endchoice
      
      $cat .config | grep -v ^#
      CONFIG_A=y
      
      $conf --savedefconfig=defconfig Kconfig
      
      would before this fix result in an empty file, because
      kconfig would assume that CONFIG_A=y is a default value.
      But because the choice is optional the default is that
      both A and B are =n.
      
      Fix so we handle optional choices correct.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      84062dd3