From patchwork Tue Dec 17 16:15:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Hebb X-Patchwork-Id: 11298135 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C14206C1 for ; Tue, 17 Dec 2019 16:18:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94CBE2465E for ; Tue, 17 Dec 2019 16:18:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TSOQzXTV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729027AbfLQQPy (ORCPT ); Tue, 17 Dec 2019 11:15:54 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35930 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729000AbfLQQPx (ORCPT ); Tue, 17 Dec 2019 11:15:53 -0500 Received: by mail-pl1-f196.google.com with SMTP id d15so6325564pll.3; Tue, 17 Dec 2019 08:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lq0HcHWIMCgqvJzEZbp3mJOsXRN3LKD9caHPebRuGeU=; b=TSOQzXTVXZSWk9OszZ/sCsCMkt3LTf/VsXDey6HzUEm6QwmwWfOY8B5IWA/ULn2KxT 99V2PSDIGgI5gGw8XY9AnR4lLrS8SfpTf4BHI3j/kDvxFEVAl0HufaUe1yXHP+foIann Ls/PThfLv6bfotH1OL5b2V6wg1LsEFvZacF9OxkLCeYBF/MTlPEnhsfHmIe19v1s7j6D r08r6m0yEJYAYUNE9KqcvCVxcexr7Fc4U3+Vy8k/o8Qo2Egw0YOU+woxUpUzgJL3y+EZ To6Xc0bfIKrUMwJoY2vF2UjnDjxb1EeQI7cGYwqKVJmUh8QSMQY7tySGlb3mK6+vF08I JY/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lq0HcHWIMCgqvJzEZbp3mJOsXRN3LKD9caHPebRuGeU=; b=kcEgDCr/4BJWnx5rfNPVkh0Rtu3Kxh+Qb2J1T/qAAcrvuaT5qQ7mwFQAgsvYzX1Fx/ M8Mh3fty8XPw+YAcYp/TJZSvqiU/YZ8cA+9XH/QnFfoZkI5l1uSLuW/zS1H4/Y3dtm0h Z+CCk4QoTTzK+/6HmwG8oV4q+1fB79crDFXxtER+6P7D8cQGJD9zKJKXrCHeNgc4pBXI k5f7APUs9PyJzrrBZiiHaJDX6f0p6axJR/tNLQbiHXHtwEnOqZ4HbwPAjISrIc6lbk7S djQwDvdZQuQauQUoYstZKgDVk/csHZ9R10HHXqR55GXVEKonfqNei3REmiTQ8fljT60T oPtQ== X-Gm-Message-State: APjAAAWfiYPTq7eG7n6559ZslAB+AyCtjgVSEnPmwh+raD15WIC7zI4I 3o+AZwbwtjsuBcUQw/bYOnBniGFzflzKVg== X-Google-Smtp-Source: APXvYqw79bI0EywMb+ripBKRFTsDY6bo0dkGi+Xw0p9N1XSqBcwqziIpHlugv7M3PHqtqjc20gvGdA== X-Received: by 2002:a17:902:8c96:: with SMTP id t22mr24059076plo.288.1576599351177; Tue, 17 Dec 2019 08:15:51 -0800 (PST) Received: from glados.lan ([2601:647:4c01:6541:fa16:54ff:fed1:1bd6]) by smtp.gmail.com with ESMTPSA id k15sm27704122pfg.37.2019.12.17.08.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 08:15:50 -0800 (PST) From: Thomas Hebb To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Thomas Hebb , Palmer Dabbelt , Paul Walmsley , linux-riscv@lists.infradead.org Subject: [PATCH v2 1/3] kconfig: list all definitions of a symbol in help text Date: Tue, 17 Dec 2019 08:15:43 -0800 Message-Id: <351ce34a887733d966b4822ac9f831e68a5a16f6.1576599202.git.tommyhebb@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 bcdedcc1afd6 ("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] 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 bcdedcc1afd6: 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 --- Changes in v2: - Added explicit U-Boot version in commit message + other rewordings - Made the new "Depends on:" line print actual dependencies instead of visibility to avoid an intra-series regression, and noted that in the commit message. - Get rid of redundant "with prompt" and "without prompt" notes in definition text, but continue to ensure that definitions with prompts are printed before ones without. scripts/kconfig/menu.c | 55 ++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index d9d16469859a..0e54632d2043 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -698,6 +698,21 @@ const char *menu_get_help(struct menu *menu) return ""; } +static void get_def_str(struct gstr *r, struct menu *menu) +{ + str_printf(r, "Defined at %s:%d\n", + menu->file->name, menu->lineno); +} + +static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) +{ + if (!expr_is_yes(expr)) { + str_append(r, prefix); + expr_gstr_print(expr, r); + str_append(r, "\n"); + } +} + static void get_prompt_str(struct gstr *r, struct property *prop, struct list_head *head) { @@ -705,7 +720,9 @@ static void get_prompt_str(struct gstr *r, struct property *prop, struct menu *submenu[8], *menu, *location = NULL; struct jump_key *jump = NULL; - str_printf(r, "Prompt: %s\n", prop->text); + str_printf(r, " Prompt: %s\n", prop->text); + + get_dep_str(r, prop->menu->dep, " Depends on: "); menu = prop->menu->parent; for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { bool accessible = menu_is_visible(menu); @@ -755,18 +772,6 @@ static void get_prompt_str(struct gstr *r, struct property *prop, } } -/* - * get property of type P_SYMBOL - */ -static struct property *get_symbol_prop(struct symbol *sym) -{ - struct property *prop = NULL; - - for_all_properties(sym, prop, P_SYMBOL) - break; - return prop; -} - static void get_symbol_props_str(struct gstr *r, struct symbol *sym, enum prop_type tok, const char *prefix) { @@ -806,17 +811,19 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, } } } - for_all_prompts(sym, prop) - get_prompt_str(r, prop, head); - - prop = get_symbol_prop(sym); - if (prop) { - str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, - prop->menu->lineno); - if (!expr_is_yes(prop->visible.expr)) { - str_append(r, " Depends on: "); - expr_gstr_print(prop->visible.expr, r); - str_append(r, "\n"); + + /* Print the definitions with prompts before the ones without */ + for_all_properties(sym, prop, P_SYMBOL) { + if (prop->menu->prompt) { + get_def_str(r, prop->menu); + get_prompt_str(r, prop->menu->prompt, head); + } + } + + for_all_properties(sym, prop, P_SYMBOL) { + if (!prop->menu->prompt) { + get_def_str(r, prop->menu); + get_dep_str(r, prop->menu->dep, " Depends on: "); } } From patchwork Tue Dec 17 16:15:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Hebb X-Patchwork-Id: 11298143 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F4FC14B7 for ; Tue, 17 Dec 2019 16:18:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 70AD821835 for ; Tue, 17 Dec 2019 16:18:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CVtreZDP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728706AbfLQQST (ORCPT ); Tue, 17 Dec 2019 11:18:19 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46207 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729015AbfLQQPx (ORCPT ); Tue, 17 Dec 2019 11:15:53 -0500 Received: by mail-pl1-f195.google.com with SMTP id y8so321943pll.13; Tue, 17 Dec 2019 08:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nvfz0A2ZvP4AK3QEhPIGVEQE0gFv3qk/GmdZliKFO6A=; b=CVtreZDPZZJiZSWzv8lwSJIgatTJTjo7lKs3WeWqJa7HRYn75GbB0+e04gsd/7Rd7m NyLNaOBu6kqTuS7HMcfVvJgwf5T6x7kMoG6MbuB13TgTXimfK8HJvoj5AAsBbkQGbWfa cuRNiJt6SycRj6jdoT7z10cYulJhGPcWM57rdBiG7SE3B5z3DjoDbKhoKFP4bdCeYgil mOCXZDE5Qa074L8aCc/n77oIWXJ7xIN0NB/sZsZW+GnoQAAxyE+73dG2v6DnwapwADHt eTZYmK5AcGU5fSu28uan+MylLLsAkuaGV0GR/bfxQc3p2T9LVzbFMxSYXrQ1Lm/1pFyJ nf7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nvfz0A2ZvP4AK3QEhPIGVEQE0gFv3qk/GmdZliKFO6A=; b=fo0UhmGjXlrdctvubIBHG9vHiB0YAAHAL1Zg8JoLQfrQ7W32GGlnI/1ClgUQQ6zHeN iHOetSu2MoRjdV7PX+i5fQvPho0cgefNF6VKZcxkTv0v7hrDwIUtzQzmUT8PtQtu11D7 8W/NeiWI0xmy+1hx9HrcVQMKtpODdb1DhmAAyM9jbBIV+tiEjcaKb/P+MWHCqvkGqUrB dxz6q08Rbalk/9Cq/11g3ntnQUq/6K3BpY7GkJFEkKn6yHkrUy1Xwx2IrOmYBd+iaSOG Rs6PdCEhtzX7B8hSahqzmR1TbklZdACMPzz/6TOhDU5mAsJfa2Yv1/sczcz8ZHTREKrd Utdw== X-Gm-Message-State: APjAAAWmRG0ikS7MwqVcQOeYI+0OWUScyLWB/upN9sbLkVP/Lkv9JKsl u7H4HLo++tzXqV+c+p731Zbt8GlITOMVWA== X-Google-Smtp-Source: APXvYqyYCRDx0TFyqVYKOZHhB55hjFC3rr5CadlhQrDgXjepxqJokh9IxLlFXEIaNvpXL7ejBxzdgg== X-Received: by 2002:a17:90a:d801:: with SMTP id a1mr7133236pjv.34.1576599352484; Tue, 17 Dec 2019 08:15:52 -0800 (PST) Received: from glados.lan ([2601:647:4c01:6541:fa16:54ff:fed1:1bd6]) by smtp.gmail.com with ESMTPSA id k15sm27704122pfg.37.2019.12.17.08.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 08:15:52 -0800 (PST) From: Thomas Hebb To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Thomas Hebb Subject: [PATCH v2 2/3] kconfig: distinguish between dependencies and visibility in help text Date: Tue, 17 Dec 2019 08:15:44 -0800 Message-Id: <0f377f484587480701ba22c4b66ea0e7d83db870.1576599202.git.tommyhebb@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 bcdedcc1afd6 ("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 bcdedcc1afd, 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 --- Changes in v2: - Fixed checkpatch issues scripts/kconfig/expr.c | 3 +-- scripts/kconfig/expr.h | 1 + scripts/kconfig/menu.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 9f1de58e9f0c..81ebf8108ca7 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -13,7 +13,6 @@ #define DEBUG_EXPR 0 -static int expr_eq(struct expr *e1, struct expr *e2); static struct expr *expr_eliminate_yn(struct expr *e); struct expr *expr_alloc_symbol(struct symbol *sym) @@ -250,7 +249,7 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) * equals some operand in the other (operands do not need to appear in the same * order), recursively. */ -static int expr_eq(struct expr *e1, struct expr *e2) +int expr_eq(struct expr *e1, struct expr *e2) { int res, old_count; diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 017843c9a4f4..d0f17bc9c4ef 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -301,6 +301,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); struct expr *expr_copy(const struct expr *org); void expr_free(struct expr *e); void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); +int expr_eq(struct expr *e1, struct expr *e2); tristate expr_calc_value(struct expr *e); struct expr *expr_trans_bool(struct expr *e); struct expr *expr_eliminate_dups(struct expr *e); diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 0e54632d2043..dcf7f32f0bba 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -723,6 +723,17 @@ static void get_prompt_str(struct gstr *r, struct property *prop, str_printf(r, " Prompt: %s\n", prop->text); get_dep_str(r, prop->menu->dep, " Depends on: "); + /* + * Most prompts in Linux have visibility that exactly matches their + * dependencies. For these, we print only the dependencies to improve + * readability. However, prompts with inline "if" expressions and + * prompts with a parent that has a "visible if" expression have + * differing dependencies and visibility. In these rare cases, we + * print both. + */ + if (!expr_eq(prop->menu->dep, prop->visible.expr)) + get_dep_str(r, prop->visible.expr, " Visible if: "); + menu = prop->menu->parent; for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { bool accessible = menu_is_visible(menu); From patchwork Tue Dec 17 16:15:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Hebb X-Patchwork-Id: 11298129 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F23414B7 for ; Tue, 17 Dec 2019 16:18:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4CD3921582 for ; Tue, 17 Dec 2019 16:18:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IRavlYuE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729004AbfLQQRt (ORCPT ); Tue, 17 Dec 2019 11:17:49 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45574 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729042AbfLQQPz (ORCPT ); Tue, 17 Dec 2019 11:15:55 -0500 Received: by mail-pl1-f196.google.com with SMTP id b22so3379067pls.12; Tue, 17 Dec 2019 08:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a49dwJ8GX08Y5sJ0dDPnBsYrZ13FPO16JKZiTZ6hkms=; b=IRavlYuEjd+u06gybsJolSbXoqfJgBxTJ+oPzmUlxUVgFNhE1kC+HLi+K+xYGPZMKz PA+CtlIqLl0OswigyyBhLzStx033bCk09W0InIpPhuJ52JCEIfaJ6zpja4kd3IJOAy7H 26O07AmMzQjNpkEKkc5y/BMPopy1Romq0iipCWmCzJkPPIDfh6rOW2aXA3m+/QzVUmaP nynn8SdAKxsqI90PZacNfQsqC+AuOYfMnXRnR74sw7GFJLpVIxMgRVwtiU6f8VNdEQYf AHKke3XcM4emb5M7VMTtfBSV6pO2dHWPFhKytYxqcG2iIOWR1LvybRfCIJ7XGvi7CEQ8 HD1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a49dwJ8GX08Y5sJ0dDPnBsYrZ13FPO16JKZiTZ6hkms=; b=OCKowUsFwJv51uYPMnaiZfnmRjd1XmGgdAI9ytSMNiqB9fCiryUL5kx6fML2CUk87B 1y9QL0U0ciHTF/86guSpVxsHcQeOpYPYlGXWfYhSIr6IyMdQr6/A/kmLy52ywMCPZGTO ql02GsxPzEcc4UYrm0vPedib3j6Y8GnH868BI7cTzUM7TH0Mks+ey6uxnYgfCP53hXYW jdkbCdW1q2rDSkEfZtIqwxlsE0YRCEhhs6YVE9QI1685z5RugqIgZG+XZcnaMYyAoRAn Tso55irFSkcfqx6OCZbxqqs5GU+apVNcD+Dpv6l/MklG/17ELDibHm+wSDqHwWzJgynj nSmg== X-Gm-Message-State: APjAAAVTx/MfGVOAdFd8qsO3BdtBFVE2bcK7/XL1QCRk+itW+0iJSyLR jSVznLjV1Gt//R+ismRsrfJEWoNNgfX1yw== X-Google-Smtp-Source: APXvYqzGmI37M9DuaeknFkqQ7u6d7iZv/EDR6mDyLEphhXkh/Z7w9YYwCliKMgFdS7tdbRgTZ9Cs+Q== X-Received: by 2002:a17:902:aa08:: with SMTP id be8mr23248826plb.255.1576599353911; Tue, 17 Dec 2019 08:15:53 -0800 (PST) Received: from glados.lan ([2601:647:4c01:6541:fa16:54ff:fed1:1bd6]) by smtp.gmail.com with ESMTPSA id k15sm27704122pfg.37.2019.12.17.08.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 08:15:53 -0800 (PST) From: Thomas Hebb To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Thomas Hebb Subject: [PATCH v2 3/3] kconfig: fix nesting of symbol help text Date: Tue, 17 Dec 2019 08:15:45 -0800 Message-Id: <51c902d29bf8748c411f78405f9638109a5cf4c6.1576599202.git.tommyhebb@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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] && 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] && Signed-off-by: Thomas Hebb --- Changes in v2: None scripts/kconfig/menu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index dcf7f32f0bba..ef36d1cf2a76 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -838,18 +838,18 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, } } - get_symbol_props_str(r, sym, P_SELECT, " Selects: "); + get_symbol_props_str(r, sym, P_SELECT, "Selects: "); if (sym->rev_dep.expr) { - expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]:\n"); - expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]:\n"); - expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]:\n"); + expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, "Selected by [y]:\n"); + expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, "Selected by [m]:\n"); + expr_gstr_print_revdep(sym->rev_dep.expr, r, no, "Selected by [n]:\n"); } - get_symbol_props_str(r, sym, P_IMPLY, " Implies: "); + get_symbol_props_str(r, sym, P_IMPLY, "Implies: "); if (sym->implied.expr) { - expr_gstr_print_revdep(sym->implied.expr, r, yes, " Implied by [y]:\n"); - expr_gstr_print_revdep(sym->implied.expr, r, mod, " Implied by [m]:\n"); - expr_gstr_print_revdep(sym->implied.expr, r, no, " Implied by [n]:\n"); + expr_gstr_print_revdep(sym->implied.expr, r, yes, "Implied by [y]:\n"); + expr_gstr_print_revdep(sym->implied.expr, r, mod, "Implied by [m]:\n"); + expr_gstr_print_revdep(sym->implied.expr, r, no, "Implied by [n]:\n"); } str_append(r, "\n\n");