linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Lobakin <alobakin@pm.me>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Alexander Lobakin <alobakin@pm.me>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RESEND 2/2] kconfig: mention submenu type in comment blocks in .config
Date: Fri, 19 Mar 2021 19:37:14 +0000	[thread overview]
Message-ID: <20210319193705.267922-3-alobakin@pm.me> (raw)
In-Reply-To: <20210319193705.267922-1-alobakin@pm.me>

To have a better understanding of the dotconfig blocks, mention if
a particular block-commented section is a choice or a menu{,config}.

Before:

x
x Timers subsystem
x
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y

x
x Timer tick handling
x
x CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
x end of Timer tick handling

x CONFIG_NO_HZ is not set
CONFIG_HIGH_RES_TIMERS=y
x end of Timers subsystem

After:

x
x Timers subsystem menu
x
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y

x
x Timer tick handling choice
x
x CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
x end of Timer tick handling choice

x CONFIG_NO_HZ is not set
CONFIG_HIGH_RES_TIMERS=y
x end of Timers subsystem menu

Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 scripts/kconfig/confdata.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index e4f0a21fd469..3f50d8b82a54 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -822,6 +822,17 @@ int conf_write_defconfig(const char *filename)
 	return 0;
 }

+static const char *menu_type_string(const struct menu *menu)
+{
+	if (menu->sym && (menu->sym->flags & SYMBOL_CHOICE))
+		return " choice";
+
+	if (menu->prompt && menu->prompt->type == P_MENU)
+		return " menu";
+
+	return "";
+}
+
 int conf_write(const char *name)
 {
 	FILE *out;
@@ -876,8 +887,8 @@ int conf_write(const char *name)
 			str = menu_get_prompt(menu);
 			fprintf(out, "\n"
 				     "#\n"
-				     "# %s\n"
-				     "#\n", str);
+				     "# %s%s\n"
+				     "#\n", str, menu_type_string(menu));
 			need_newline = false;
 		}

@@ -905,7 +916,8 @@ int conf_write(const char *name)
 			     (menu->prompt && menu->prompt->type == P_MENU)) &&
 			    menu_is_visible(menu) && menu != &rootmenu) {
 				str = menu_get_prompt(menu);
-				fprintf(out, "# end of %s\n", str);
+				fprintf(out, "# end of %s%s\n", str,
+					menu_type_string(menu));
 				need_newline = true;
 			}
 			if (menu->next) {
--
2.31.0



      parent reply	other threads:[~2021-03-19 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 19:37 [PATCH RESEND 0/2] kconfig: fence choices and menuconfigs with comments in .config too Alexander Lobakin
2021-03-19 19:37 ` [PATCH RESEND 1/2] " Alexander Lobakin
2021-03-19 19:37 ` Alexander Lobakin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210319193705.267922-3-alobakin@pm.me \
    --to=alobakin@pm.me \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).