From patchwork Fri Mar 19 19:37:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12151803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 263EEC433E0 for ; Fri, 19 Mar 2021 19:38:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E13FE6197B for ; Fri, 19 Mar 2021 19:37:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230386AbhCSTh2 (ORCPT ); Fri, 19 Mar 2021 15:37:28 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:20462 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbhCSThV (ORCPT ); Fri, 19 Mar 2021 15:37:21 -0400 Date: Fri, 19 Mar 2021 19:37:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1616182639; bh=a22bdLLLFKTo4auJnUAqBgT9ExHsDoQaIWYHGEXtWeg=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=cztofeO+4A0UG1XxfKp4WPMnkOJ5OnmlI0eObtyAVy4Ry3Dy4HiinE6g9uPXAmtI+ lDxP/4Vr4mkWx5tT8jehrHOdNgfNmaB4hoM5TqU++jyA4somHne5GaJb3JA3jDe26N QsbEdco+DmJEaNP/w/9CqgeyHscok42jfneZEl5mP1EhBvGo3Nf3oMXqYhqsjg65nM vqIjQhQk/xKDDIj/xhRsJRC+53KidR32d66wgyHG5Cx7HlyYarD8s0WwEJ2GqDZpvP 4X5TVd9ib/bwlbvYUJva7r+kbkrP4QUKwCK/X5klVFD3POZBClAGNcHql8mN5cpARH Q84Rv9109givw== To: Masahiro Yamada From: Alexander Lobakin Cc: Alexander Lobakin , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH RESEND 2/2] kconfig: mention submenu type in comment blocks in .config Message-ID: <20210319193705.267922-3-alobakin@pm.me> In-Reply-To: <20210319193705.267922-1-alobakin@pm.me> References: <20210319193705.267922-1-alobakin@pm.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- scripts/kconfig/confdata.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) -- 2.31.0 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) {