mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox
@ 2020-04-28  7:37 Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 02/11] scripts: kconfig-lint.py: extend for undefined symbol detection Ahmad Fatoum
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

This kconfig linter can do some useful analysis to find problems
in our Kconfig files. Import it into barebox source tree with the
changes necessary to be usable.

The results of running it should be taken with a grain of salt and
verified with grep.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 scripts/kconfig-lint.py | 306 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 306 insertions(+)
 create mode 100755 scripts/kconfig-lint.py

diff --git a/scripts/kconfig-lint.py b/scripts/kconfig-lint.py
new file mode 100755
index 000000000000..308c82dfd8de
--- /dev/null
+++ b/scripts/kconfig-lint.py
@@ -0,0 +1,306 @@
+#!/usr/bin/env python3
+
+# Copyright (c) 2019 Nordic Semiconductor ASA
+# SPDX-License-Identifier: Apache-2.0
+
+"""
+Linter for the Zephyr Kconfig files. Pass --help to see
+available checks. By default, all checks are enabled.
+
+Some of the checks rely on heuristics and can get tripped up
+by things like preprocessor magic, so manual checking is
+still needed. 'git grep' is handy.
+"""
+
+import argparse
+import os
+import re
+import shlex
+import subprocess
+import sys
+import tempfile
+
+TOP_DIR = os.path.join(os.path.dirname(__file__), "..")
+
+import kconfiglib
+
+
+def main():
+    init_kconfig()
+
+    args = parse_args()
+    if args.checks:
+        checks = args.checks
+    else:
+        # Run all checks if no checks were specified
+        checks = (check_always_n,
+                  check_unused,
+                  check_pointless_menuconfigs,
+                  check_missing_config_prefix)
+
+    first = True
+    for check in checks:
+        if not first:
+            print()
+        first = False
+        check()
+
+
+def parse_args():
+    # args.checks is set to a list of check functions to run
+
+    parser = argparse.ArgumentParser(
+        formatter_class=argparse.RawTextHelpFormatter,
+        description=__doc__)
+
+    parser.add_argument(
+        "-n", "--check-always-n",
+        action="append_const", dest="checks", const=check_always_n,
+        help="""\
+List symbols that can never be anything but n/empty. These
+are detected as symbols with no prompt or defaults that
+aren't selected or implied.
+""")
+
+    parser.add_argument(
+        "-u", "--check-unused",
+        action="append_const", dest="checks", const=check_unused,
+        help="""\
+List symbols that might be unused.
+
+Heuristic:
+
+ - Isn't referenced in Kconfig
+ - Isn't referenced as CONFIG_<NAME> outside Kconfig
+   (besides possibly as CONFIG_<NAME>=<VALUE>)
+ - Isn't selecting/implying other symbols
+ - Isn't a choice symbol
+
+C preprocessor magic can trip up this check.""")
+
+    parser.add_argument(
+        "-m", "--check-pointless-menuconfigs",
+        action="append_const", dest="checks", const=check_pointless_menuconfigs,
+        help="""\
+List symbols defined with 'menuconfig' where the menu is
+empty due to the symbol not being followed by stuff that
+depends on it""")
+
+    parser.add_argument(
+        "-p", "--check-missing-config-prefix",
+        action="append_const", dest="checks", const=check_missing_config_prefix,
+        help="""\
+Look for references like
+
+    #if MACRO
+    #if(n)def MACRO
+    defined(MACRO)
+    IS_ENABLED(MACRO)
+
+where MACRO is the name of a defined Kconfig symbol but
+doesn't have a CONFIG_ prefix. Could be a typo.
+
+Macros that are #define'd somewhere are not flagged.""")
+
+    return parser.parse_args()
+
+
+def check_always_n():
+    print_header("Symbols that can't be anything but n/empty")
+    for sym in kconf.unique_defined_syms:
+        if not has_prompt(sym) and not is_selected_or_implied(sym) and \
+           not has_defaults(sym):
+            print(name_and_locs(sym))
+
+
+def check_unused():
+    print_header("Symbols that look unused")
+    referenced = referenced_sym_names()
+    for sym in kconf.unique_defined_syms:
+        if not is_selecting_or_implying(sym) and not sym.choice and \
+           sym.name not in referenced:
+            print(name_and_locs(sym))
+
+
+def check_pointless_menuconfigs():
+    print_header("menuconfig symbols with empty menus")
+    for node in kconf.node_iter():
+        if node.is_menuconfig and not node.list and \
+           isinstance(node.item, kconfiglib.Symbol):
+            print("{0.item.name:40} {0.filename}:{0.linenr}".format(node))
+
+
+def check_missing_config_prefix():
+    print_header("Symbol references that might be missing a CONFIG_ prefix")
+
+    # Paths to modules
+    modpaths = [TOP_DIR]
+
+    # Gather #define'd macros that might overlap with symbol names, so that
+    # they don't trigger false positives
+    defined = set()
+    for modpath in modpaths:
+        regex = r"#\s*define\s+([A-Z0-9_]+)\b"
+        defines = run(("git", "grep", "--extended-regexp", regex),
+                      cwd=modpath, check=False)
+        # Could pass --only-matching to git grep as well, but it was added
+        # pretty recently (2018)
+        defined.update(re.findall(regex, defines))
+
+    # Filter out symbols whose names are #define'd too. Preserve definition
+    # order to make the output consistent.
+    syms = [sym for sym in kconf.unique_defined_syms
+            if sym.name not in defined]
+
+    # grep for symbol references in #ifdef/defined() that are missing a CONFIG_
+    # prefix. Work around an "argument list too long" error from 'git grep' by
+    # checking symbols in batches.
+    for batch in split_list(syms, 200):
+        # grep for '#if((n)def) <symbol>', 'defined(<symbol>', and
+        # 'IS_ENABLED(<symbol>', with a missing CONFIG_ prefix
+        regex = r"(?:#\s*if(?:n?def)\s+|\bdefined\s*\(\s*|IS_ENABLED\(\s*)(?:" + \
+                "|".join(sym.name for sym in batch) + r")\b"
+        cmd = ("git", "grep", "--line-number", "-I", "--perl-regexp", regex)
+
+        for modpath in modpaths:
+            print(run(cmd, cwd=modpath, check=False), end="")
+
+
+def split_list(lst, batch_size):
+    # check_missing_config_prefix() helper generator that splits a list into
+    # equal-sized batches (possibly with a shorter batch at the end)
+
+    for i in range(0, len(lst), batch_size):
+        yield lst[i:i + batch_size]
+
+
+def print_header(s):
+    print(s + "\n" + len(s)*"=")
+
+
+def init_kconfig():
+    global kconf
+
+    os.environ.update(
+        srctree=TOP_DIR,
+        KCONFIG_DOC_MODE="1",
+        ARCH_DIR="arch",
+        SRCARCH="*")
+
+    kconf = kconfiglib.Kconfig(suppress_traceback=True)
+
+
+def referenced_sym_names():
+    # Returns the names of all symbols referenced inside and outside the
+    # Kconfig files (that we can detect), without any "CONFIG_" prefix
+
+    return referenced_in_kconfig() | referenced_outside_kconfig()
+
+
+def referenced_in_kconfig():
+    # Returns the names of all symbols referenced inside the Kconfig files
+
+    return {ref.name
+            for node in kconf.node_iter()
+                for ref in node.referenced
+                    if isinstance(ref, kconfiglib.Symbol)}
+
+
+def referenced_outside_kconfig():
+    # Returns the names of all symbols referenced outside the Kconfig files
+
+    regex = r"\bCONFIG_[A-Z0-9_]+\b"
+
+    res = set()
+
+    # 'git grep' all modules
+    for modpath in [TOP_DIR]:
+        for line in run(("git", "grep", "-h", "-I", "--extended-regexp", regex),
+                        cwd=modpath).splitlines():
+            # Don't record lines starting with "CONFIG_FOO=" or "# CONFIG_FOO="
+            # as references, so that symbols that are only assigned in .config
+            # files are not included
+            if re.match(r"[\s#]*CONFIG_[A-Z0-9_]+=.*", line):
+                continue
+
+            # Could pass --only-matching to git grep as well, but it was added
+            # pretty recently (2018)
+            for match in re.findall(regex, line):
+                res.add(match[7:])  # Strip "CONFIG_"
+
+    return res
+
+
+def has_prompt(sym):
+    return any(node.prompt for node in sym.nodes)
+
+
+def is_selected_or_implied(sym):
+    return sym.rev_dep is not kconf.n or sym.weak_rev_dep is not kconf.n
+
+
+def has_defaults(sym):
+    return bool(sym.defaults)
+
+
+def is_selecting_or_implying(sym):
+    return sym.selects or sym.implies
+
+
+def name_and_locs(sym):
+    # Returns a string with the name and definition location(s) for 'sym'
+
+    return "{:40} {}".format(
+        sym.name,
+        ", ".join("{0.filename}:{0.linenr}".format(node) for node in sym.nodes))
+
+
+def run(cmd, cwd=TOP_DIR, check=True):
+    # Runs 'cmd' with subprocess, returning the decoded stdout output. 'cwd' is
+    # the working directory. It defaults to the top-level Zephyr directory.
+    # Exits with an error if the command exits with a non-zero return code if
+    # 'check' is True.
+
+    cmd_s = " ".join(shlex.quote(word) for word in cmd)
+
+    try:
+        process = subprocess.Popen(
+            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
+    except OSError as e:
+        err("Failed to run '{}': {}".format(cmd_s, e))
+
+    stdout, stderr = process.communicate()
+    # errors="ignore" temporarily works around
+    # https://github.com/zephyrproject-rtos/esp-idf/pull/2
+    stdout = stdout.decode("utf-8", errors="ignore")
+    stderr = stderr.decode("utf-8")
+    if check and process.returncode:
+        err("""\
+'{}' exited with status {}.
+
+===stdout===
+{}
+===stderr===
+{}""".format(cmd_s, process.returncode, stdout, stderr))
+
+    if stderr:
+        warn("'{}' wrote to stderr:\n{}".format(cmd_s, stderr))
+
+    return stdout
+
+
+def err(msg):
+    sys.exit(executable() + "error: " + msg)
+
+
+def warn(msg):
+    print(executable() + "warning: " + msg, file=sys.stderr)
+
+
+def executable():
+    cmd = sys.argv[0]  # Empty string if missing
+    return cmd + ": " if cmd else ""
+
+
+if __name__ == "__main__":
+    main()
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 02/11] scripts: kconfig-lint.py: extend for undefined symbol detection
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 03/11] commands: fix misindented help text Ahmad Fatoum
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

Extend the script by some code from the official list_undefined.py example[1]
to further detect symbols we are using, but haven't defined anywhere.

[1]: https://github.com/ulfalizer/Kconfiglib/blob/35a60b7/examples/list_undefined.py

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 scripts/kconfig-lint.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig-lint.py b/scripts/kconfig-lint.py
index 308c82dfd8de..a154e9cccacc 100755
--- a/scripts/kconfig-lint.py
+++ b/scripts/kconfig-lint.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
 # Copyright (c) 2019 Nordic Semiconductor ASA
-# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: Apache-2.0 AND ISC
 
 """
 Linter for the Zephyr Kconfig files. Pass --help to see
@@ -35,6 +35,7 @@ def main():
         # Run all checks if no checks were specified
         checks = (check_always_n,
                   check_unused,
+                  check_undefined,
                   check_pointless_menuconfigs,
                   check_missing_config_prefix)
 
@@ -78,6 +79,13 @@ Heuristic:
 
 C preprocessor magic can trip up this check.""")
 
+    parser.add_argument(
+        "-U", "--check-undefined",
+        action="append_const", dest="checks", const=check_undefined,
+        help="""\
+List symbols that are used in a Kconfig file but are undefined
+""")
+
     parser.add_argument(
         "-m", "--check-pointless-menuconfigs",
         action="append_const", dest="checks", const=check_pointless_menuconfigs,
@@ -121,6 +129,21 @@ def check_unused():
            sym.name not in referenced:
             print(name_and_locs(sym))
 
+def check_undefined():
+    print_header("Symbols that are used, but undefined")
+    for name, sym in kconf.syms.items():
+        if not sym.nodes:
+            # Undefined symbol. We skip some of the uninteresting ones.
+
+            # Due to how Kconfig works, integer literals show up as symbols
+            # (from e.g. 'default 1'). Skip those.
+            try:
+                int(name, 0)
+                continue
+            except ValueError:
+                # Interesting undefined symbol
+                print(name)
+
 
 def check_pointless_menuconfigs():
     print_header("menuconfig symbols with empty menus")
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 03/11] commands: fix misindented help text
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 02/11] scripts: kconfig-lint.py: extend for undefined symbol detection Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 04/11] ARM: at91: remove undefined Kconfig symbol Ahmad Fatoum
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

Kconfiglib used by scripts/kconfig-lint.py chokes on this
misindentation. Fix it

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 commands/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/Kconfig b/commands/Kconfig
index a0c28289834b..77637f916c16 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -809,7 +809,7 @@ config CMD_FILETYPE
 	select FILETYPE
 	prompt "filetype"
 	help
-Detect file type
+	  Detect file type
 
 	  Usage: filetype [-vsl] FILE
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 04/11] ARM: at91: remove undefined Kconfig symbol
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 02/11] scripts: kconfig-lint.py: extend for undefined symbol detection Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 03/11] commands: fix misindented help text Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 05/11] ARM: socfpga: remove duplicate ARCH_TEXT_BASE Ahmad Fatoum
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

Symbol used to exist, but was replaced by DEBUG_AT91_UART_BASE in
common/Kconfig. Remove last trace of it.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/mach-at91/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 77b3e9db64c8..121cca2acf11 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -142,7 +142,6 @@ config SOC_AT91RM9200
 	bool
 	select CPU_ARM920T
 	select HAS_AT91_ETHER
-	select HAVE_AT91_DBGU0
 	select HAVE_AT91_USB_CLK
 	select PINCTRL_AT91
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 05/11] ARM: socfpga: remove duplicate ARCH_TEXT_BASE
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 04/11] ARM: at91: remove undefined Kconfig symbol Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 06/11] crypto: drop select on non-existing Kconfig options Ahmad Fatoum
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

We already have one ARCH_TEXT_BASE in the file, which sets a value of
zero.  MACH_SOCFPGA_CYCLONE5 and MACH_SOCFPGA_ARRIA10 aren't defined
anywhere and are listed in no defconfigs, thus drop the duplicate
option.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/mach-socfpga/Kconfig | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index 3d8fc8ba42a9..2da875cef0c3 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -8,11 +8,6 @@ config ARCH_SOCFPGA_XLOAD
 	bool
 	prompt "Build preloader image"
 
-config ARCH_TEXT_BASE
-	hex
-	default 0x00100000 if MACH_SOCFPGA_CYCLONE5
-	default 0xffe00000 if MACH_SOCFPGA_ARRIA10
-
 comment "Altera SoCFPGA System-on-Chip"
 
 config ARCH_SOCFPGA_CYCLONE5
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 06/11] crypto: drop select on non-existing Kconfig options
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 05/11] ARM: socfpga: remove duplicate ARCH_TEXT_BASE Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 07/11] lib: bch: define referenced but undefined Kconfig option Ahmad Fatoum
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

We define neither CRYPTO_BLKCIPHER nor CRYPTO_DES in barebox. Drop the
select on them.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/crypto/imx-scc/Kconfig | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/crypto/imx-scc/Kconfig b/drivers/crypto/imx-scc/Kconfig
index 531304f43218..bc4676a10af7 100644
--- a/drivers/crypto/imx-scc/Kconfig
+++ b/drivers/crypto/imx-scc/Kconfig
@@ -1,8 +1,6 @@
 config CRYPTO_DEV_MXC_SCC
 	tristate "Support for Freescale Security Controller (SCC)"
 	depends on ARCH_IMX25 && OFTREE
-	select CRYPTO_BLKCIPHER
-	select CRYPTO_DES
 	help
 	  This option enables support for the Security Controller (SCC)
 	  found in Freescale i.MX25 chips.
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 07/11] lib: bch: define referenced but undefined Kconfig option
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 06/11] crypto: drop select on non-existing Kconfig options Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 08/11] MIPS: ath79: define used, but undefined, " Ahmad Fatoum
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

BCH_CONST_PARAMS is used, but undefined. Defining it would change
MACH_MIOA701 behavior, so define it but remove the select

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/mach-pxa/Kconfig | 1 -
 lib/Kconfig               | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 06ad1885a622..fd9084f83ea1 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -72,7 +72,6 @@ config MACH_MAINSTONE
 	  Say Y here if you are using a Mainstone board
 config MACH_MIOA701
 	bool "Mitac Mio A701"
-	select BCH_CONST_PARAMS
 	select PWM
 	select POLLER
 	help
diff --git a/lib/Kconfig b/lib/Kconfig
index 9a80780186a5..e4b347375971 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -68,6 +68,9 @@ config PROCESS_ESCAPE_SEQUENCE
 
 source "lib/lzo/Kconfig"
 
+config BCH_CONST_PARAMS
+	bool
+
 config BCH
 	bool
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 08/11] MIPS: ath79: define used, but undefined, Kconfig option
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (5 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 07/11] lib: bch: define referenced but undefined Kconfig option Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 09/11] phy: freescale: fix typo in Kconfig default Ahmad Fatoum
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

SOC_QCA_QCA4531 is selected, but defined no where. fix this.

Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/mips/mach-ath79/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/mach-ath79/Kconfig b/arch/mips/mach-ath79/Kconfig
index 97eea6a2a245..9dab5fc92aac 100644
--- a/arch/mips/mach-ath79/Kconfig
+++ b/arch/mips/mach-ath79/Kconfig
@@ -6,6 +6,9 @@ config SOC_QCA_AR9331
 config SOC_QCA_AR9344
 	bool
 
+config SOC_QCA_QCA4531
+	bool
+
 if DEBUG_LL
 choice
 	prompt "DEBUG_LL driver"
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 09/11] phy: freescale: fix typo in Kconfig default
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (6 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 08/11] MIPS: ath79: define used, but undefined, " Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 10/11] reset: " Ahmad Fatoum
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

We don't have a config SOC_IMX8MQ, but have an ARCH_IMX8MQ. Fix this.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/phy/freescale/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig
index 8e56dd7e7938..eb4a75558fa6 100644
--- a/drivers/phy/freescale/Kconfig
+++ b/drivers/phy/freescale/Kconfig
@@ -1,4 +1,4 @@
 config PHY_FSL_IMX8MQ_USB
 	bool "Freescale i.MX8M USB3 PHY"
-	default SOC_IMX8MQ
+	default ARCH_IMX8MQ
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 10/11] reset: fix typo in Kconfig default
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (7 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 09/11] phy: freescale: fix typo in Kconfig default Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-28  7:37 ` [PATCH 11/11] treewide: Kconfig: remove some unused symbols Ahmad Fatoum
  2020-04-29  6:43 ` [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Sascha Hauer
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

We don't have a config SOC_IMX7D, but have an ARCH_IMX7. Fix this.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/reset/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 048f2081f82a..9befc5e55f32 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -16,7 +16,7 @@ if RESET_CONTROLLER
 
 config RESET_IMX7
 	bool "i.MX7 Reset Driver"
-	default SOC_IMX7D
+	default ARCH_IMX7
 	select MFD_SYSCON
 	help
 	  This enables the reset controller driver for i.MX7 SoCs.
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 11/11] treewide: Kconfig: remove some unused symbols
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (8 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 10/11] reset: " Ahmad Fatoum
@ 2020-04-28  7:37 ` Ahmad Fatoum
  2020-04-29  6:43 ` [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Sascha Hauer
  10 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2020-04-28  7:37 UTC (permalink / raw)
  To: barebox

All these symbols are defined, but unused anywhere in the barebox tree.
Remove them.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/mach-at91/Kconfig    |  3 ---
 arch/arm/mach-omap/Kconfig    |  3 ---
 arch/arm/mach-tegra/Kconfig   |  3 ---
 common/Kconfig                |  3 ---
 drivers/pinctrl/Kconfig       |  2 --
 drivers/pinctrl/mvebu/Kconfig | 15 ---------------
 6 files changed, 29 deletions(-)
 delete mode 100644 drivers/pinctrl/mvebu/Kconfig

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 121cca2acf11..54fa9b8aa28c 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -6,9 +6,6 @@ config HAVE_AT91_UTMI
 config HAVE_AT91_USB_CLK
 	bool
 
-config HAVE_AT91_PIO4
-	bool
-
 config COMMON_CLK_AT91
 	bool
 	select COMMON_CLK
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index e9228809f067..220b6351679c 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -19,9 +19,6 @@
 menu "OMAP Features"
 	depends on ARCH_OMAP
 
-config MACH_OMAP
-	bool
-
 config ARCH_OMAP3
 	bool
 	select CPU_V7
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 160732fbefdb..f144d346b4c5 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -4,9 +4,6 @@ config ARCH_TEXT_BASE
 	hex
 	default 0x0
 
-config BOARDINFO
-	default ""
-
 # ---------------------------------------------------------
 
 config ARCH_TEGRA_2x_SOC
diff --git a/common/Kconfig b/common/Kconfig
index 893bdeaffc9c..97f609d84b0f 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -144,9 +144,6 @@ config LOCALVERSION_AUTO
 
 	  which is done within the script "scripts/setlocalversion".)
 
-config BOARDINFO
-	string
-
 config BANNER
 	bool "display banner"
 	default y
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index fd75ea6a4f43..4f05f5d49458 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -93,8 +93,6 @@ config PINCTRL_TEGRA_XUSB
 	  The pinmux controller found on the Tegra 124 line of SoCs used for
 	  the SerDes lanes.
 
-source "drivers/pinctrl/mvebu/Kconfig"
-
 config PINCTRL_VF610
 	bool
 	default y if ARCH_VF610
diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
deleted file mode 100644
index af20cad43915..000000000000
--- a/drivers/pinctrl/mvebu/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@
-config PINCTRL_ARMADA_370
-	default y if ARCH_ARMADA_370
-	bool
-
-config PINCTRL_ARMADA_XP
-	bool
-	default y if ARCH_ARMADA_XP
-
-config PINCTRL_DOVE
-	bool
-	default y if ARCH_DOVE
-
-config PINCTRL_KIRKWOOD
-	bool
-	default y if ARCH_KIRKWOOD
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox
  2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
                   ` (9 preceding siblings ...)
  2020-04-28  7:37 ` [PATCH 11/11] treewide: Kconfig: remove some unused symbols Ahmad Fatoum
@ 2020-04-29  6:43 ` Sascha Hauer
  10 siblings, 0 replies; 12+ messages in thread
From: Sascha Hauer @ 2020-04-29  6:43 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Apr 28, 2020 at 09:37:20AM +0200, Ahmad Fatoum wrote:
> This kconfig linter can do some useful analysis to find problems
> in our Kconfig files. Import it into barebox source tree with the
> changes necessary to be usable.
> 
> The results of running it should be taken with a grain of salt and
> verified with grep.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  scripts/kconfig-lint.py | 306 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 306 insertions(+)
>  create mode 100755 scripts/kconfig-lint.py

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-04-29  6:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  7:37 [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 02/11] scripts: kconfig-lint.py: extend for undefined symbol detection Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 03/11] commands: fix misindented help text Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 04/11] ARM: at91: remove undefined Kconfig symbol Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 05/11] ARM: socfpga: remove duplicate ARCH_TEXT_BASE Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 06/11] crypto: drop select on non-existing Kconfig options Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 07/11] lib: bch: define referenced but undefined Kconfig option Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 08/11] MIPS: ath79: define used, but undefined, " Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 09/11] phy: freescale: fix typo in Kconfig default Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 10/11] reset: " Ahmad Fatoum
2020-04-28  7:37 ` [PATCH 11/11] treewide: Kconfig: remove some unused symbols Ahmad Fatoum
2020-04-29  6:43 ` [PATCH 01/11] scripts: import Zephyr scripts/kconfig/lint.py into barebox Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox