Commit graph

1112 commits

Author SHA1 Message Date
Masahiro Yamada
9bba03d447 kconfig: remove 'kvmconfig' and 'xenconfig' shorthands
Linux 5.10 is out. Remove the 'kvmconfig' and 'xenconfig' shorthands
as previously announced.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-01-04 10:38:11 +09:00
John Millikin
c0f975af17 kconfig: Support building mconf with vendor sysroot ncurses
Changes the final fallback path in the ncurses locator for mconf
to support host compilers with a non-default sysroot.

This is similar to the hardcoded search for ncurses under
'/usr/include', but can support compilers that keep their default
header and library directories elsewhere.

For nconfig, do nothing because the only vendor compiler I'm aware
of with this layout (Apple Clang) ships an ncurses version that's too
old for nconfig anyway.

Signed-off-by: John Millikin <john@john-millikin.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-01-04 10:38:11 +09:00
Masahiro Yamada
135b4957ea kconfig: fix return value of do_error_if()
$(error-if,...) is expanded to an empty string. Currently, it relies on
eval_clause() returning xstrdup("") when all attempts for expansion fail,
but the correct implementation is to make do_error_if() return xstrdup("").

Fixes: 1d6272e6fe ("kconfig: add 'info', 'warning-if', and 'error-if' built-in functions")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-12-21 14:48:54 +09:00
Boris Kolpackov
78cb090783 kconfig: clean up header inclusion
- Add missing includes.
- Remove no longer necessary includes.

Signed-off-by: Boris Kolpackov <boris@codesynthesis.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-12-08 23:31:29 +09:00
Masahiro Yamada
f463269fb9 kconfig: qconf: show Qt version in the About dialog
You can get the Qt version by running "pkg-config --modversion Qt5Core"
or something, but this might be useful to get the runtime Qt version
more easily. Go to the menu "Help" -> "About", then you can see it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-12-08 23:31:29 +09:00
Boris Kolpackov
98ebea7ba8 kconfig: make lkc.h self-sufficient #include-wise
Signed-off-by: Boris Kolpackov <boris@codesynthesis.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-12-08 23:31:29 +09:00
Masahiro Yamada
a2574c12df kconfig: qconf: convert to Qt5 new signal/slot connection syntax
Now that the Qt4 support was dropped, we can use the new connection
syntax supported by Qt5. It provides compile-time checking of the
validity of the connection.

Previously, the connection between signals and slots were checked
only run-time.

Commit d85de3399f ("kconfig: qconf: fix signal connection to invalid
slots") fixed wrong slots.

This change makes it possible to catch such mistakes easily.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Boris Kolpackov <boris@codesynthesis.com>
2020-12-08 23:31:29 +09:00
Masahiro Yamada
7cd0158703 kconfig: qconf: use a variable to pass packages to pkg-config
The variable, PKG, is defined at the beginning of this script.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-12-08 23:31:29 +09:00
Masahiro Yamada
7b675649be kconfig: qconf: drop Qt4 support
It is possible to keep this compatible with both Qt4 and Qt5, but it is
questionable if it is worth the efforts; it would require us to test
this on both of them, and prevent us from using new features in Qt5.

Qt5 was released in 2012, and now widely available.

Drop the Qt4 support.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-12-08 23:31:29 +09:00
Linus Torvalds
f9893351ac Kconfig updates for v5.10
- Remove unused for useless code from qconf
 
  - Allow to edit "int", "hex", "string" options in place, and remove the
    separate edit box from qconf
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl+Rhy4VHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsG+jIP/jeM6Pe/DYuUGzk0ksGqSag/8U9e
 bkhyT5/7sMVTMLERqRSq5D5dTeuMwk9a3bWLpYzPoBYuPCBcRAR/zWrqlZMYj+/K
 Ai+0+hAIVe4g5iUoqwPfVe3zQ47Ay2NDCQQWEv4s0//Yb57h8/SsxFG3HH7GftBZ
 mBlue7lbsMb8cObJDVY1gWDcSiNDV9h8FtOk9bkFKoFPUoB1glzBKdW90xHl4PLs
 QgT09mMQOb6SSLSGLtHEBFc3Ui7bNNN9JRrDYV4sZbWz8U3c+EC0vIzhdpttPXDz
 0IJAKr9vrUkUw0i1twnbAxUGJZO8XpOp6IAmzH3LqCGz6oNL3hvtScNRoKfFNLAb
 rIdYujBBVX2MKWnDZf5T2hjs5mLC7q5+ZexsLOXagqljP0GvkKl3AYHSPwPxYoN2
 U572plVhbteW9XF3ZebIEpNkqiWOlGmE4RQdDxfePpZNvoO6L5h82csFQ1Lvq1yr
 4R/ZaQSt3dcc0SMrSwmP8OHnIK6qFTL1PWVYUYJvPZcaWcqp80khHDuKVwOC12Dn
 q15OuMUDTf6ZCSi8f9/4U/+UGNHS9PBNO4ZKrCT4tgdLoCddBsWOxfUnZ6/GdBVa
 zq/OaT49Id3pIM2KY/4zs5kFyDB58VnzrrRkHfKGceiZv/ifitV9QE0BtJbxCeTn
 TtVXeXtRlay1HoLr
 =YN7k
 -----END PGP SIGNATURE-----

Merge tag 'kconfig-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kconfig updates from Masahiro Yamada:

 - Remove unused or useless code from qconf

 - Allow to edit "int", "hex", "string" options in place, and remove the
   separate edit box from qconf

* tag 'kconfig-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: qconf: create QApplication after option checks
  kconfig: qconf: remove Y, M, N columns
  kconfig: qconf: remove ConfigView class
  kconfig: qconf: move setShowName/Range() to ConfigList from ConfigView
  kconfig: qconf: remove ConfigLineEdit class
  kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
  kconfig: qconf: show data column all the time
  kconfig: qconf: move ConfigView::updateList(All) to ConfigList class
  kconfig: qconf: remove unused ConfigItem::okRename()
  kconfig: qconf: update the intro message to match to the current code
  kconfig: qconf: reformat the intro message
2020-10-22 13:20:39 -07:00
Linus Torvalds
746b25b1aa Kbuild updates for v5.10
- Support 'make compile_commands.json' to generate the compilation
    database more easily, avoiding stale entries
 
  - Support 'make clang-analyzer' and 'make clang-tidy' for static checks
    using clang-tidy
 
  - Preprocess scripts/modules.lds.S to allow CONFIG options in the module
    linker script
 
  - Drop cc-option tests from compiler flags supported by our minimal
    GCC/Clang versions
 
  - Use always 12-digits commit hash for CONFIG_LOCALVERSION_AUTO=y
 
  - Use sha1 build id for both BFD linker and LLD
 
  - Improve deb-pkg for reproducible builds and rootless builds
 
  - Remove stale, useless scripts/namespace.pl
 
  - Turn -Wreturn-type warning into error
 
  - Fix build error of deb-pkg when CONFIG_MODULES=n
 
  - Replace 'hostname' command with more portable 'uname -n'
 
  - Various Makefile cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl+RfS0VHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGG1QP/2hzoMzK1YXErPUhGrhYU1rxz7Nu
 HkLTIkyKF1HPwSJf5XyNW/FTBI4SDlkNoVg/weEDCS1yFxxpvQLIck8ChzA1kIIM
 P+1IfBWOTzqn91XsapU2zwSno3gylphVchVIvYAB3oLUotGeMSluy1cQtBRzyA5D
 rj2Q7H8fzkzk3YoBcBC/BOKDlfo/usqQ1X/gsfRFwN/BJxeZSYoujNBE7KtHaDsd
 8K/ggBIqmST4NBn+M8c11d8CxzvWbtG1gq3EkUL5nG8T13DsGn1EFC0SPt85bkvv
 f9YywfJi37HixhZzK6tXYjN/PWoiEY6z90mhd0NtZghQT7kQMiTQ3sWrM8dX3ssf
 phBzO94uFQDjhyxOaSSsCoI/TIciAPo4+G8PNjcaEtj63IEfhEz/dnlstYwY5Y9P
 Pp3aZtVjSGJwGW2u2EUYj6paFVqjf6DXQjQKPNHnsYCEidIvFTjjguRGvx9gl6mx
 yd8oseOsAtOEf0alRe9MMdvN17O3UrRAxgBdap7fktg02TLVRGxZIbuwKmBf29ho
 ORl9zeFkYBn6XQFyuItJoXy/kYFyHDaBEPYCRQcY4dwqcjZIiAc/FhYbqYthJ59L
 5vLN2etmDIVSuUv1J5nBqHHGCqJChykbqg7riQ651dCNKw4gZB8ctCay2lXhBXMg
 1mqOcoG5WWL7//F+
 =tZRN
 -----END PGP SIGNATURE-----

Merge tag 'kbuild-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:

 - Support 'make compile_commands.json' to generate the compilation
   database more easily, avoiding stale entries

 - Support 'make clang-analyzer' and 'make clang-tidy' for static checks
   using clang-tidy

 - Preprocess scripts/modules.lds.S to allow CONFIG options in the
   module linker script

 - Drop cc-option tests from compiler flags supported by our minimal
   GCC/Clang versions

 - Use always 12-digits commit hash for CONFIG_LOCALVERSION_AUTO=y

 - Use sha1 build id for both BFD linker and LLD

 - Improve deb-pkg for reproducible builds and rootless builds

 - Remove stale, useless scripts/namespace.pl

 - Turn -Wreturn-type warning into error

 - Fix build error of deb-pkg when CONFIG_MODULES=n

 - Replace 'hostname' command with more portable 'uname -n'

 - Various Makefile cleanups

* tag 'kbuild-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits)
  kbuild: Use uname for LINUX_COMPILE_HOST detection
  kbuild: Only add -fno-var-tracking-assignments for old GCC versions
  kbuild: remove leftover comment for filechk utility
  treewide: remove DISABLE_LTO
  kbuild: deb-pkg: clean up package name variables
  kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n
  kbuild: enforce -Werror=return-type
  scripts: remove namespace.pl
  builddeb: Add support for all required debian/rules targets
  builddeb: Enable rootless builds
  builddeb: Pass -n to gzip for reproducible packages
  kbuild: split the build log of kallsyms
  kbuild: explicitly specify the build id style
  scripts/setlocalversion: make git describe output more reliable
  kbuild: remove cc-option test of -Werror=date-time
  kbuild: remove cc-option test of -fno-stack-check
  kbuild: remove cc-option test of -fno-strict-overflow
  kbuild: move CFLAGS_{KASAN,UBSAN,KCSAN} exports to relevant Makefiles
  kbuild: remove redundant CONFIG_KASAN check from scripts/Makefile.kasan
  kbuild: do not create built-in objects for external module builds
  ...
2020-10-22 13:13:57 -07:00
Masahiro Yamada
f9a825a7f6 kconfig: qconf: create QApplication after option checks
'scripts/kconfig/qconf -h' just calls usage() and exits, with
QApplication unused.

There is no need to construct QApplication so early. Do it after
the parse stage.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
a0fce28338 kconfig: qconf: remove Y, M, N columns
There are so many ways to toggle bool / tristate options.

I do not know how useful these columns are.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
62ed165651 kconfig: qconf: remove ConfigView class
Now that ConfigView only contains ConfigList, we can remove ConfigView
and just use ConfigList.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
7930dd91a0 kconfig: qconf: move setShowName/Range() to ConfigList from ConfigView
ConfigView::setShowName/Range() only get access to the 'list' member.

Move them to the more relevant ConfigList class.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
f3eea294e9 kconfig: qconf: remove ConfigLineEdit class
Now that "int", "hex", "string" menus are edited in-place, this class
is no longer needed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
37162a68bf kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
Previously, when you double-clicked the "int", "hex", or "string" menus,
a line-edit gadget showed up to allow you to input the value, which
looked clumsy.

Also, it was buggy; the editor opened even if the config option was not
editable. For example, just try to double-click CC_VERSION_TEXT, which
has no prompt.

This commit sub-classes QStyleItemDelegate to allow users to edit
"int", "hex", "string" menus in-place. Just double-click (or press
the F2 key) in the data column. Then, an editor widget is placed on
top of the item view.

The two methods are overridden:

 createEditor - process only when the data column is being accessed
 and the menu is visible. Otherwise, return nullptr to disallow editing.

 setModelData - take the new data from the editor, and set it to the
 addressed symbol. If it was successful, update all the list windows.
 Otherwise, (the reason for the failure is possibly the input data was
 out of range), set the old value back to the editor.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
669a1ee46a kconfig: qconf: show data column all the time
The next commit will allow users to edit "int", "hex", "string"
menus in-place from the data column.

The data column should be always displayed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
f9b918fae6 kconfig: qconf: move ConfigView::updateList(All) to ConfigList class
ConfigView::updateList() iterates over all views, and then calls
updateList() against for its ConfigList instance.

This means there is no point to implement it in the ConfigView class.

Move and rename as follows:

  ConfigView::updateList()     -> ConfigList::updateListForAll()
  ConfigView::updateListAll()  -> ConfigList::updateListAllForAll()

I used QList to contain all ConfigList instances.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
6a14304153 kconfig: qconf: remove unused ConfigItem::okRename()
Commit 76538660fb ("Port xconfig to Qt5 - Remove custom
ListView classes.") removed the original implementation, where
ConfigItem::okRename() overrode Q3ListViewItem::okRename().

Commit 59e564408f ("Port xconfig to Qt5 - Put back some of the
old implementation.") restored the empty stub, but it seems
useless.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
1fb752416f kconfig: qconf: update the intro message to match to the current code
I do not think "Although there is no cross reference yet ..." is valid
any longer.

The cross reference is supported via hyperlinks enabled by the
"show Debug Info" option.

Update the message.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
8c30e7e60d kconfig: qconf: reformat the intro message
The introduction message displayed by 'Help -> Introduction' does not
look nice due to excessive new lines.

Reformat the message.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2020-09-25 00:37:13 +09:00
Masahiro Yamada
a46afd1141 kconfig: qconf: revive help message in the info view
Since commit 68fd110b3e ("kconfig: qconf: remove redundant help in
the info view"), the help message is no longer displayed.

I intended to drop duplicated "Symbol:", "Type:", but precious info
about help and reverse dependencies was lost too.

Revive it now.

"defined at" is contained in menu_get_ext_help(), so I made sure
to not display it twice.

Fixes: 68fd110b3e ("kconfig: qconf: remove redundant help in the info view")
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-20 12:58:54 +09:00
Masahiro Yamada
19b835a5db kconfig: qconf: fix incomplete type 'struct gstr' warning
"make HOSTCXX=clang++ xconfig" reports the following:

  HOSTCXX scripts/kconfig/qconf.o
In file included from scripts/kconfig/qconf.cc:23:
In file included from scripts/kconfig/lkc.h:15:
scripts/kconfig/lkc_proto.h:26:13: warning: 'get_relations_str' has C-linkage specified, but returns incomplete type 'struct gstr' which could be incompatible with C [-Wreturn-type-c-linkage]
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
            ^

Currently, get_relations_str() is declared before the struct gstr
definition.

Move all declarations of menu.c functions below.

BTW, some are declared in lkc.h and some in lkc_proto.h, but the
difference is unclear. I guess some refactoring is needed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Boris Kolpackov <boris@codesynthesis.com>
2020-09-20 12:58:49 +09:00
Masahiro Yamada
a608b6a646 kconfig: qconf: use delete[] instead of delete to free array (again)
Commit c9b09a9249 ("kconfig: qconf: use delete[] instead of delete
to free array") fixed two lines, but there is one more.
(cppcheck does not report it for some reason...)

This was detected by Clang.

"make HOSTCXX=clang++ xconfig" reports the following:

scripts/kconfig/qconf.cc:1279:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete data;
        ^
              []
scripts/kconfig/qconf.cc:1239:15: note: allocated with 'new[]' here
        char *data = new char[count + 1];
                     ^

Fixes: c4f7398bee ("kconfig: qconf: make debug links work again")
Fixes: c9b09a9249 ("kconfig: qconf: use delete[] instead of delete to free array")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
2020-09-19 00:12:13 +09:00
Denis Efremov
163e0c27fe kconfig: remove redundant assignment prompt = prompt
Semi-automatic removing of localization macros changed the line
from "prompt = _(prompt);" to "prompt = prompt;". Drop the
reduntand assignment.

Fixes: 694c49a7c0 ("kconfig: drop localization support")
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-03 12:21:22 +09:00
Randy Dunlap
a73fbfce2c kconfig: streamline_config.pl: check defined(ENV variable) before using it
A user reported:
'Use of uninitialized value $ENV{"LMC_KEEP"} in split at
 ./scripts/kconfig/streamline_config.pl line 596.'

so first check that $ENV{LMC_KEEP} is defined before trying
to use it.

Fixes: c027b02d89 ("streamline_config.pl: add LMC_KEEP to preserve some kconfigs")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-03 12:16:30 +09:00
Masahiro Yamada
23cd88c913 kbuild: hide commands to run Kconfig, and show short log for syncconfig
Some targets (localyesconfig, localmodconfig, defconfig) hide the
command running, but the others do not.

Users know which Kconfig flavor they are running, so it is OK to hide
the command. Add $(Q) to all commands consistently. If you want to see
the full command running, pass V=1 from the command line.

syncconfig is the exceptional case, which occurs without explicit
command invocation by the user. Display the Kbuild-style log for it.
The ugly bare log will go away.

[Before]

scripts/kconfig/conf  --syncconfig Kconfig

[After]

  SYNC    include/config/auto.conf

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-27 00:44:33 +09:00
Masahiro Yamada
510bc3cb1d kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:

  HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
 1090 |      head += QString().sprintf("<a href=\"s%s\">", sym->name);
      |                                                             ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
                 from /usr/include/qt5/QtWidgets/qaction.h:44,
                 from /usr/include/qt5/QtWidgets/QAction:1,
                 from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
  382 |     QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
      |              ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
 1099 |     head += QString().sprintf("<a href=\"s%s\">", sym->name);
      |                                                            ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
                 from /usr/include/qt5/QtWidgets/qaction.h:44,
                 from /usr/include/qt5/QtWidgets/QAction:1,
                 from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
  382 |     QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
      |              ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
 1127 |   debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
      |                                                                                          ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
                 from /usr/include/qt5/QtWidgets/qaction.h:44,
                 from /usr/include/qt5/QtWidgets/QAction:1,
                 from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
  382 |     QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
      |              ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
 1150 |    debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
      |                                                                    ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
                 from /usr/include/qt5/QtWidgets/qaction.h:44,
                 from /usr/include/qt5/QtWidgets/QAction:1,
                 from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
  382 |     QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
      |              ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
 1225 |   *text += QString().sprintf("<a href=\"s%s\">", sym->name);
      |                                                           ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
                 from /usr/include/qt5/QtWidgets/qaction.h:44,
                 from /usr/include/qt5/QtWidgets/QAction:1,
                 from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
  382 |     QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
      |              ^~~~~~~

The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."

Use QTextStream as suggested.

Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-21 10:23:38 +09:00
Masahiro Yamada
68fd110b3e kconfig: qconf: remove redundant help in the info view
The same information is repeated in the info view.

Remove the second one.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-21 10:23:37 +09:00
Masahiro Yamada
53efe2e76c kconfig: qconf: remove qInfo() to get back Qt4 support
qconf is supposed to work with Qt4 and Qt5, but since commit
c4f7398bee ("kconfig: qconf: make debug links work again"),
building with Qt4 fails as follows:

  HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::clicked(const QUrl&)’:
scripts/kconfig/qconf.cc:1241:3: error: ‘qInfo’ was not declared in this scope; did you mean ‘setInfo’?
 1241 |   qInfo() << "Clicked link is empty";
      |   ^~~~~
      |   setInfo
scripts/kconfig/qconf.cc:1254:3: error: ‘qInfo’ was not declared in this scope; did you mean ‘setInfo’?
 1254 |   qInfo() << "Clicked symbol is invalid:" << data;
      |   ^~~~~
      |   setInfo
make[1]: *** [scripts/Makefile.host:129: scripts/kconfig/qconf.o] Error 1
make: *** [Makefile:606: xconfig] Error 2

qInfo() does not exist in Qt4. In my understanding, these call-sites
should be unreachable. Perhaps, qWarning(), assertion, or something
is better, but qInfo() is not the right one to use here, I think.

Fixes: c4f7398bee ("kconfig: qconf: make debug links work again")
Reported-by: Ronald Warsow <rwarsow@gmx.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-21 10:22:46 +09:00
Masahiro Yamada
66c262be8f kconfig: qconf: remove unused colNr
This is not used at all.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-18 20:16:46 +09:00
Masahiro Yamada
7d1300e631 kconfig: qconf: fix the popup menu in the ConfigInfoView window
I do not know when ConfigInfoView::createStandardContextMenu() is
called.

Because QTextEdit::createStandardContextMenu() is not virtual,
ConfigInfoView::createStandardContextMenu() cannot override it.
Even if right-click the ConfigInfoView window, the "Show Debug Info"
menu does not show up.

Build up the menu in the constructor, and invoke it from the
contextMenuEvent().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-18 20:16:46 +09:00
Masahiro Yamada
d85de3399f kconfig: qconf: fix signal connection to invalid slots
If you right-click in the ConfigList window, you will see the following
messages in the console:

QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:888
QObject::connect:  (sender name:   'config')
QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:897
QObject::connect:  (sender name:   'config')
QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:906
QObject::connect:  (sender name:   'config')

Right, there is no such slot in QAction. I think this is a typo of
setChecked.

Due to this bug, when you toggled the menu "Option->Show Name/Range/Data"
the state of the context menu was not previously updated. Fix this.

Fixes: d5d973c3f8 ("Port xconfig to Qt5 - Put back some of the old implementation(part 2)")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-18 20:16:46 +09:00
Masahiro Yamada
d4bbe8a1b5 kconfig: qconf: move setOptionMode() to ConfigList from ConfigView
ConfigView::setOptionMode() only gets access to the 'list' member.

Move it to the more relevant ConfigList class.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:47:21 +09:00
Masahiro Yamada
fa8de0a3bf kconfig: qconf: do not limit the pop-up menu to the first row
If you right-click the first row in the option tree, the pop-up menu
shows up, but if you right-click the second row or below, the event
is ignored due to the following check:

  if (e->y() <= header()->geometry().bottom()) {

Perhaps, the intention was to show the pop-menu only when the tree
header was right-clicked, but this handler is not called in that case.

Since the origin of e->y() starts from the bottom of the header,
this check is odd.

Going forward, you can right-click anywhere in the tree to get the
pop-up menu.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:47:07 +09:00
Masahiro Yamada
5cb255ffa1 kconfig: qconf: refactor icon setups
These icon data are used by ConfigItem, but stored in each instance
of ConfigView. There is no point to keep the same data in each of 3
instances, "menu", "config", and "search".

Move the icon data to the more relevant ConfigItem class, and make
them static members.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:46:36 +09:00
Masahiro Yamada
4fa91f528f kconfig: qconf: remove unused voidPix, menuInvPix
These are initialized, but not used by anyone.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:46:09 +09:00
Masahiro Yamada
5ca534cdf9 kconfig: qconf: remove ConfigItem::text/setText
Use QTreeWidgetItem::text/setText directly

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:45:51 +09:00
Masahiro Yamada
abf741a9fa kconfig: qconf: remove ConfigList::addColumn/removeColumn
Use QTreeView::showColumn/hideColumn directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:45:38 +09:00
Masahiro Yamada
711b875bcd kconfig: qconf: remove ConfigItem::pixmap/setPixmap
Use QTreeWidgetItem::icon/setIcon directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:45:25 +09:00
Masahiro Yamada
3c73ff040e kconfig: qconf: drop more localization code
This is a remnant of commit 694c49a7c0 ("kconfig: drop localization
support").

Get it back to the code prior to commit 3b9fa0931d ("[PATCH] Kconfig
i18n support").

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:45:12 +09:00
Masahiro Yamada
5b75a6c896 kconfig: qconf: remove 'parent' from ConfigList::updateMenuList()
All the call-sites of this function pass 'this' to the first argument.

So, 'parent' is always the 'this' pointer.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:43:56 +09:00
Masahiro Yamada
1031685c5e kconfig: qconf: remove unused argument from ConfigView::updateList()
Now that ConfigList::updateList() takes no argument, the 'item' argument
ConfigView::updateList() is no longer used.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:39:41 +09:00
Masahiro Yamada
cb77043f06 kconfig: qconf: remove unused argument from ConfigList::updateList()
This function allocates 'item' before using it, so the argument 'item'
is always shadowed.

Remove the meaningless argument.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:39:14 +09:00
Masahiro Yamada
92641154bf kconfig: qconf: omit parent to QHBoxLayout()
Instead of passing 0 (i.e. nullptr), leave it empty.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:38:56 +09:00
Masahiro Yamada
740fdef853 kconfig: qconf: remove name from ConfigSearchWindow constructor
This constructor is only called with "search" as the second argument.

Hard-code the name in the constructor, and drop it from the function
argument.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:38:39 +09:00
Masahiro Yamada
1b4263e750 kconfig: qconf: remove unused ConfigList::listView()
I do not know how this function can be useful. In fact, it is unsed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:37:47 +09:00
Masahiro Yamada
860ec3fbca kconfig: qconf: overload addToolBar() to create and insert toolbar
Use the overloaded function, addToolBar(const QString &title)
to create a QToolBar object, setting its window title, and inserts
it into the toolbar area.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:04 +09:00
Masahiro Yamada
2afb3e2682 kconfig: qconf: remove toolBar from ConfigMainWindow members
This pointer is only used in the ConfigMainWindow constructor.

Drop it from the private members.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:04 +09:00
Masahiro Yamada
93ebaacdc5 kconfig: qconf: use 'menu' variable for (QMenu *)
The variable 'config' for the file menu is inconsistent.

You do not need to use different variables. Use 'menu' for every menu.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:04 +09:00
Masahiro Yamada
d4b1cea7de kconfig: qconf: do not use 'menu' variable for (QMenuBar *)
I think it is a bit confusing to use 'menu' to hold a QMenuBar pointer.
I want to use 'menu' for a QMenu pointer.

You do not need to use a local variable here. Use menuBar() directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:04 +09:00
Masahiro Yamada
614bf0a89a kconfig: qconf: remove ->addSeparator() to menuBar
I do not understand the purpose of this ->addSeparator().
It does not make any difference.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:04 +09:00
Masahiro Yamada
d41809ff7a kconfig: add 'static' to some file-local data
Fix some warnings from sparce like follows:

  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:04 +09:00
Maxime Chretien
7eb7c106f1 kconfig: qconf: Fix mouse events in search view
On menu properties mouse events didn't do anything in search view
(listMode).

As there are no menus in listMode we can add an exception in tests to
always change the value on mouse events if we are in listMode.

Signed-off-by: Maxime Chretien <maxime.chretien@bootlin.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:03 +09:00
Masahiro Yamada
8410e65594 kconfig: constify XPM data
Constify arrays as well as strings.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:03 +09:00
Masahiro Yamada
f70f74d15c kconfig: remove '---help---' support
The conversion is done. No more user of '---help---'.

Cc: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-14 13:30:03 +09:00
Masahiro Yamada
ccf56e5fe3 kconfig: qconf: remove wrong ConfigList::firstChild()
This function returns the first child object, but the returned pointer
is not compatible with (ConfigItem *).

Commit cc1c08edcc ("kconfig: qconf: don't show goback button on
splitMode") uncovered this issue because using the pointer from this
function would make qconf crash. (https://lkml.org/lkml/2020/7/18/411)

This function does not work. Remove.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-02 23:09:10 +09:00
Masahiro Yamada
4b20e103a6 Revert "kconfig: qconf: don't show goback button on splitMode"
This reverts commit cc1c08edcc.

Maxim Levitsky reports 'make xconfig' crashes since that commit
(https://lkml.org/lkml/2020/7/18/411)

Or, the following is simple test code that makes it crash:

    menu "Menu"

    config FOO
            bool "foo"
            default y

    menuconfig BAR
            bool "bar"
            depends on FOO

    endmenu

Select the Split View mode, and double-click "bar" in the right
window, then you will see Segmentation fault.

When 'last' is not set for symbolMode, the following code in
ConfigList::updateList() calls firstChild().

  item = last ? last->nextSibling() : firstChild();

However, the pointer returned by ConfigList::firstChild() does not
seem to be compatible with (ConfigItem *), which seems another bug.

I'd rather want to reconsider whether hiding the goback icon is the
right thing to do.

In the following test code, the Split View shows "Menu2" and "Menu3"
in the right window. You can descend into "Menu3", but there is no way
to ascend back to "Menu2" from "Menu3".

    menu "Menu1"

    config FOO
            bool "foo"
            default y

    menu "Menu2"
            depends on FOO

    menu "Menu3"

    config BAZ
            bool "baz"

    endmenu

    endmenu

    endmenu

It is true that the goback button is currently not functional due to
yet another bug, but hiding the problem is not the right way to go.

Anyway, Segmentation fault is fatal. Revert the offending commit for
now, and we should find the right solution.

Reported-by:  Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 20:54:39 +09:00
Masahiro Yamada
97bebbcd8b Revert "kconfig: qconf: Change title for the item window"
This reverts commit 5752ff07fd.

It added dead code to ConfigList:ConfigList().

The constructor of ConfigList has the initializer, mode(singleMode).

    if (mode == symbolMode)
           setHeaderLabels(QStringList() << "Item" << "Name" << "N" << "M" << "Y" << "Value");
    else
           setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value");

... always takes the else part.

The change to ConfigList::updateSelection() is strange too.
When you click the split view icon for the first time, the titles in
both windows show "Option". After you click something in the right
window, the title suddenly changes to "Item".

ConfigList::updateSelection() is not the right place to do this,
at least. It was not a good idea, I think.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 20:54:39 +09:00
Masahiro Yamada
ce02397f44 kconfig: qconf: remove "goBack" debug message
Every time the goback icon is clicked, the annoying message "goBack"
is displayed on the console.

I guess this line is the left-over debug code of commit af737b4def
("kconfig: qconf: simplify the goBack() logic").

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 20:54:39 +09:00
Masahiro Yamada
c9b09a9249 kconfig: qconf: use delete[] instead of delete to free array
cppcheck reports "Mismatching allocation and deallocation".

$ cppcheck scripts/kconfig/qconf.cc
Checking scripts/kconfig/qconf.cc ...
scripts/kconfig/qconf.cc:1242:10: error: Mismatching allocation and deallocation: data [mismatchAllocDealloc]
  delete data;
         ^
scripts/kconfig/qconf.cc:1236:15: note: Mismatching allocation and deallocation: data
 char *data = new char[count + 1];
              ^
scripts/kconfig/qconf.cc:1242:10: note: Mismatching allocation and deallocation: data
  delete data;
         ^
scripts/kconfig/qconf.cc:1255:10: error: Mismatching allocation and deallocation: data [mismatchAllocDealloc]
  delete data;
         ^
scripts/kconfig/qconf.cc:1236:15: note: Mismatching allocation and deallocation: data
 char *data = new char[count + 1];
              ^
scripts/kconfig/qconf.cc:1255:10: note: Mismatching allocation and deallocation: data
  delete data;
         ^

Fixes: c4f7398bee ("kconfig: qconf: make debug links work again")
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 20:54:39 +09:00
Masahiro Yamada
0e912c0320 kconfig: qconf: compile moc object separately
Currently, qconf.moc is included from qconf.cc but they can be compiled
independently.

When you modify qconf.cc, qconf.moc does not need recompiling.

Rename qconf.moc to qconf-moc.cc, and split it out as an independent
compilation unit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 20:54:39 +09:00
Masahiro Yamada
c3cd7cfad5 kconfig: qconf: use if_changed for qconf.moc rule
Regenerate qconf.moc when the moc command is changed.

This also allows 'make mrproper' to clean it up. Previously, it was
not cleaned up because 'clean-files += qconf.moc' was missing.
Now 'make mrproper' correctly cleans it up because files listed in
'targets' are cleaned.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 20:54:39 +09:00
Mauro Carvalho Chehab
8f8499a910 kconfig: qconf: parse newer types at debug info
There are 3 types that are not parsed by the debug info logic.
Add support for them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-02 00:11:06 +09:00
Mauro Carvalho Chehab
8a3b6e5687 kconfig: qconf: navigate menus on hyperlinks
Instead of just changing the helper window to show a
dependency, also navigate to it at the config and menu
widgets.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-02 00:08:09 +09:00
Mauro Carvalho Chehab
cc1c08edcc kconfig: qconf: don't show goback button on splitMode
the goback button does nothing on splitMode. So, why display
it?

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-02 00:00:02 +09:00
Mauro Carvalho Chehab
af737b4def kconfig: qconf: simplify the goBack() logic
The goBack() logic is used only for the configList, as
it only makes sense on singleMode. So, let's simplify the
code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-01 23:59:49 +09:00
Mauro Carvalho Chehab
b06c3ec3bd kconfig: qconf: re-implement setSelected()
The default implementation for setSelected() at QTreeWidgetItem
allows multiple items to be selected.

Well, this should never be possible for the configItem lists.

So, implement a function that will automatically clean any
previous selection. This simplifies the logic somewhat, while
making the selection logic to be applied atomically, avoiding
future issues on that.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-01 23:59:30 +09:00
Mauro Carvalho Chehab
c4f7398bee kconfig: qconf: make debug links work again
The Qt5 conversion broke support for debug info links.

Restore the behaviour added by changeset
ab45d190fd ("kconfig: create links in info window").

The original approach was to pass a pointer for a data struct
via an <a href>. That doesn't sound a good idea, as, if something
gets wrong, the app could crash. So, instead, pass the name of
the symbol, and validate such symbol at the hyperlink handling
logic.

Link: https://lore.kernel.org/lkml/20200628125421.12458086@coco.lan/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-01 23:57:53 +09:00
Mauro Carvalho Chehab
c699eaaba9 kconfig: qconf: make search fully work again on split mode
When the search dialog box finds symbols/menus that match
the search criteria, it presents all results at the window.

Clicking on a search result should make qconf to navigate
to the selected item. This works on singleMode and on
fullMode, but on splitMode, the navigation is broken.

This was partially caused by an incomplete Qt5 conversion
and by the followup patches that restored the original
behavior.

When qconf is on split mode, it has to update both the
config and the menu views. Right now, such logic is broken,
as it is not seeking using the right structures.

On qconf, the screen is split into 3 parts:

	+------------+-------+
	|            |       |
	|   Config   | Menu  |
	|            |       |
	+------------+-------+
	|                    |
	|     ConfigInfo     |
	|                    |
	+--------------------+

On singleMode and on fullMode, the menuView is hidden, and search
updates only the configList (which controls the ConfigView).

On SplitMode, the search logic should detect if the variable is a
leaf or not. If it is a leaf, it should be presented at the menuView,
and both configList and menuList should be updated. Otherwise, just
the configList should be updated.

Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-01 23:54:16 +09:00
Mauro Carvalho Chehab
cf81dfa479 kconfig: qconf: cleanup includes
The usage of c-like include is deprecated on modern Qt
versions. Use the c++ style includes.

While here, remove uneeded and redundant ones, sorting
them on alphabetic order.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-01 23:53:55 +09:00
Masahiro Yamada
bcfefb61cd kconfig: announce removal of 'kvmconfig' and 'xenconfig' shorthands
kvmconfig' is a shorthand for kvm_guest.config to save 7 character typing.

xenconfig' is a shorthand for xen.config to save 1 character typing.

There is nothing more than that.

There are more files in kernel/configs/, so it is not maintainable
to wire-up every config fragment to the Kconfig Makefile. Hence,
we should not do this at all.

These will be removed after Linux 5.10. Meanwhile, the following
warning message will be displayed if they are used.

WARNING: 'make kvmconfig' will be removed after Linux 5.10
         Please use 'make kvm_guest.config' instead.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-26 00:02:32 +09:00
Changbin Du
c027b02d89 streamline_config.pl: add LMC_KEEP to preserve some kconfigs
Sometimes it is useful to preserve batches of configs when making
localmodconfig. For example, I usually don't want any usb and fs
modules to be disabled. Now we can do it by:

 $ make LMC_KEEP="drivers/usb:fs" localmodconfig

Signed-off-by: Changbin Du <changbin.du@gmail.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-13 10:33:54 +09:00
Masahiro Yamada
09d5873e4d kconfig: allow only 'config', 'comment', and 'if' inside 'choice'
The code block surrounded by 'if' ... 'endif' is reduced into if_stmt,
which is accepted in the 'choice' context. Therefore, you can write any
statements within a choice block by wrapping 'if y' ... 'end'.

For example, you can create a menu inside a choice, like follows:

---------------->8----------------
  choice
          prompt "choice"

  config A
          bool "A"

  config B
          bool "B"

  if y

  menu "strange menu"

  config C
          bool "C"

  endmenu

  endif

  endchoice
---------------->8----------------

I want to change such a weird structure into a syntax error.

In fact, the USB gadget Kconfig had used nested 'choice' for no good
reason until commit df8df5e4bc ("usb: get rid of 'choice' for
legacy gadget drivers") killed it.

I think the 'source' inside 'choice' is on the fence. It is at least
gramatically sensible as long as the included file contains only
bool/tristate configs. However, it makes the code unreadable, and people
tend to forget the fact that the file is included from the choice
block. Commit 10e5e6c249 ("usb: gadget: move choice ... endchoice to
legacy/Kconfig") got rid of the only usecase.

Going forward, you can only use 'config', 'comment', and 'if' inside
'choice'. This also recursively applies to 'if' blocks inside 'choice'.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-12 13:28:30 +09:00
Masahiro Yamada
b7546111a4 kconfig: tests: remove randconfig test for choice in choice
Nesting choice statements does not make any sense.

Commit df8df5e4bc ("usb: get rid of 'choice' for legacy gadget
drivers") got rid of the only usecase.

I will turn it into a syntax error. Remove the test in advance.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-12 13:28:30 +09:00
Masahiro Yamada
644a4b6cec kconfig: do not assign a variable in the return statement
I am not a big fan of doing assignment in a return statement.
Split it into two lines.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-12 13:28:30 +09:00
Masahiro Yamada
cfc6eea9f6 kconfig: do not use OR-assignment for zero-cleared structure
The simple assignment is enough because memset() three lines above
has zero-cleared the structure.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-12 13:28:30 +09:00
Mauro Carvalho Chehab
60969f02f0 kconfig: qconf: Fix a few alignment issues
There are a few items with wrong alignments. Solve them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-04-09 00:13:45 +09:00
Mauro Carvalho Chehab
e1f7769f60 kconfig: qconf: remove some old bogus TODOs
The items described on those TODOs are already solved. So,
remove the comments.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-04-09 00:13:45 +09:00
Mauro Carvalho Chehab
b311142fcf kconfig: qconf: fix support for the split view mode
At least on my tests (building against Qt5.13), it seems to
me that, since Kernel 3.14, the split view mode is broken.

Maybe it was not a top priority during the conversion time.

Anyway, this patch changes the logic in order to properly
support the split view mode and the single view mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-04-09 00:13:45 +09:00
Mauro Carvalho Chehab
cce1faba82 kconfig: qconf: fix the content of the main widget
The port to Qt5 tried to preserve the same way as it used
to work with Qt3 and Qt4. However, at least with newer
versions of Qt5 (5.13), this doesn't work properly.

Change the schema by adding a vertical layout, in order
for it to start working properly again.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-04-09 00:13:45 +09:00
Mauro Carvalho Chehab
5752ff07fd kconfig: qconf: Change title for the item window
Both main config window and the item window have "Option"
name. That sounds weird, and makes harder to debug issues
of a window appearing at the wrong place.

So, change the title to reflect the contents of each
window.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-04-09 00:13:45 +09:00
Mauro Carvalho Chehab
cf497b9223 kconfig: qconf: clean deprecated warnings
The recommended way to initialize a null string is with
QString(). This is there at least since Qt5.5, with is
when qconf was ported to Qt5.

Fix those warnings:

	scripts/kconfig/qconf.cc: In member function ‘void ConfigItem::updateMenu()’:
	scripts/kconfig/qconf.cc:158:31: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
	  158 |    setText(noColIdx, QString::null);
	      |                               ^~~~
	In file included from /usr/include/qt5/QtCore/qobject.h:47,
	                 from /usr/include/qt5/QtWidgets/qwidget.h:45,
	                 from /usr/include/qt5/QtWidgets/qmainwindow.h:44,
	                 from /usr/include/qt5/QtWidgets/QMainWindow:1,
	                 from scripts/kconfig/qconf.cc:9:

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-04-09 00:13:45 +09:00
Linus Torvalds
ff2ae607c6 SPDX patches for 5.7-rc1.
Here are 3 SPDX patches for 5.7-rc1.
 
 One fixes up the SPDX tag for a single driver, while the other two go
 through the tree and add SPDX tags for all of the .gitignore files as
 needed.
 
 Nothing too complex, but you will get a merge conflict with your current
 tree, that should be trivial to handle (one file modified by two things,
 one file deleted.)
 
 All 3 of these have been in linux-next for a while, with no reported
 issues other than the merge conflict.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXodg5A8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykySQCgy9YDrkz7nWq6v3Gohl6+lW/L+rMAnRM4uTZm
 m5AuCzO3Azt9KBi7NL+L
 =2Lm5
 -----END PGP SIGNATURE-----

Merge tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx

Pull SPDX updates from Greg KH:
 "Here are three SPDX patches for 5.7-rc1.

  One fixes up the SPDX tag for a single driver, while the other two go
  through the tree and add SPDX tags for all of the .gitignore files as
  needed.

  Nothing too complex, but you will get a merge conflict with your
  current tree, that should be trivial to handle (one file modified by
  two things, one file deleted.)

  All three of these have been in linux-next for a while, with no
  reported issues other than the merge conflict"

* tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx:
  ASoC: MT6660: make spdxcheck.py happy
  .gitignore: add SPDX License Identifier
  .gitignore: remove too obvious comments
2020-04-03 13:12:26 -07:00
Masahiro Yamada
dbd3586012 kconfig: remove unused variable in qconf.cc
If this file were compiled with -Wall, the following warning would be
reported:

scripts/kconfig/qconf.cc:312:6: warning: unused variable ‘i’ [-Wunused-variable]
  int i;
      ^

The commit prepares to turn on -Wall for C++ host programs.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
2020-03-29 22:37:53 +09:00
Masahiro Yamada
d198b34f38 .gitignore: add SPDX License Identifier
Add SPDX License Identifier to all .gitignore files.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-25 11:50:48 +01:00
Masahiro Yamada
2985bed680 .gitignore: remove too obvious comments
Some .gitignore files have comments like "Generated files",
"Ignore generated files" at the header part, but they are
too obvious.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-25 11:50:28 +01:00
Masahiro Yamada
3a9dd3ecb2 kconfig: make 'imply' obey the direct dependency
The 'imply' statement may create unmet direct dependency when the
implied symbol depends on m.

[Test Code]

  config FOO
          tristate "foo"
          imply BAZ

  config BAZ
          tristate "baz"
          depends on BAR

  config BAR
          def_tristate m

  config MODULES
          def_bool y
          option modules

If you set FOO=y, BAZ is also promoted to y, which results in the
following .config file:

  CONFIG_FOO=y
  CONFIG_BAZ=y
  CONFIG_BAR=m
  CONFIG_MODULES=y

This does not meet the dependency 'BAZ depends on BAR'.

Unlike 'select', what is worse, Kconfig never shows the
'WARNING: unmet direct dependencies detected for ...' for this case.

Because 'imply' is considered to be weaker than 'depends on', Kconfig
should take the direct dependency into account.

For clarification, describe this case in kconfig-language.rst too.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
2020-03-13 10:05:34 +09:00
Masahiro Yamada
def2fbffe6 kconfig: allow symbols implied by y to become m
The 'imply' keyword restricts a symbol to y or n, excluding m
when it is implied by y. This is the original behavior since
commit 237e3ad0f1 ("Kconfig: Introduce the "imply" keyword").

However, the author of this feature, Nicolas Pitre, stated that
the 'imply' keyword should not impose any restrictions.
(https://lkml.org/lkml/2020/2/19/714)

I agree, and want to get rid of this tricky behavior.

Suggested-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
2020-03-13 10:05:34 +09:00
Masahiro Yamada
2a86f66121 kbuild: use KBUILD_DEFCONFIG as the fallback for DEFCONFIG_LIST
Most of the Kconfig commands (except defconfig and all*config) read
the .config file as a base set of CONFIG options.

When it does not exist, the files in DEFCONFIG_LIST are searched in
this order and loaded if found.

I do not see much sense in the last two lines in DEFCONFIG_LIST.

[1] ARCH_DEFCONFIG

The entry for DEFCONFIG_LIST is guarded by 'depends on !UML'. So, the
ARCH_DEFCONFIG definition in arch/x86/um/Kconfig is meaningless.

arch/{sh,sparc,x86}/Kconfig define ARCH_DEFCONFIG depending on 32 or
64 bit variant symbols. This is a little bit strange; ARCH_DEFCONFIG
should be a fixed string because the base config file is loaded before
the symbol evaluation stage.

Using KBUILD_DEFCONFIG makes more sense because it is fixed before
Kconfig is invoked. Fortunately, arch/{sh,sparc,x86}/Makefile define it
in the same way, and it works as expected. Hence, replace ARCH_DEFCONFIG
with "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)".

[2] arch/$(ARCH)/defconfig

This file path is no longer valid. The defconfig files are always located
in the arch configs/ directories.

  $ find arch -name defconfig | sort
  arch/alpha/configs/defconfig
  arch/arm64/configs/defconfig
  arch/csky/configs/defconfig
  arch/nds32/configs/defconfig
  arch/riscv/configs/defconfig
  arch/s390/configs/defconfig
  arch/unicore32/configs/defconfig

The path arch/*/configs/defconfig is already covered by
"arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". So, this file path is
not necessary.

I moved the default KBUILD_DEFCONFIG to the top Makefile. Otherwise,
the 7 architectures listed above would end up with endless loop of
syncconfig.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-03-03 20:49:21 +09:00
Tetsuo Handa
089b7d890f kconfig: Invalidate all symbols after changing to y or m.
Since commit 89b9060987 ("kconfig: Add yes2modconfig and
mod2yesconfig targets.") forgot to clear SYMBOL_VALID bit after
changing to y or m, these targets did not save the changes.
Call sym_clear_all_valid() so that all symbols are revalidated.

Fixes: 89b9060987 ("kconfig: Add yes2modconfig and mod2yesconfig targets.")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-02-05 13:45:37 +09:00
Masahiro Yamada
5f2fb52fac kbuild: rename hostprogs-y/always to hostprogs/always-y
In old days, the "host-progs" syntax was used for specifying host
programs. It was renamed to the current "hostprogs-y" in 2004.

It is typically useful in scripts/Makefile because it allows Kbuild to
selectively compile host programs based on the kernel configuration.

This commit renames like follows:

  always       ->  always-y
  hostprogs-y  ->  hostprogs

So, scripts/Makefile will look like this:

  always-$(CONFIG_BUILD_BIN2C) += ...
  always-$(CONFIG_KALLSYMS)    += ...
      ...
  hostprogs := $(always-y) $(always-m)

I think this makes more sense because a host program is always a host
program, irrespective of the kernel configuration. We want to specify
which ones to compile by CONFIG options, so always-y will be handier.

The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
compatibility for a while.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-02-04 01:53:07 +09:00
Masahiro Yamada
c8fb7d7e48 kconfig: fix broken dependency in randconfig-generated .config
Running randconfig on arm64 using KCONFIG_SEED=0x40C5E904 (e.g. on v5.5)
produces the .config with CONFIG_EFI=y and CONFIG_CPU_BIG_ENDIAN=y,
which does not meet the !CONFIG_CPU_BIG_ENDIAN dependency.

This is because the user choice for CONFIG_CPU_LITTLE_ENDIAN vs
CONFIG_CPU_BIG_ENDIAN is set by randomize_choice_values() after the
value of CONFIG_EFI is calculated.

When this happens, the has_changed flag should be set.

Currently, it takes the result from the last iteration. It should
accumulate all the results of the loop.

Fixes: 3b9a19e089 ("kconfig: loop as long as we changed some symbols in randconfig")
Reported-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-02-04 01:49:12 +09:00
Linus Torvalds
14cd0bd049 Kconfig updates for v5.6
- add 'yes2modconfig' and 'mod2yesconfig' targets
 
  - sanitize help text
 
  - various code cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl409w0VHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGPycQAKz1wnrq+dzPVWzGdA/EtDx3ceFA
 getIw64yav40rQcWu1Yzv4O8Lehh6tKyp6x2B9gEQKz+GUlwaX+mt6RR1OhXEpDT
 atntkCIbXJzEjoZPgl4qUhz7rWVqF0Sx/U16dlc9ZyXPFjCYTsea3IUuKru4v5Rd
 vixq/7RI6RWTCUwztcNtzw0OeguRgOAnMcS0uEufQ3KS4SufXLfNFxZfaeo09bXV
 p4UnKncvcl8Gbto0IW6pQo4w62oIP7ojIsOIzsw2baQcvRSF6S8Tu1KRx8Bk6/Ez
 2TGn92LMEJEckPbGpyt5Q/vC08kLVz0lxCnGg9QebKijxhWt8SZNmX+uwow7oYlR
 rKd6l4Uki2C9nuUiLXicQ85Gy6ItXXH5c3PC+L0Ud+AqZF5MmAOjdrHN+Ty3MoIp
 slOvYOFBPpZ6yOxCYoMlsCd839BQbQbkn3zy86RMNB4Dz92BaH1mjWu5pv6fbywr
 CpAToFqEaBsdvkoMsFgOhdVVCgd/ep5VKFJlpVthluoGsBZwhdJBGGO+UHwIc28o
 cn9qKkM2vVz+vqYcUVP5H+w8FMBV0ibAuOvxb8trfUnDKwLX7TYBr+tCUWPA1TfN
 4nEf80A1KJ1ALqsOFApWnsGgZdimkDVsbHJI7ICDnwPCx8icKdz4QIEsEcQq+da0
 gHA2DH1q41rg1OnT
 =FgLk
 -----END PGP SIGNATURE-----

Merge tag 'kconfig-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kconfig updates from Masahiro Yamada:

 - add 'yes2modconfig' and 'mod2yesconfig' targets (useful mainly for
   turning syzbot configs into more modular ones as a step to minimizing
   the result)

 - sanitize help text

 - various code cleanups

* tag 'kconfig-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: fix documentation typos
  kconfig: fix an "implicit declaration of function" warning
  kconfig: fix nesting of symbol help text
  kconfig: distinguish between dependencies and visibility in help text
  kconfig: list all definitions of a symbol in help text
  kconfig: Add yes2modconfig and mod2yesconfig targets.
  kconfig: use $(PERL) in Makefile
  kconfig: fix too deep indentation in Makefile
  kconfig: localmodconfig: fix indentation for closing brace
  kconfig: localmodconfig: remove unused $config
  kconfig: squash prop_alloc() into menu_add_prop()
  kconfig: remove sym from struct property
  kconfig: remove 'prompt' argument from menu_add_prop()
  kconfig: move prompt handling to menu_add_prompt() from menu_add_prop()
  kconfig: remove 'prompt' symbol
  kconfig: drop T_WORD from the RHS of 'prompt' symbol
  kconfig: use parent->dep as the parentdep of 'menu'
  kconfig: remove the rootmenu check in menu_add_prop()
2020-02-01 10:25:55 -08:00
Bartosz Golaszewski
ba82f52e22 kconfig: fix an "implicit declaration of function" warning
strncasecmp() & strcasecmp() functions are declared in strings.h, not
string.h. On most environments the former is implicitly included by
the latter but on some setups, building menuconfig results in the
following warning:

  HOSTCC  scripts/kconfig/mconf.o
scripts/kconfig/mconf.c: In function ‘search_conf’:
scripts/kconfig/mconf.c:423:6: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
  if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
      ^~~~~~~~~~~
scripts/kconfig/mconf.c: In function ‘main’:
scripts/kconfig/mconf.c:1021:8: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration]
   if (!strcasecmp(mode, "single_menu"))
        ^~~~~~~~~~

Fix it by explicitly including strings.h.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-10 02:44:54 +09:00
Thomas Hebb
a960968604 kconfig: fix nesting of symbol help text
When we generate the help text of a symbol (e.g. when a user presses '?'
in menuconfig), we do two things:

 1. We iterate through every prompt that belongs to that symbol,
    printing its text and its location in the menu tree.
 2. We print symbol-wide information that's not linked to a particular
    prompt, such as what it selects/is selected by and what it
    implies/is implied by.

Each prompt we print for 1 starts with a line that's not indented
indicating where the prompt is defined, then continues with indented
lines that describe properties of that particular definition.

Once we get to 2, however, we print all the global data indented as
well! Visually, this makes it look like the symbol-wide data is
associated with the last prompt we happened to print rather than
the symbol as a whole.

Fix this by removing the indentation for symbol-wide information.

Before:

  Symbol: CPU_FREQ [=n]
  Type  : bool
  Defined at drivers/cpufreq/Kconfig:4
    Prompt: CPU Frequency scaling
    Location:
      -> CPU Power Management
        -> CPU Frequency scaling
    Selects: SRCU [=n]
    Selected by [n]:
    - ARCH_SA1100 [=n] && <choice>

After:

  Symbol: CPU_FREQ [=n]
  Type  : bool
  Defined at drivers/cpufreq/Kconfig:4
    Prompt: CPU Frequency scaling
    Location:
      -> CPU Power Management
        -> CPU Frequency scaling
  Selects: SRCU [=n]
  Selected by [n]:
    - ARCH_SA1100 [=n] && <choice>

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:45 +09:00
Thomas Hebb
3460d0bc25 kconfig: distinguish between dependencies and visibility in help text
Kconfig makes a distinction between dependencies (defined by "depends
on" expressions and enclosing "if" blocks) and visibility (which
includes all dependencies, but also includes inline "if" expressions of
individual properties as well as, for prompts, "visible if" expressions
of enclosing menus).

Before commit bcdedcc1af ("menuconfig: print more info for symbol
without prompts"), the "Depends on" lines of a symbol's help text
indicated the visibility of the prompt property they appeared under.
After bcdedcc1af, there was always only a single "Depends on" line,
which indicated the visibility of the first P_SYMBOL property of the
symbol. Since P_SYMBOLs never have inline if expressions, this was in
effect the same as the dependencies of the menu item that the P_SYMBOL
was attached to.

Neither of these situations accurately conveyed the dependencies of a
symbol--the first because it was actually the visibility, and the second
because it only showed the dependencies from a single definition.

With this series, we are back to printing separate dependencies for each
definition, but we print the actual dependencies (rather than the
visibility) in the "Depends on" line. However, it can still be useful to
know the visibility of a prompt, so this patch adds a "Visible if" line
that shows the visibility only if the visibility is different from the
dependencies (which it isn't for most prompts in Linux).

Before:

  Symbol: THUMB2_KERNEL [=n]
  Type  : bool
  Defined at arch/arm/Kconfig:1417
    Prompt: Compile the kernel in Thumb-2 mode
    Depends on: (CPU_V7 [=y] || CPU_V7M [=n]) && !CPU_V6 [=n] && !CPU_V6K [=n]
    Location:
      -> Kernel Features
    Selects: ARM_UNWIND [=n]

After:

   Symbol: THUMB2_KERNEL [=n]
   Type  : bool
   Defined at arch/arm/Kconfig:1417
     Prompt: Compile the kernel in Thumb-2 mode
     Depends on: (CPU_V7 [=y] || CPU_V7M [=n]) && !CPU_V6 [=n] && !CPU_V6K [=n]
     Visible if: (CPU_V7 [=y] || CPU_V7M [=n]) && !CPU_V6 [=n] && !CPU_V6K [=n] && !CPU_THUMBONLY [=n]
     Location:
       -> Kernel Features
     Selects: ARM_UNWIND [=n]

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:45 +09:00
Thomas Hebb
edda15f219 kconfig: list all definitions of a symbol in help text
In Kconfig, each symbol (representing a config option) can be defined in
multiple places. Each definition may or may not have a prompt, which
allows the option to be set via an interface like menuconfig. Each
definition has a set of dependencies, which determine whether its prompt
is visible and whether other pieces of the definition, like a default
value, take effect.

Historically, a symbol's help text (i.e. what's shown when a user
presses '?' in menuconfig) contained some symbol-wide information not
tied to any particular definition (e.g. what other symbols it selects)
as well as the location (file name and line number) and dependencies of
each prompt. Notably, the help text did not show the location or
dependencies of definitions without prompts.

Because this made it hard to reason about symbols that had no prompts,
commit bcdedcc1af ("menuconfig: print more info for symbol without
prompts") changed the help text so that, instead of containing the
location and dependencies of each prompt, it contained the location and
dependencies of the symbol's first definition, regardless of whether or
not that definition had a prompt.

For symbols with only one definition, that change makes sense. However,
it breaks down for symbols with multiple definitions: each definition
has its own set of dependencies (the `dep` field of `struct menu`), and
those dependencies are ORed together to get the symbol's dependency list
(the `dir_dep` field of `struct symbol`). By printing only the
dependencies of the first definition, the help text misleads users into
believing that an option is more narrowly-applicable than it actually
is.

For an extreme example of this, we can look at the SYS_TEXT_BASE symbol
in the Das U-Boot project (version 2019.10), which also uses Kconfig. (I
unfortunately could not find an illustrative example in Linux.) This
config option specifies the load address of the built binary and, as
such, is applicable to basically every configuration possible. And yet,
without this patch, its help text is as follows:

  Symbol: SYS_TEXT_BASE [=]
  Type  : hex
  Prompt: U-Boot base address
    Location:
      -> ARM architecture
  Prompt: Text Base
    Location:
      -> Boot images
    Defined at arch/arm/mach-aspeed/Kconfig:9
    Depends on: ARM [=n] && ARCH_ASPEED [=n]

The help text indicates that the option is applicable only for a
specific unselected architecture (aspeed), because that architecture's
promptless definition (which just sets a default value), happens to be
the first one seen. No definition or dependency information is printed
for either of the two prompts listed.

Because source locations and dependencies are fundamentally properties
of definitions and not of symbols, we should treat them as such. This
patch brings back the pre-bcdedcc1afd6 behavior for definitions with
prompts but also separately prints the location and dependencies of
those without prompts, solving the original problem in a different way.
With this change, our SYS_TEXT_BASE example becomes

   Symbol: SYS_TEXT_BASE [=]
   Type  : hex
   Defined at arch/arm/mach-stm32mp/Kconfig:83
     Prompt: U-Boot base address
     Depends on: ARM [=n] && ARCH_STM32MP [=n]
     Location:
       -> ARM architecture
   Defined at Kconfig:532
     Prompt: Text Base
     Depends on: !NIOS2 [=n] && !XTENSA [=n] && !EFI_APP [=n]
     Location:
       -> Boot images
   Defined at arch/arm/mach-aspeed/Kconfig:9
     Depends on: ARM [=n] && ARCH_ASPEED [=n]
   Defined  at arch/arm/mach-socfpga/Kconfig:25
     Depends on: ARM [=n] && ARCH_SOCFPGA [=n]
   <snip>
   Defined at board/sifive/fu540/Kconfig:15
     Depends on: RISCV [=n] && TARGET_SIFIVE_FU540 [=n]

which is a much more accurate representation.

Note that there is one notable difference between what gets printed for
prompts after this change and what got printed before bcdedcc1af: the
"Depends on" line now accurately represents the prompt's dependencies
instead of conflating those with the prompt's visibility (which can
include extra conditions). See the patch later in this series titled
"kconfig: distinguish between dependencies and visibility in help text"
for more details and better handling of that nuance.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:45 +09:00
Tetsuo Handa
89b9060987 kconfig: Add yes2modconfig and mod2yesconfig targets.
Since kernel configs provided by syzbot are close to "make allyesconfig",
it takes long time to rebuild. This is especially waste of time when we
need to rebuild for many times (e.g. doing manual printk() inspection,
bisect operations).

We can save time if we can exclude modules which are irrelevant to each
problem. But "make localmodconfig" cannot exclude modules which are built
into vmlinux because /sbin/lsmod output is used as the source of modules.

Therefore, this patch adds "make yes2modconfig" which converts from =y
to =m if possible. After confirming that the interested problem is still
reproducible, we can try "make localmodconfig" (and/or manually tune
based on "Modules linked in:" line) in order to exclude modules which are
irrelevant to the interested problem. While we are at it, this patch also
adds "make mod2yesconfig" which converts from =m to =y in case someone
wants to convert from =m to =y after "make localmodconfig".

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:45 +09:00
Masahiro Yamada
c8138a57bb kconfig: use $(PERL) in Makefile
The top Makefile defines and exports the variable 'PERL'. Use it in
case somebody wants to specify a particular version of perl from the
command line.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:45 +09:00
Masahiro Yamada
1d1352373e kconfig: fix too deep indentation in Makefile
The indentation for if ... else ... fi is too deep. Fix it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:45 +09:00
Masahiro Yamada
68f0d62746 kconfig: localmodconfig: fix indentation for closing brace
This is the closing brace for the foreach loop. Fix the misleading
indentation.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:45 +09:00
Masahiro Yamada
5edcef8454 kconfig: localmodconfig: remove unused $config
This is unused since commit cdfc47950a ("kconfig: search for a config
to base the local(mod|yes)config on").

Having unused $config is confusing because $config is used as a local
variable in various sub-routines.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
adf7c5bd06 kconfig: squash prop_alloc() into menu_add_prop()
prop_alloc() is only called from menu_add_prop(). Squash it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
6397d96ba5 kconfig: remove sym from struct property
struct property can reference to the symbol that it is associated with
by prop->menu->sym.

Fix up the one usage of prop->sym, and remove sym from struct property.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
2ffeef615b kconfig: remove 'prompt' argument from menu_add_prop()
This function no longer uses the 'prompt' argument.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
024352ff8d kconfig: move prompt handling to menu_add_prompt() from menu_add_prop()
menu_add_prompt() is the only function that calls menu_add_prop() with
non-NULL prompt.

So, the code inside the if-conditional block of menu_add_prop() can be
moved to menu_add_prompt().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
1be6e79138 kconfig: remove 'prompt' symbol
Now that 'prompt' is only reduced from T_WORD_QUOTE without any action,
use T_WORD_QUOTE directly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
801b27db46 kconfig: drop T_WORD from the RHS of 'prompt' symbol
Commit 8636a1f967 ("treewide: surround Kconfig file paths with double
quotes") killed use-cases to reduce an unquoted string into the 'prompt'
symbol.

Kconfig still allows to use an unquoted string in the context of menu,
source, or prompt.

So, you can omit quoting if the prompt is a single word:

    bool foo

..., but I do not think this is so useful.

Let's require quoting:

    bool "foo"

All the Kconfig files in the kernel are written in this way.

Remove the T_WORD from the right-hand side of the symbol 'prompt'.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
de026ca915 kconfig: use parent->dep as the parentdep of 'menu'
In menu_finalize(), the dependency of a menu entry is propagated
downwards.

For the 'menu', parent->dep and parent->prompt->visible.expr have
the same expression. Both accumulate the 'depends on' of itself and
upper menu entries.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
f64048a20b kconfig: remove the rootmenu check in menu_add_prop()
This reverts commit ba6ff60d5e ("kconfig: don't emit warning upon
rootmenu's prompt redefinition").

At that time, rootmenu.prompt was always set first, then it was set
again if a "mainmenu" statement was specified in the Kconfig file.

This is no longer the case since commit 0724a7c32a ("kconfig: Don't
leak main menus during parsing"). Remove the unneeded check.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:44 +09:00
Masahiro Yamada
8b41fc4454 kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf
Commit bc081dd6e9 ("kbuild: generate modules.builtin") added
infrastructure to generate modules.builtin, the list of all
builtin modules.

Basically, it works like this:

  - Kconfig generates include/config/tristate.conf, the list of
    tristate CONFIG options with a value in a capital letter.

  - scripts/Makefile.modbuiltin makes Kbuild descend into
    directories to collect the information of builtin modules.

I am not a big fan of it because Kbuild ends up with traversing
the source tree twice.

I am not sure how perfectly it should work, but this approach cannot
avoid false positives; even if the relevant CONFIG option is tristate,
some Makefiles forces obj-m to obj-y.

Some examples are:

  arch/powerpc/platforms/powermac/Makefile:
    obj-$(CONFIG_NVRAM:m=y)         += nvram.o

  net/ipv6/Makefile:
    obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o

  net/netlabel/Makefile:
    obj-$(subst m,y,$(CONFIG_IPV6)) += netlabel_calipso.o

Nobody has complained about (or noticed) it, so it is probably fine to
have false positives in modules.builtin.

This commit simplifies the implementation. Let's exploit the fact
that every module has MODULE_LICENSE(). (modpost shows a warning if
MODULE_LICENSE is missing. If so, 0-day bot would already have blocked
such a module.)

I added MODULE_FILE to <linux/module.h>. When the code is being compiled
as builtin, it will be filled with the file path of the module, and
collected into modules.builtin.info. Then, scripts/link-vmlinux.sh
extracts the list of builtin modules out of it.

This new approach fixes the false-positives above, but adds another
type of false-positives; non-modular code may have MODULE_LICENSE()
by mistake. This is not a big deal, it is just the code is always
orphan. We can clean it up if we like. You can see cleanup examples by:

  $ git log --grep='make.* explicitly non-modular'

To sum up, this commits deletes lots of code, but still produces almost
equivalent results. Please note it does not increase the vmlinux size at
all. As you can see in include/asm-generic/vmlinux.lds.h, the .modinfo
section is discarded in the link stage.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-01-07 02:18:39 +09:00
Thomas Hebb
272a721030 kconfig: don't crash on NULL expressions in expr_eq()
NULL expressions are taken to always be true, as implemented by the
expr_is_yes() macro and by several other functions in expr.c. As such,
they ought to be valid inputs to expr_eq(), which compares two
expressions.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2019-12-17 19:21:07 +09:00
Alyssa Ross
46b2afa689 kconfig: be more helpful if pkg-config is missing
If ncurses is installed, but at a non-default location, the previous
error message was not helpful in resolving the situation.  Now it will
suggest that pkg-config might need to be installed in addition to
ncurses.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-11-11 20:10:01 +09:00
Laura Abbott
5d8b42aa7c kconfig: Add option to get the full help text with listnewconfig
make listnewconfig will list the individual options that need to be set.
This is useful but there's no easy way to get the help text associated
with the options at the same time. Introduce a new targe
'make helpnewconfig' which lists the full help text of all the
new options as well. This makes it easier to automatically generate
changes that are easy for humans to review. This command also adds
markers between each option for easier parsing.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-11-11 20:10:01 +09:00
Geert Uytterhoeven
a64c0440dd kbuild: Wrap long "make help" text lines
Some "make help" text lines extend beyond 80 characters.
Wrap them before an opening parenthesis, or before 80 characters.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-11-11 20:10:01 +09:00
Masahiro Yamada
521b29b6ff kconfig: split util.c out of parser.y
util.c exists both in scripts/kconfig/ and scripts/kconfig/lxdialog.

Prior to commit 54b8ae66ae ("kbuild: change *FLAGS_<basetarget>.o
to take the path relative to $(obj)"), Kbuild could not pass different
flags to source files with the same basename. Now that this issue
was solved, you can split util.c out of parser.y and compile them
independently of each other.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-11-11 20:07:03 +09:00
Guillaume Tucker
60bef52c7a merge_config.sh: ignore unwanted grep errors
The merge_config.sh script verifies that all the config options have
their expected value in the resulting file and prints any issues as
warnings.  These checks aren't intended to be treated as errors given
the current implementation.  However, since "set -e" was added, if the
grep command to look for a config option does not find it the script
will then abort prematurely.

Handle the case where the grep exit status is non-zero by setting
ACTUAL_VAL to an empty string to restore previous functionality.

Fixes: cdfca82157 ("merge_config.sh: Check error codes from make")
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-09-04 23:12:50 +09:00
Masahiro Yamada
54b8ae66ae kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj)
Kbuild provides per-file compiler flag addition/removal:

  CFLAGS_<basetarget>.o
  CFLAGS_REMOVE_<basetarget>.o
  AFLAGS_<basetarget>.o
  AFLAGS_REMOVE_<basetarget>.o
  CPPFLAGS_<basetarget>.lds
  HOSTCFLAGS_<basetarget>.o
  HOSTCXXFLAGS_<basetarget>.o

The <basetarget> is the filename of the target with its directory and
suffix stripped.

This syntax comes into a trouble when two files with the same basename
appear in one Makefile, for example:

  obj-y += foo.o
  obj-y += dir/foo.o
  CFLAGS_foo.o := <some-flags>

Here, the <some-flags> applies to both foo.o and dir/foo.o

The real world problem is:

  scripts/kconfig/util.c
  scripts/kconfig/lxdialog/util.c

Both files are compiled into scripts/kconfig/mconf, but only the
latter should be given with the ncurses flags.

It is more sensible to use the relative path to the Makefile, like this:

  obj-y += foo.o
  CFLAGS_foo.o := <some-flags>
  obj-y += dir/foo.o
  CFLAGS_dir/foo.o := <other-flags>

At first, I attempted to replace $(basetarget) with $*. The $* variable
is replaced with the stem ('%') part in a pattern rule. This works with
most of cases, but does not for explicit rules.

For example, arch/ia64/lib/Makefile reuses rule_as_o_S in its own
explicit rules, so $* will be empty, resulting in ignoring the per-file
AFLAGS.

I introduced a new variable, target-stem, which can be used also from
explicit rules.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Marc Zyngier <maz@kernel.org>
2019-09-04 23:12:50 +09:00
Masahiro Yamada
1634f2bfdb kbuild: remove clean-dirs syntax
The only the difference between clean-files and clean-dirs is the -r
option passed to the 'rm' command.

You can always pass -r, and then remove the clean-dirs syntax.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-08-29 23:54:29 +09:00
Mark Brown
cdfca82157 merge_config.sh: Check error codes from make
When we execute make after merging the configurations we ignore any
errors it produces causing whatever is running merge_config.sh to be
unaware of any failures.  This issue was noticed by Guillaume Tucker
while looking at problems with testing of clang only builds in KernelCI
which caused Kbuild to be unable to find a working host compiler.

This implementation was suggested by Yamada-san.

Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-08-22 01:14:11 +09:00
M. Vefa Bicakci
0c5b6c28ed kconfig: Clear "written" flag to avoid data loss
Prior to this commit, starting nconfig, xconfig or gconfig, and saving
the .config file more than once caused data loss, where a .config file
that contained only comments would be written to disk starting from the
second save operation.

This bug manifests itself because the SYMBOL_WRITTEN flag is never
cleared after the first call to conf_write, and subsequent calls to
conf_write then skip all of the configuration symbols due to the
SYMBOL_WRITTEN flag being set.

This commit resolves this issue by clearing the SYMBOL_WRITTEN flag
from all symbols before conf_write returns.

Fixes: 8e2442a5f8 ("kconfig: fix missing choice values in auto.conf")
Cc: linux-stable <stable@vger.kernel.org> # 4.19+
Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-08-04 12:44:15 +09:00
Masahiro Yamada
8e2442a5f8 kconfig: fix missing choice values in auto.conf
Since commit 00c864f890 ("kconfig: allow all config targets to write
auto.conf if missing"), Kconfig creates include/config/auto.conf in the
defconfig stage when it is missing.

Joonas Kylmälä reported incorrect auto.conf generation under some
circumstances.

To reproduce it, apply the following diff:

|  --- a/arch/arm/configs/imx_v6_v7_defconfig
|  +++ b/arch/arm/configs/imx_v6_v7_defconfig
|  @@ -345,14 +345,7 @@ CONFIG_USB_CONFIGFS_F_MIDI=y
|   CONFIG_USB_CONFIGFS_F_HID=y
|   CONFIG_USB_CONFIGFS_F_UVC=y
|   CONFIG_USB_CONFIGFS_F_PRINTER=y
|  -CONFIG_USB_ZERO=m
|  -CONFIG_USB_AUDIO=m
|  -CONFIG_USB_ETH=m
|  -CONFIG_USB_G_NCM=m
|  -CONFIG_USB_GADGETFS=m
|  -CONFIG_USB_FUNCTIONFS=m
|  -CONFIG_USB_MASS_STORAGE=m
|  -CONFIG_USB_G_SERIAL=m
|  +CONFIG_USB_FUNCTIONFS=y
|   CONFIG_MMC=y
|   CONFIG_MMC_SDHCI=y
|   CONFIG_MMC_SDHCI_PLTFM=y

And then, run:

$ make ARCH=arm mrproper imx_v6_v7_defconfig

You will see CONFIG_USB_FUNCTIONFS=y is correctly contained in the
.config, but not in the auto.conf.

Please note drivers/usb/gadget/legacy/Kconfig is included from a choice
block in drivers/usb/gadget/Kconfig. So USB_FUNCTIONFS is a choice value.

This is probably a similar situation described in commit beaaddb625
("kconfig: tests: test defconfig when two choices interact").

When sym_calc_choice() is called, the choice symbol forgets the
SYMBOL_DEF_USER unless all of its choice values are explicitly set by
the user.

The choice symbol is given just one chance to recall it because
set_all_choice_values() is called if SYMBOL_NEED_SET_CHOICE_VALUES
is set.

When sym_calc_choice() is called again, the choice symbol forgets it
forever, since SYMBOL_NEED_SET_CHOICE_VALUES is a one-time aid.
Hence, we cannot call sym_clear_all_valid() again and again.

It is crazy to repeat set and unset of internal flags. However, we
cannot simply get rid of "sym->flags &= flags | ~SYMBOL_DEF_USER;"
Doing so would re-introduce the problem solved by commit 5d09598d48
("kconfig: fix new choices being skipped upon config update").

To work around the issue, conf_write_autoconf() stopped calling
sym_clear_all_valid().

conf_write() must be changed accordingly. Currently, it clears
SYMBOL_WRITE after the symbol is written into the .config file. This
is needed to prevent it from writing the same symbol multiple times in
case the symbol is declared in two or more locations. I added the new
flag SYMBOL_WRITTEN, to track the symbols that have been written.

Anyway, this is a cheesy workaround in order to suppress the issue
as far as defconfig is concerned.

Handling of choices is totally broken. sym_clear_all_valid() is called
every time a user touches a symbol from the GUI interface. To reproduce
it, just add a new symbol drivers/usb/gadget/legacy/Kconfig, then touch
around unrelated symbols from menuconfig. USB_FUNCTIONFS will disappear
from the .config file.

I added the Fixes tag since it is more fatal than before. But, this
has been broken since long long time before, and still it is.
We should take a closer look to fix this correctly somehow.

Fixes: 00c864f890 ("kconfig: allow all config targets to write auto.conf if missing")
Cc: linux-stable <stable@vger.kernel.org> # 4.19+
Reported-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
2019-07-17 22:37:51 +09:00
Masahiro Yamada
3266c806dc kconfig: run olddefconfig instead of oldconfig after merging fragments
'make olddefconfig' is non-interactive, so we can drop 'yes'.
The behavior is equivalent.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-07-17 10:25:10 +09:00
Linus Torvalds
106f1466e7 Kconfig updates for v5.3
- always require argument for --defconfig and remove the hard-coded
   arch/$(ARCH)/defconfig path
 
 - make arch/$(SRCARCH)/configs/defconfig the new default of defconfig
 
 - some code cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQJSBAABCgA8FiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl0oxR0eHHlhbWFkYS5t
 YXNhaGlyb0Bzb2Npb25leHQuY29tAAoJED2LAQed4NsG6mcP/20IEEaWCnpQf45c
 0f724ZiVJzl3auhAyZZzjHSj6n4J0cP+91BSilS9tfkCcrhemxK6JitTbLdNq6qi
 pRAVX3cGxeAn0qpqRqGwcDGL9I+iEi559fSG4k0/tWP1ILDvNFKy6dEvPqzPXdRX
 uRCt99Mw52GInKAnXMtoK6CbOQjDjzw/iuvn6+MgDRdVpTI4wzMMUPY5PdEC6ebH
 xnGzVzNT1PlSyW8FsHSUNkpYDWtRAfqapFWzv1zUS9s0PLkCgHNq/M1uZKFfxrl7
 GRZPGZvlDUTTnoED0uGWun+GAA78dr5GUWPC0Dm5oUMZs0dkcPnafaNl7jt+mHkf
 akbHHMxLqmSC7JAodBaCbwmqFr1vQamQgpwWD2EEA5ixOU26MIXFH38aEcNCl9zt
 Ym310BIYvVWaqDqOHy1AHBQSSheuo76WdJMYKuQyaa85QUKvys51nMQTRgFuF/13
 UNdOpUk4bCM5eUHg5gQHT8E50biJ1p97qmv9iYMKjQ8PssG43vushGpSwROwNxEX
 BvOf3wjocL5I666dRWW/y7vhbwRrKraNYmEVdJ9v7YbEmDNbjcQkuwHTdKS8JYz2
 xrwrwio8xUKjSaIKZ3zilAQ5CE47JgWPn48OwL1HeDadrXTbSmIARpZRIFL8f4NR
 1vjhSc1Ll1kmopSnKJRmpMvKjMlb
 =1fr/
 -----END PGP SIGNATURE-----

Merge tag 'kconfig-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kconfig updates from Masahiro Yamada:

 - always require argument for --defconfig and remove the hard-coded
   arch/$(ARCH)/defconfig path

 - make arch/$(SRCARCH)/configs/defconfig the new default of defconfig

 - some code cleanups

* tag 'kconfig-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: remove meaningless if-conditional in conf_read()
  kconfig: Fix spelling of sym_is_changable
  unicore32: rename unicore32_defconfig to defconfig
  kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG
  kconfig: add static qualifier to expand_string()
  kconfig: require the argument of --defconfig
  kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional
2019-07-12 16:06:27 -07:00
Masahiro Yamada
e3cd5136a4 kconfig: remove meaningless if-conditional in conf_read()
sym_is_choice(sym) has already been checked by previous if-block:

    if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
            continue;

Hence, the following code is redundant, and the comment is misleading:

    if (!sym_is_choice(sym))
            continue;
    /* fall through */

It always takes 'continue', never falls though.

Clean up the dead code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-07-11 23:37:55 +09:00
Marco Ammon
baa23ec860 kconfig: Fix spelling of sym_is_changable
There is a spelling mistake in "changable", it is corrected to
"changeable" and all call sites are updated accordingly.

Signed-off-by: Marco Ammon <marco.ammon@fau.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-07-06 21:58:23 +09:00
Mauro Carvalho Chehab
cd238effef docs: kbuild: convert docs to ReST and rename to *.rst
The kbuild documentation clearly shows that the documents
there are written at different times: some use markdown,
some use their own peculiar logic to split sections.

Convert everything to ReST without affecting too much
the author's style and avoiding adding uneeded markups.

The conversion is actually:
  - add blank lines and identation in order to identify paragraphs;
  - fix tables markups;
  - add some lists markups;
  - mark literal blocks;
  - adjust title markups.

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2019-06-14 14:21:21 -06:00
Masahiro Yamada
bd305f259c kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG
Until recently, if KBUILD_DEFCONFIG was not set by the arch Makefile,
the default path arch/*/defconfig was used.

The last users of the default are gone by the following commits:

- Commit f3e20ad67b ("s390: move arch/s390/defconfig to
  arch/s390/configs/defconfig")

- Commit 986a13769c ("alpha: move arch/alpha/defconfig to
  arch/alpha/configs/defconfig")

Let's set arch/*/configs/defconfig as a new default. This saves
KBUILD_DEFCONFIG for some architectures.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
2019-06-09 15:08:18 +09:00
Masahiro Yamada
5533397d1e kconfig: add static qualifier to expand_string()
Now expand_string() is only used in preprocess.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-06-09 15:08:18 +09:00
Masahiro Yamada
b6f7e9f705 kconfig: require the argument of --defconfig
Currently, the argument for --defconfig is optional. If the argument
is not passed, the hard-coded default arch/$(ARCH)/defconfig is used.

It no longer happens in Linux since the last users of the default are
gone by the following commits:

- Commit f3e20ad67b ("s390: move arch/s390/defconfig to
  arch/s390/configs/defconfig")

- Commit 986a13769c ("alpha: move arch/alpha/defconfig to
  arch/alpha/configs/defconfig")

I want to kill the Linux-specific directory path embedded in the
Kconfig binary.

The --savedefconfig (reverse operation of --defconfig) requires an
argument, so it should not hurt to do likewise for --defconfig.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-06-09 15:08:18 +09:00
Masahiro Yamada
e0a2668665 kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional
With the following two commits applied, all the arch Makefiles
define KBUILD_DEFCONFIG.

- Commit f3e20ad67b ("s390: move arch/s390/defconfig to
  arch/s390/configs/defconfig")

- Commit 986a13769c ("alpha: move arch/alpha/defconfig to
  arch/alpha/configs/defconfig")

The first conditional in the defconfig rule is always false.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-06-09 15:08:18 +09:00
Masahiro Yamada
8dde5715b2 kconfig: tests: fix recursive inclusion unit test
Adding SPDX license identifier is pretty safe; however, here is one
exception.

Since commit ec8f24b7fa ("treewide: Add SPDX license identifier -
Makefile/Kconfig"), "make testconfig" would not pass.

When Kconfig detects a circular file inclusion, it displays error
messages with a file name and a line number prefixed to each line.

The unit test checks if Kconfig emits the error messages correctly
(this also checks the line number correctness).

Now that the test input has the SPDX license identifier at the very top,
the line numbers in the expected stderr should be incremented by 1.

Fixes: ec8f24b7fa ("treewide: Add SPDX license identifier - Makefile/Kconfig")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-06-05 02:33:10 +09:00
Thomas Gleixner
ec8f24b7fa treewide: Add SPDX license identifier - Makefile/Kconfig
Add SPDX license identifiers to all Make/Kconfig files which:

 - Have no license information of any form

These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:

  GPL-2.0-only

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 10:50:46 +02:00
Masahiro Yamada
fc2694ec1a kconfig: use 'else ifneq' for Makefile to improve readability
'ifeq ... else ifneq ... endif' notation is supported by GNU Make 3.81
or later, which is the requirement for building the kernel since
commit 37d69ee308 ("docs: bump minimal GNU Make version to 3.81").

Use it to improve the readability.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-19 09:34:35 +09:00
Alexander Popov
aff11cd983 kconfig: Terminate menu blocks with a comment in the generated config
Currently menu blocks start with a pretty header but end with nothing in
the generated config. So next config options stick together with the
options from the menu block.

Let's terminate menu blocks in the generated config with a comment and
a newline if needed. Example:

...
CONFIG_BPF_STREAM_PARSER=y
CONFIG_NET_FLOW_LIMIT=y

#
# Network testing
#
CONFIG_NET_PKTGEN=y
CONFIG_NET_DROP_MONITOR=y
# end of Network testing
# end of Networking options

CONFIG_HAMRADIO=y
...

Signed-off-by: Alexander Popov <alex.popov@linux.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-18 15:31:24 +09:00
Masahiro Yamada
9cc342f6c4 treewide: prefix header search paths with $(srctree)/
Currently, the Kbuild core manipulates header search paths in a crazy
way [1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
the search paths in the srctree. Some Makefiles are already written in
that way, but not all. The goal of this work is to make the notation
consistent, and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5b
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-18 11:49:57 +09:00
Masahiro Yamada
9b9f5948af kconfig: make conf_get_autoconfig_name() static
This is only used in confdata.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-14 23:23:25 +09:00
Jacob Garber
b9d1a8e930 kconfig: use snprintf for formatting pathnames
Valid pathnames will never exceed PATH_MAX, but these file names
are unsanitized and can cause buffer overflow if set incorrectly.
Use snprintf to avoid this. This was flagged during a Coverity scan
of the coreboot project, which also uses kconfig for its build system.

Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-14 23:23:25 +09:00
Masahiro Yamada
4cb726121e kconfig: remove useless NULL pointer check in conf_write_dep()
conf_write_dep() has just one caller:

    conf_write_dep("include/config/auto.conf.cmd");

"name" always points to a valid string.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-14 23:23:16 +09:00
Masahiro Yamada
580c5b3e1b kconfig: make parent directories for the saved .config as needed
With menuconfig / nconfig, users can input any file path from the
"Save" menu, but it fails if the parent directory does not exist.

Why not create the parent directory automatically. I think this is
a user-friendly behavior.

I changed the error messages in menuconfig / nconfig.

"Nonexistent directory" is no longer the most likely reason of the
failure. Perhaps, the user specified the existing directory, or
attempted to write to the location without write permission.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-11 02:16:21 +09:00
Masahiro Yamada
67424f61f8 kconfig: do not write .config if the content is the same
Kconfig updates the .config when it exits even if its content is
exactly the same as before. Since its timestamp becomes newer than
that of other build artifacts, additional processing is invoked,
which is annoying.

- syncconfig is invoked to update include/config/auto.conf, etc.

- kernel/configs.o is recompiled if CONFIG_IKCONFIG is enabled,
  then vmlinux is relinked as well.

If the .config is not changed at all, we do not have to even
touch it. Just bail out showing "No change to .config".

  $ make allmodconfig
  scripts/kconfig/conf  --allmodconfig Kconfig
  #
  # configuration written to .config
  #
  $ make allmodconfig
  scripts/kconfig/conf  --allmodconfig Kconfig
  #
  # No change to .config
  #

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-11 02:15:49 +09:00
Masahiro Yamada
ceb7f3296e kconfig: do not accept a directory for configuration output
Currently, conf_write() can be called with a directory name instead
of a file name. As far as I see, this can happen for menuconfig,
nconfig, gconfig.

If it is given with a directory path, conf_write() kindly appends
getenv("KCONFIG_CONFIG"), but this ends up with hacky dir/basename
handling, and screwed up in corner-cases like "what if KCONFIG_CONFIG
is an absolute path?" as discussed before:

  https://patchwork.kernel.org/patch/9910037/

Since conf_write() is already messed up, I'd say "do not do it".
Please pass a file path all the time. If a directory path is specified
for the configuration output, conf_write() will simply error out.

Now that the tmp file is created in the same directory as the .config,
the previously reported "what if KCONFIG_CONFIG points to a different
file system?" has been solved.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Nicolas Porcel <nicolasporcel06@gmail.com>
2019-05-11 02:14:27 +09:00
Masahiro Yamada
65be755a54 kconfig: remove trailing whitespaces
There are still some trailing whitespaces under scripts/kconfig/tests/,
but they must be kept. Otherwise, "make testconfig" would break.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-05-09 22:37:17 +09:00
Petr Vorel
b63e37bc9e kconfig: Make nconf-cfg.sh executable
Although it's not required for the build *conf-cfg.sh scripts to be
executable (they're run by CONFIG_SHELL), let's be consistent with other
scripts.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-04-09 22:44:57 +09:00
Changbin Du
9c38f1f044 kconfig/[mn]conf: handle backspace (^H) key
Backspace is not working on some terminal emulators which do not send the
key code defined by terminfo. Terminals either send '^H' (8) or '^?' (127).
But currently only '^?' is handled. Let's also handle '^H' for those
terminals.

Signed-off-by: Changbin Du <changbin.du@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-03-29 22:48:01 +09:00
Masahiro Yamada
c71bb9f866 kconfig: remove stale lxdialog/.gitignore
When this .gitignore was added, lxdialog was an independent hostprogs-y.

Now that all objects in lxdialog/ are directly linked to mconf, the
lxdialog is no longer generated.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-03-17 15:47:02 +09:00
Linus Torvalds
5453a3df2a Kconfig updates for v5.1
- rename lexer and parse files
 
  - fix 'Save as' menu of xconfig
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJch99yAAoJED2LAQed4NsGSKkP/R8hkZ5c+0eQIR7q//NC96lO
 EvjRdxKiRQMbkXMDtacCCQtp7maNKuzykobV9iVYTtI9qTT4THXFISBU2BOufvNL
 1Efs8TdY25iR9B979OuAPxns9uTnty7AvYsqjNF7oF1LCkCa/llitHXP/jLypv0p
 f3xKkwMf8IV3esFBjaZjYmP6XihAaABGLIVbtxjqLhHe8ypFSryxCtF1IbwrRrW8
 vfIpatkTQHPMm93Lf9Wjl/z6dYDCQIuiOKkVd+XJBGYOlLm6xk5IOx22xRo8oWU6
 WpKEqTszOeDt3w0bQAZm7L7ewBun39Z5kU4avznDlzNIxJlaUh3rKK61dGfi2K2q
 vO8HhdmW/gbP1NMJSS69lQ9u2hZcfjwZktW5O81ir8fx21WHunoTMOIyIKVnqmio
 5LxhkmdjjWYAaNkjs1Jqi98xXpwxDnnu969z15KHu2aO2USva19jgGJS6gY9z8BW
 Y+InxIhFA44oRSg7GDHes9laJ2s4TlnKQteumSrA0wGL/1mj5bnZsOy1qMWOkyCz
 DNqAyDGJZ/rKGwDYNlaOjYwPZScK91CDvi8pZtDFvS+haqRiYjA1xE0lcaFy0Qz+
 OUHj8FqPH23TPA8nOQ6nGWlapjfNKYlSPuPVA01p2DT8NLuJsLpRE/1SudSMx0Hc
 0duxKFbQt8Cvv1c/G2/q
 =m2QA
 -----END PGP SIGNATURE-----

Merge tag 'kconfig-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kconfig updates from Masahiro Yamada:

 - rename lexer and parse files

 - fix 'Save as' menu of xconfig

* tag 'kconfig-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: fix 'Save As' menu of xconfig
  kconfig: rename zconf.y to parser.y
  kconfig: rename zconf.l to lexer.l
2019-03-13 10:06:28 -07:00
Masahiro Yamada
8741908b3e kconfig: fix 'Save As' menu of xconfig
The 'Save As' menu of xconfig is not working; it always saves the
kernel configuration into the default file irrespective of the file
chosen in the dialog box.

The 'Save' menu always writes into the default file, but it would
make more sense to write into the file previously chosen by 'Load'
or 'Save As'.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2019-03-12 02:50:24 +09:00