aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-01-22kconfig: Clarify choice dependency propagationUlf Magnusson1-0/+7
It's easy to miss that choices are special-cased to pass on their mode as the parent dependency. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Document SYMBOL_OPTIONAL logicUlf Magnusson1-0/+9
Not obvious, especially if you don't already know how choices are implemented. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: use default 'yy' prefix for lexer and parserMasahiro Yamada3-22/+19
Flex and Bison provide an option to change the prefix of globally- visible symbols. This is useful to link multiple lexers and/or parsers into the same executable. However, Kconfig (and any other host programs in kernel) uses a single lexer and parser. I do not see a good reason to change the default 'yy' prefix. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-01-22kconfig: make conf_unsaved a local variable of conf_read()Masahiro Yamada1-2/+2
conf_unsaved is initialized by conf_read_simple(), but it is possible to move it to conf_read() so that it can be a local variable. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: make xfgets() really staticMasahiro Yamada1-10/+7
Sparse reports: warning: symbol 'xfgets' was not declared. Should it be static? It is declared as static, but it is missing in the definition part. Move the definition up and remove the forward declaration. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: make input_mode staticMasahiro Yamada1-1/+2
Sparse reports: warning: symbol 'input_mode' was not declared. Should it be static? Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Warn if there is more than one help textUlf Magnusson1-0/+5
Avoids mistakes like in the following real-world example, where only the final help string ("Say Y...") was used. This particular example was fixed in commit 561b29e4ec8d ("media: fix media Kconfig help syntax issues"). config DVB_NETUP_UNIDVB ... select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT ---help--- Support for NetUP PCI express Universal DVB card. help Say Y when you want to support NetUP Dual Universal DVB card ... This now prints the following warning: drivers/media/pci/netup_unidvb:13: warning: 'DVB_NETUP_UNIDVB' defined with more than one help text -- only the last one will be used Also free() any extra help strings. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: drop 'boolean' keywordMasahiro Yamada6-7/+6
No more users of this keyword. Drop it according to the notice by commit 6341e62b212a ("kconfig: use bool instead of boolean for type definition attributes"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
2018-01-22kconfig: Remove menu_end_entry()Ulf Magnusson3-11/+1
menu_end_entry() is empty and completely unused as far as I can tell: $ git log -G menu_end_entry --oneline a02f057 [PATCH] kconfig: improve error handling in the parser 1da177e Linux-2.6.12-rc2 Last one is the initial Git commit, where menu_end_entry() is empty as well. I couldn't find anything that redefined it on Google either. It might be a debugging helper for setting a breakpoint after each config, menuconfig, and comment is parsed. IMO it hurts more than it helps in that case by making the parsing code look more complicated at a glance than it really is, and I suspect it doesn't get used much. Tested by running the Kconfiglib test suite, which indirectly verifies that the .config files generated by the C implementation for each defconfig file in the kernel stays the same. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Document important expression functionsUlf Magnusson1-0/+106
Many of these functions are quite the head scratchers if you don't know what they're trying to do. Document them. Also make it clear which functions rewrite expressions in-place and which return new expressions. This prevents memory errors. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Document automatic submenu creation codeUlf Magnusson1-0/+38
It's tricky to figure out what it does (and how) without staring at the code for a long time. Document it to make it more transparent. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Fix choice symbol expression leakUlf Magnusson1-0/+3
When propagating dependencies from parents after parsing, an expression node is allocated if the parent symbol is a 'choice'. This node was never freed. Outline of leak: if (sym && sym_is_choice(sym)) { ... *Allocate (in this case only)* parentdep = expr_alloc_symbol(sym); } else if (parent->prompt) parentdep = parent->prompt->visible.expr; else parentdep = parent->dep; for (menu = parent->list; menu; menu = menu->next) { ... *Copy* basedep = expr_alloc_and(expr_copy(parentdep), basedep); ... } *parentdep lost if the parent is a choice!* Fix by freeing 'parentdep' after the loop if the parent symbol is a choice. Note that this only frees the expression node and not the choice symbol itself. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Fix expr_free() E_NOT leakUlf Magnusson1-1/+1
Only the E_NOT operand and not the E_NOT node itself was freed, due to accidentally returning too early in expr_free(). Outline of leak: switch (e->type) { ... case E_NOT: expr_free(e->left.expr); return; ... } *Never reached, 'e' leaked* free(e); Fix by changing the 'return' to a 'break'. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Fix automatic menu creation mem leakUlf Magnusson1-0/+1
expr_trans_compare() always allocates and returns a new expression, giving the following leak outline: ... *Allocate* basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); ... for (menu = parent->next; menu; menu = menu->next) { ... *Copy* dep2 = expr_copy(basedep); ... *Free copy* expr_free(dep2); } *basedep lost!* Fix by freeing 'basedep' after the loop. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 344,376 bytes in 14,349 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Don't leak main menus during parsingUlf Magnusson1-9/+24
If a 'mainmenu' entry appeared in the Kconfig files, two things would leak: - The 'struct property' allocated for the default "Linux Kernel Configuration" prompt. - The string for the T_WORD/T_WORD_QUOTE prompt after the T_MAINMENU token, allocated on the heap in zconf.l. To fix it, introduce a new 'no_mainmenu_stmt' nonterminal that matches if there's no 'mainmenu' and adds the default prompt. That means the prompt only gets allocated once regardless of whether there's a 'mainmenu' statement or not, and managing it becomes simple. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 344,568 bytes in 14,352 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 344,440 bytes in 14,350 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-11kconfig: Don't leak 'option' arguments during parsingUlf Magnusson1-1/+3
The following strings would leak before this change: - option env="LEAKED" - option defconfig_list="LEAKED" These come in the form of T_WORD tokens and are always allocated on the heap in zconf.l. Free them. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 344,616 bytes in 14,355 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 344,568 bytes in 14,352 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-11kconfig: Don't leak 'source' filenames during parsingUlf Magnusson2-0/+5
The 'source_stmt' nonterminal takes a 'prompt', which consists of either a T_WORD or a T_WORD_QUOTE, both of which are always allocated on the heap in zconf.l and need to have their associated strings freed. Free them. The existing code already makes sure to always copy the string, but add a warning to sym_expand_string_value() to make it clear that the string must be copied, just in case. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 387,504 bytes in 15,545 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 344,616 bytes in 14,355 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-10kconfig: Don't leak symbol names during parsingUlf Magnusson1-17/+19
Prior to this fix, zconf.y did not free symbol names from zconf.l in these contexts: - After T_CONFIG ('config LEAKED') - After T_MENUCONFIG ('menuconfig LEAKED') - After T_SELECT ('select LEAKED') - After T_IMPLY ('imply LEAKED') - After T_DEFAULT in a choice ('default LEAKED') All of these come in the form of T_WORD tokens, which always have their associated string allocated on the heap in zconf.l and need to be freed. Fix by introducing a new nonterminal 'nonconst_symbol' which takes a T_WORD, fetches the symbol, and then frees the T_WORD string. The already existing 'symbol' nonterminal works the same way but also accepts T_WORD_QUOTE, corresponding to a constant symbol. T_WORD_QUOTE should not be accepted in any of the contexts above, so the 'symbol' nonterminal can't be reused here. Fetching the symbol in 'nonconst_symbol' also removes a bunch of sym_lookup() calls from actions. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 711,571 bytes in 37,756 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 387,504 bytes in 15,545 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-06kconfig: fix relational operators for bool and tristate symbolsNicolas Pitre1-1/+4
Since commit 31847b67bec0 ("kconfig: allow use of relations other than (in)equality") it is possible to use relational operators in Kconfig statements. However, those operators give unexpected results when applied to bool/tristate values: (n < y) = y (correct) (m < y) = y (correct) (n < m) = n (wrong) This happens because relational operators process bool and tristate symbols as strings and m sorts before n. It makes little sense to do a lexicographical compare on bool and tristate values though. Documentation/kbuild/kconfig-language.txt states that expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 respectively for calculations). Let's make it so for relational comparisons with bool/tristate expressions as well and document them. If at least one symbol is an actual string then the lexicographical compare works just as before. Signed-off-by: Nicolas Pitre <nico@linaro.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-16kconfig: generate lexer and parser during build instead of shippingMasahiro Yamada3-4944/+1
zconf.lex.c is generated by flex, zconf.tab.c by bison. Instead of running flex and bison during the kernel building, we conventionally version-control those artifacts with _shipped suffix. It is tedious to manually regenerate them every time we change the real sources, zconf.l and zconf.y. Remove the _shipped files and switch over to build-time generation of the intermediate C files. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-16kconfig: display recursive dependency resolution hint just onceMasahiro Yamada1-2/+6
Commit 1c199f2878f6 ("kbuild: document recursive dependency limitation / resolution") probably intended to show a hint along with "recursive dependency detected!" error, but it missed to add {...} guard, and the hint is displayed in every loop of the dep_stack traverse, annoyingly. This error was detected by GCC's -Wmisleading-indentation when switching to build-time generation of lexer/parser. scripts/kconfig/symbol.c: In function ‘sym_check_print_recursive’: scripts/kconfig/symbol.c:1150:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (stack->sym == last_sym) ^~ scripts/kconfig/symbol.c:1153:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n"); ^~~~~~~ I could simply add {...} to surround the three fprintf(), but I rather chose to move the hint after the loop to make the whole message readable. Fixes: 1c199f2878f6 ("kbuild: document recursive dependency limitation / resolution" Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
2017-12-15kconfig: Clean up modules handling and fix crashUlf Magnusson1-4/+6
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: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-15kconfig: Clarify expression rewritingUlf Magnusson1-0/+52
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: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-15kconfig: Rename menu_check_dep() to rewrite_m()Ulf Magnusson1-6/+10
More directly describes the only thing it does. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-12kconfig: Sync zconf.y with zconf.tab.c_shippedUlf Magnusson1-1/+1
Looks like a change to a comment in zconf.y was never committed, because the updated version only appears it zconf.tab.c_shipped. Update the comment in zconf.y to match. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-07kconfig: Document the 'symbol' structUlf Magnusson1-1/+44
Visibility and choices in particular might be a bit tricky to figure out. Also fix existing comment to point out that P_MENU is also used for menus. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-07kconfig: Document the 'menu' structUlf Magnusson1-0/+45
Understanding what it represents helps a lot when reading the code, and it's not obvious, so document it. The ROOT_MENU flag is only set and tested by the gconf and qconf front ends, so leave it undocumented here. The obvious guess for what it means is correct. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-07kconfig: Warn if choice default is not in choiceUlf Magnusson1-0/+10
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: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-23kconfig/symbol.c: use correct pointer type argument for sizeofHeinrich Schuchardt1-1/+1
sym_arr is of type struct symbol **. So in malloc we need sizeof(struct symbol *). The problem was indicated by coccinelle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman5-0/+5
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-19Remove gperf usage from toolchainLinus Torvalds8-361/+67
It turns out that gperf-3.1 changed types in the generated code in ways that aren't even trivially detectable without having to generate a test-file. It's just not worth using tools and libraries from clowns that don't understand or care about compatibility. So get rid of gperf. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-07Merge tag 'kbuild-misc-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds1-1/+2
Pull misc Kbuild updates from Masahiro Yamada: - Use more portable shebang for Perl scripts - Remove trailing spaces from GCC version in kernel log - Make initramfs generation deterministic * tag 'kbuild-misc-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: create deterministic initramfs directory listings scripts/mkcompile_h: Remove trailing spaces from compiler version scripts: Switch to more portable Perl shebang
2017-06-23kconfig: fix sparse warnings in nconfigRandy Dunlap2-8/+8
Fix sparse warnings in scripts/kconfig/nconf* ('make nconfig'): ../scripts/kconfig/nconf.c:1071:32: warning: Using plain integer as NULL pointer ../scripts/kconfig/nconf.c:1238:30: warning: Using plain integer as NULL pointer ../scripts/kconfig/nconf.c:511:51: warning: Using plain integer as NULL pointer ../scripts/kconfig/nconf.c:1460:6: warning: symbol 'setup_windows' was not declared. Should it be static? ../scripts/kconfig/nconf.c:274:12: warning: symbol 'current_instructions' was not declared. Should it be static? ../scripts/kconfig/nconf.c:308:22: warning: symbol 'function_keys' was not declared. Should it be static? ../scripts/kconfig/nconf.gui.c:132:17: warning: non-ANSI function declaration of function 'set_colors' ../scripts/kconfig/nconf.gui.c:195:24: warning: Using plain integer as NULL pointer nconf.gui.o before/after files are the same. nconf.o before/after files are the same until the 'static' function declarations are added. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-06-10kconfig: Check for libncurses before menuconfigBorislav Petkov1-1/+1
There is a check and a nice user-friendly message when the curses library is not present on the system and the user wants to do "make menuconfig". It doesn't get issued, though. Instead, we fail the build when mconf.c doesn't find the curses.h header: HOSTCC scripts/kconfig/mconf.o In file included from scripts/kconfig/mconf.c:23:0: scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory #include CURSES_LOC ^ compilation terminated. Make that check a prerequisite to mconf so that the user sees the error message instead: $ make menuconfig *** Unable to find the ncurses libraries or the *** required header files. *** 'make menuconfig' requires the ncurses libraries. *** *** Install ncurses (ncurses-devel) and try again. *** scripts/kconfig/Makefile:203: recipe for target 'scripts/kconfig/dochecklxdialog' failed make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1 Makefile:548: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2 Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-05-14scripts: Switch to more portable Perl shebangKamil Rytarowski1-1/+2
The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl. This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically. This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior. While there, drop "require 5" from scripts/namespace.pl (Perl from 1994?). Signed-off-by: Kamil Rytarowski <n54@gmx.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-03-22gconfig: remove misleading parentheses around a conditionNicolas Iooss1-1/+1
When building the kernel with clang, the compiler complains about the presence of a condition inside two pairs of parentheses: scripts/kconfig/gconf.c:917:19: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality] } else if ((col == COL_OPTION)) { ~~~~^~~~~~~~~~~~~ scripts/kconfig/gconf.c:917:19: note: remove extraneous parentheses around the comparison to silence this warning } else if ((col == COL_OPTION)) { ~ ^ ~ scripts/kconfig/gconf.c:917:19: note: use '=' to turn this equality comparison into an assignment } else if ((col == COL_OPTION)) { ^~ = Silence this warning by removing a level of parentheses. Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-12-17Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuildLinus Torvalds3-9/+27
Pull kconfig updates from Michal Marek: - 'make xconfig' gui fixes - 'make nconfig' fix for options with long prompts - fix 'make nconfig' warning when pkg-config forces -D_GNU_SOURCE * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: xconfig: fix missing suboption and help panels on first run xconfig: fix 'Show Debug' functionality kconfig/nconf: Fix hang when editing symbol with a long prompt Scripts: kconfig: nconf: fix _GNU_SOURCE redefined warning
2016-12-12Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds7-877/+832
Pull timer updates from Thomas Gleixner: "The time/timekeeping/timer folks deliver with this update: - Fix a reintroduced signed/unsigned issue and cleanup the whole signed/unsigned mess in the timekeeping core so this wont happen accidentaly again. - Add a new trace clock based on boot time - Prevent injection of random sleep times when PM tracing abuses the RTC for storage - Make posix timers configurable for real tiny systems - Add tracepoints for the alarm timer subsystem so timer based suspend wakeups can be instrumented - The usual pile of fixes and updates to core and drivers" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits) timekeeping: Use mul_u64_u32_shr() instead of open coding it timekeeping: Get rid of pointless typecasts timekeeping: Make the conversion call chain consistently unsigned timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion alarmtimer: Add tracepoints for alarm timers trace: Update documentation for mono, mono_raw and boot clock trace: Add an option for boot clock as trace clock timekeeping: Add a fast and NMI safe boot clock timekeeping/clocksource_cyc2ns: Document intended range limitation timekeeping: Ignore the bogus sleep time if pm_trace is enabled selftests/timers: Fix spelling mistake "Asyncrhonous" -> "Asynchronous" clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap clocksource/drivers/arm_arch_timer: Map frame with of_io_request_and_map() arm64: dts: rockchip: Arch counter doesn't tick in system suspend clocksource/drivers/arm_arch_timer: Don't assume clock runs in suspend posix-timers: Make them configurable posix_cpu_timers: Move the add_device_randomness() call to a proper place timer: Move sys_alarm from timer.c to itimer.c ptp_clock: Allow for it to be optional Kconfig: Regenerate *.c_shipped files after previous changes ...
2016-12-11xconfig: fix missing suboption and help panels on first runBoris Barbulovski1-4/+12
qconfig initial slider sizes fix. On first `make xconfig`, suboption and help panels were hidden. Now we properly detect the first run, and show those panels. Reported-by: Jason Vas Dias <jason.vas.dias@gmail.com> Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-12-11xconfig: fix 'Show Debug' functionalityBoris Barbulovski1-1/+2
xconfig - Fix missing 'Show Debug' functionality. xconfig Help mentions 'Show Debug Info' but it was missing from any menu. * Add 'Show debug' menu to the main menu. * Properly load showDebug settings. Reported-by: Jason Vas Dias <jason.vas.dias@gmail.com> Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-12-11kconfig/nconf: Fix hang when editing symbol with a long promptBen Hutchings1-4/+11
Currently it is impossible to edit the value of a config symbol with a prompt longer than (terminal width - 2) characters. dialog_inputbox() calculates a negative x-offset for the input window and newwin() fails as this is invalid. It also doesn't check for this failure, so it busy-loops calling wgetch(NULL) which immediately returns -1. The additions in the offset calculations also don't match the intended size of the window. Limit the window size and calculate the offset similarly to show_scroll_win(). Cc: stable <stable@vger.kernel.org> Fixes: 692d97c380c6 ("kconfig: new configuration interface (nconfig)") Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
2016-12-01kbuild: make sure autoksyms.h exists earlyNicolas Pitre1-0/+2
Some people are able to trigger a race where autoksyms.h is used before its empty version is even created. Let's create it at the same time as the directory holding it is created. Signed-off-by: Nicolas Pitre <nico@linaro.org> Tested-by: Prarit Bhargava <prarit@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-11-29Scripts: kconfig: nconf: fix _GNU_SOURCE redefined warningCheah Kok Cheong1-0/+2
Fix below warning when make nconfig is run initially or after make clean. HOSTCC scripts/kconfig/nconf.o scripts/kconfig/nconf.c:8:0: warning: "_GNU_SOURCE" redefined #define _GNU_SOURCE ^ <command-line>:0:0: note: this is the location of the previous definition Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-11-16Kconfig: Regenerate *.c_shipped files after previous changesNicolas Pitre2-858/+753
Signed-off-by: Nicolas Pitre <nico@linaro.org> Cc: Paul Bolle <pebolle@tiscali.nl> Cc: linux-kbuild@vger.kernel.org Cc: netdev@vger.kernel.org Cc: Richard Cochran <richardcochran@gmail.com> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Michal Marek <mmarek@suse.com> Cc: John Stultz <john.stultz@linaro.org> Cc: Edward Cree <ecree@solarflare.com> Link: http://lkml.kernel.org/r/1478841010-28605-3-git-send-email-nicolas.pitre@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-11-16Kconfig: Introduce the "imply" keywordNicolas Pitre5-19/+79
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>
2016-05-26Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuildLinus Torvalds2-1/+17
Pull kconfig update from Michal Marek: - fix for behavior of tristate choice items and fix for documentation of existing kconfig behavior [Dirk Gouders] - more helpful "unexpected data" kconfig warning [Paul Bolle] * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kconfig/symbol.c: handle choice_values that depend on 'm' symbols kconfig-language: elaborate on the type of a choice kconfig-language: fix comment on dependency-generated menu structures. kconfig: add unexpected data itself to warning
2016-05-10kconfig/symbol.c: handle choice_values that depend on 'm' symbolsDirk Gouders1-0/+14
If choices consist of choice_values of type tristate that depend on symbols set to 'm', those choice_values are not set to 'n' if the choice is changed from 'm' to 'y' (in which case only one active choice_value is allowed). Those values are also written to the config file causing modules to be built when they should not. The following config can be used to reproduce and examine the problem; with the frontend of your choice set "Choice 0" and "Choice 1" to 'm', then set "Tristate Choice" to 'y' and save the configuration: config modules boolean modules default y option modules config dependency tristate "Dependency" default m choice prompt "Tristate Choice" default choice0 config choice0 tristate "Choice 0" config choice1 tristate "Choice 1" depends on dependency endchoice This patch sets tristate choice_values' visibility that depend on symbols set to 'm' to 'n' if the corresponding choice is set to 'y'. This makes them disappear from the choice list and will also cause the choice_values' value set to 'n' in sym_calc_value() and as a result they are written as "not set" to the resulting .config file. Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Dirk Gouders <dirk@gouders.net> Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Tested-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-05-10kconfig: add unexpected data itself to warningPaul Bolle1-1/+3
If the .config parser runs into unexpected data it emits warnings like: .config:6911:warning: unexpected data Add the unexpected data itself to this warning. That makes it easier to discover what is actually going wrong: .config:6911:warning: unexpected data: CONFOG_CHARGER_TPS65217=m Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-04-26localmodconfig: Fix whitespace repeat count after "tristate"Benjamin Poirier1-1/+1
Also recognize standalone "prompt". Before this patch we incorrectly identified some symbols as not having a prompt and potentially needing to be selected by something else. Note that this patch could theoretically change the resulting .config, causing it to have fewer symbols turned on. However, given the current set of Kconfig files, this situation does not occur because the symbols newly added to %prompts are absent from %selects. Link: http://lkml.kernel.org/r/1461696998-3953-1-git-send-email-bpoirier@suse.com Signed-off-by: Benjamin Poirier <bpoirier@suse.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-04-26localmodconfig: Reset certificate pathsBenjamin Poirier1-0/+34
When using `make localmodconfig` and friends, if the input config comes from a kernel that was built in a different environment (for example, the canonical case of using localmodconfig to trim a distribution kernel config) the key files for module signature checking will not be available and should be regenerated or omitted. Otherwise, the user will be faced with annoying errors when trying to build with the generated .config: make[1]: *** No rule to make target 'keyring.crt', needed by 'certs/x509_certificate_list'. Stop. Makefile:1576: recipe for target 'certs/' failed Link: http://lkml.kernel.org/r/1461696721-3001-1-git-send-email-bpoirier@suse.com Signed-off-by: Benjamin Poirier <bpoirier@suse.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>