aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/expr.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-11-16Kconfig: Introduce the "imply" keywordNicolas Pitre1-0/+2
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: Nicolas Pitre <nico@linaro.org> Acked-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <john.stultz@linaro.org> Reviewed-by: Josh 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.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2015-06-15kconfig: allow use of relations other than (in)equalityJan Beulich1-1/+3
Over the years I found it desirable to be able to use all sorts of relations, not just (in)equality. And apparently I'm not the only one, as there's at least one example in the tree where the programmer assumed this would work (see DEBUG_UART_8250_WORD in arch/arm/Kconfig.debug). Another possible use would e.g. be to fold the two SMP/NR_CPUS prompts into one: SMP could be promptless, simply depending on NR_CPUS > 1. A (desirable) side effect of this change - resulting from numeric values now necessarily being compared as numbers rather than as strings - is that comparing hex values now works as expected: Other than int ones (which aren't allowed to have leading zeroes), zeroes following the 0x prefix made them compare unequal even if their values were equal. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-02-25kconfig: Remove unnecessary prototypes from headersMichal Marek1-5/+0
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-04-07kconfig: make allnoconfig disable options behind EMBEDDED and EXPERTJosh Triplett1-0/+3
"make allnoconfig" exists to ease testing of minimal configurations. Documentation/SubmitChecklist includes a note to test with allnoconfig. This helps catch missing dependencies on common-but-not-required functionality, which might otherwise go unnoticed. However, allnoconfig still leaves many symbols enabled, because they're hidden behind CONFIG_EMBEDDED or CONFIG_EXPERT. For instance, allnoconfig still has CONFIG_PRINTK and CONFIG_BLOCK enabled, so drivers don't typically get build-tested with those disabled. To address this, introduce a new Kconfig option "allnoconfig_y", used on symbols which only exist to hide other symbols. Set it on CONFIG_EMBEDDED (which then selects CONFIG_EXPERT). allnoconfig will then disable all the symbols hidden behind those. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-10-08kconfig: add short explanation to SYMBOL_WRITEMartin Walch1-1/+1
replace the question mark in the comment after SYMBOL_WRITE with an explanation Signed-off-by: Martin Walch <walch.martin@web.de> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2013-06-16kconfig: Fix defconfig when one choice menu selects options that another choice menu depends onArve Hjønnevåg1-0/+3
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: Arve 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: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2012-10-25menuconfig: Replace CIRCLEQ by list_head-style lists.Benjamin Poirier1-3/+2
sys/queue.h and CIRCLEQ in particular have proven to cause portability problems (reported on Debian Sarge, Cygwin and FreeBSD) Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Tested-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Signed-off-by: Benjamin Poirier <bpoirier@suse.de> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-09-27menuconfig: Assign jump keys per-page instead of globallyBenjamin Poirier1-0/+9
At the moment, keys 1-9 are assigned to the first 9 search results. This patch makes them assigned to the first 9 results per-page instead. We are much less likely to run out of keys that way. Signed-off-by: Benjamin Poirier <bpoirier@suse.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-09-27menuconfig: Add jump keys to search resultsBenjamin Poirier1-0/+2
makes it possible to jump directly to the menu for a configuration entry after having searched for it with '/'. If this menu is not currently accessible we jump to the nearest accessible parent instead. After exiting this menu, the user is returned to the search results where he may jump further in or elsewhere. Signed-off-by: Benjamin Poirier <bpoirier@suse.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-01-15kbuild: Fix compiler warning with assertion when calling 'fwrite'Arnaud Lacombe1-0/+1
Reinhard Tartler discovered a corner case of calling xfwrite() where the length of the string is zero. Arnaud Lacombe suggested to use assertion for the corner case, as fwrite(3) is currently used: 1) in comment printers. Empty comment are not allowed. 2) in a callback passed to expr_print(), where the string printed is either NULL OR non-empty. 3) in the lexer, auto-generated, and unused. I feel using assertion is a good solution: 1) It cleanly takes care of the above-mentioned corner case. 2) It can be easily disabled by defining NDEBUG. 3) It asserts xfwrite() is simply a wrapper for fwrite(). Reported-by: Reinhard Tartler <Reinhard.Tartler@informatik.uni-erlangen.de> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Signed-off-by: Jean Sacren <sakiwit@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-06-06kconfig: nuke reference to SWIGArnaud Lacombe1-3/+0
SWIG is not used (yet?) to create kconfig binding, so there is no point referencing it. Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-04-15kconfig: get rid of unused flagsYann E. MORIN1-4/+0
Now that we detect recusrion of sourced files, get rid of now unused flags. Regenerate lex.zconf.c_shipped file. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-01-10Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6Linus Torvalds1-1/+2
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: nconf: handle comment entries within choice/endchoice kconfig: fix warning kconfig: Make expr_copy() take a const argument kconfig: simplify select-with-unmet-direct-dependency warning kconfig: add more S_INT and S_HEX consistency checks kconfig: fix `zconfdebug' extern declaration kconfig/conf: merge duplicate switch's case kconfig: fix typos kbuild/gconf: add dummy inline for bind_textdomain_codeset() kbuild/nconf: fix spaces damage kconfig: nuke second argument of conf_write_symbol() kconfig: do not define AUTOCONF_INCLUDED kconfig: the day kconfig warns about "select"-abuse has come
2010-12-27kconfig: fix warningArnaud Lacombe1-0/+1
In file included from scripts/kconfig/zconf.tab.c:2502: scripts/kconfig/expr.c:1033: warning: no previous prototype for 'expr_simplify_unmet_dep' Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-12-21kconfig: Make expr_copy() take a const argumentMichal Marek1-1/+1
Fixes scripts/kconfig/expr.c: In function ‘expr_get_leftmost_symbol’: scripts/kconfig/expr.c:1026:2: warning: passing argument 1 of ‘expr_copy’ discards qualifiers from pointer target type scripts/kconfig/expr.c:67:14: note: expected ‘struct expr *’ but argument is of type ‘const struct expr *’ Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-11-22kconfig: add an option to determine a menu's visibilityArnaud Lacombe1-0/+1
This option is aimed to add the possibility to control a menu's visibility without adding dependency to the expression to all the submenu. Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-12Merge branch 'kbuild/rc-fixes' into kbuild/kconfigMichal Marek1-1/+0
We need to revert the temporary hack in 71ebc01, hence the merge.
2010-10-04kconfig: delay symbol direct dependency initializationArnaud Lacombe1-1/+0
This fixes the use-after-free and associated crash in kconfig introduced in commit 246cf9c26bf11f2bffbecea6e5bd222eee7b1df8. Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-09-19kconfig: constify file nameArnaud Lacombe1-1/+1
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Michal Marek <mmarek@suse.cz>
2010-08-03kconfig: save location of config symbolsSam Ravnborg1-0/+1
When we add a new config symbol save the file/line so we later can refer to their location. The information is saved as a property to a config symbol because we may have multiple definitions of the same symbol. This has the side-effect that a symbol always has at least one property. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-07-02kbuild: Warn on selecting symbols with unmet direct dependenciesCatalin Marinas1-0/+2
The "select" statement in Kconfig files allows the enabling of options even if they have unmet direct dependencies (i.e. "depends on" expands to "no"). Currently, the "depends on" clauses are used in calculating the visibility but they do not affect the reverse dependencies in any way. The patch introduces additional tracking of the "depends on" statements and prints a warning on selecting an option if its direct dependencies are not met. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02Improve kconfig symbol hashingAndi Kleen1-3/+2
While looking for something else I noticed that the symbol hash function used by kconfig is quite poor. It doesn't use any of the standard hash techniques but simply adds up the string and then uses power of two masking, which is both known to perform poorly. The current x86 kconfig has over 7000 symbols. When I instrumented it showed that the minimum hash chain length was 16 and a significant number of them was over 30. It didn't help that the hash table size was only 256 buckets. This patch increases the hash table size to a larger prime and switches to a FNV32 hash. I played around with a couple of hash functions, but that one seemed to perform best with reasonable hash table sizes. Increasing the hash table size even further didn't seem like a good idea, because there are a couple of global walks which walk the complete hash table. I also moved the unnamed bucket to 0. It's still the longest of all the buckets (44 entries), but hopefully it's not often hit except for the global walk which doesn't care. The result is a much nicer distribution: (first column bucket length, second number of buckets with that length) 1: 3505 2: 1236 3: 294 4: 52 5: 3 47: 1 <--- this is the unnamed symbols bucket There are still some 5+ buckets, but increasing the hash table even more would be likely not worth it. This also cleans up the code slightly by removing hard coded magic numbers. I didn't notice a big performance difference either way on my Nehalem system, but I presume it'll help somewhat on slower systems. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-01-02kconfig: struct property commentedSam Ravnborg1-10/+30
No functional changes Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kconfig: add comments to symbol flagsSam Ravnborg1-16/+18
No functional changes - only comments. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kconfig: explain symbol value defaultsSam Ravnborg1-2/+6
Added a few comments - no functional change. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kconfig: environment symbol supportRoman Zippel1-1/+2
Add the possibility to import a value from the environment into kconfig via the option syntax. Beside flexibility this has the advantage providing proper dependencies. Documented the options syntax. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kconfig: explicitly introduce expression listRoman Zippel1-1/+4
Rename E_CHOICE to E_LIST to explicitly add support for expression lists. Add a helper macro expr_list_for_each_sym to more easily iterate over the list. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kconfig: delete unused FILE_ and SYMBOL_ flagsSam Ravnborg1-2/+0
The *_PRINTED flags were never used - so delete them. Do we need them later then we can re-add them. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org>
2008-01-28kconfig: rename E_OR & friends to avoid name clashSam Ravnborg1-3/+3
We had macros named the same as a set of enumeration values. It is legal code but very confusing to read - so rename the macros from E_* to EXPR_* Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org>
2007-07-25kconfig: remove unused members from struct symbolSam Ravnborg1-1/+0
dep and dep2 in struct symbol was unused - remove them. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org>
2007-07-25kconfig: attach help text to menusSam Ravnborg1-2/+1
Roman Zippel wrote: > A simple example would be > help texts, right now they are per symbol, but they should really be per > menu, so archs can provide different help texts for something. This patch does this and at the same time introduce a few API funtions used to access the help text. The relevant api functions are introduced in the various frontends. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org>
2006-06-09kconfig: add defconfig_list/module optionRoman Zippel1-0/+1
This makes it possible to change two options which were hardcoded sofar. 1. Any symbol can now take the role of CONFIG_MODULES 2. The more useful option is to change the list of default file names, which kconfig uses to load the base configuration if .config isn't available. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-09kconfig: integrate split config into silentoldconfigRoman Zippel1-1/+2
Now that kconfig can load multiple configurations, it becomes simple to integrate the split config step, by simply comparing the new .config file with the old auto.conf (and then saving the new auto.conf). A nice side effect is that this saves a bit of disk space and cache, as no data needs to be read from or saved into the splitted config files anymore (e.g. include/config is now 648KB instead of 5.2MB). Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-09kconfig: allow loading multiple configurationsRoman Zippel1-1/+5
Extend conf_read_simple() so it can load multiple configurations. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-09kconfig: allow multiple default values per symbolRoman Zippel1-1/+6
Extend struct symbol to allow storing multiple default values, which can be used to hold multiple configurations. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-09kconfig: remove SYMBOL_{YES,MOD,NO}Roman Zippel1-4/+1
The SYMBOL_{YES,MOD,NO} are not really used anymore (they were more used be the cml1 converter), so just remove them. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2005-11-09[PATCH] kconfig: Fix Kconfig performance bugDavid Gibson1-1/+0
When doing its recursive dependency check, scripts/kconfig/conf uses the flag SYMBOL_CHECK_DONE to avoid rechecking a symbol it has already checked. However, that flag is only set at the top level, so if a symbol is first encountered as a dependency of another symbol it will be rechecked every time it is encountered until it's encountered at the top level. This patch adjusts the flag setting so that each symbol will only be checked once, regardless of whether it is first encountered at the top level, or while recursing down from another symbol. On complex configurations, this vastly speeds up scripts/kconfig/conf. The config in the powerpc merge tree is particularly bad: this patch reduces the time for 'scripts/kconfig/conf -o arch/powerpc/Kconfig' by a factor of 40 on a G5. That's even including the time to print the config, so the speedup in the actual checking is more likely 2 or 3 orders of magnitude. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+195
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!