From patchwork Wed Feb 28 00:15:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 129880 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp413814lja; Tue, 27 Feb 2018 16:18:30 -0800 (PST) X-Google-Smtp-Source: AH8x226HnlbArZJJqGMl0e564u1pWR5Fp49Wo8h3zn6wzfsY6sjSFW9rIo1Qk1GzH+dLxCEp8BTo X-Received: by 10.101.85.143 with SMTP id j15mr12465915pgs.387.1519777110148; Tue, 27 Feb 2018 16:18:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519777110; cv=none; d=google.com; s=arc-20160816; b=MCzZdT5oZKcnSlG05740llWWHWOQj43bLQdIwYb1JCy7PV6dc75UxH5j9p4FA9XoSf PAoIPU/HKW+Cwm259TascajU/QJPuo0dMJn8sY8BhOtKZNfWAWRWkAg+/tUmtYWcYz2+ hFNuV/UHxm2uKLTG1xVc271hrPsmhEi99lTQwuKZ4dQmMGtO3hmsOiV7z4D1sVH3duVr OXEuIM8P40K9nCfzCxjhUTQMM7uLq2Es2BoOmLrZnKaGak7kR+q+Rx1iITOUdPTVrAf6 Myz7zK/mVwX3zGfLLClT6EnJMCYl8Yow77gLYgYuAxi0rVoj+kNEzMgWGlPuehs3HxPx qy9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=lmK+d8ZnQJL8C3XpYQ33ITW1tPqb2/Mo9zxysMJHUsk=; b=KH3HPHPJc2sSiNdwc7RNhvZC6fien1CAeb+/YQ1rnHC+mkAsj799ZsrF6CDl1YYs+/ HJ4Rfj/hUDW7U/uXpC6cVIav4PX6U4wkC0fRfsChvOTQccQaZ0Ghz3hxfeTDjWPa0VJP vLVzN79hBQ8c7TRcnHfzRnakDp8VI5qPa3lWGm4ibS1iaWTqJG7OY1evIkNItHHXQhwo o0H8ITQeyu9TnRU+xRANif9De/cS4Ztzylxly5SwfiXu4dEbWhkf9l6bQE8Zh1/3Mcjj M8nvuoFEqzsNF7d0V7zZyXMD+u9RER9C6YfiMRnyPa+ivgjQdWcuVL1qQLD768o/5+pZ olVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Pzal9c8H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7-v6si275662pln.666.2018.02.27.16.18.29; Tue, 27 Feb 2018 16:18:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Pzal9c8H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbeB1ASY (ORCPT + 28 others); Tue, 27 Feb 2018 19:18:24 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:24339 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751898AbeB1AQs (ORCPT ); Tue, 27 Feb 2018 19:16:48 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-09.nifty.com with ESMTP id w1S0Faho000353; Wed, 28 Feb 2018 09:15:39 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w1S0Faho000353 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519776939; bh=lmK+d8ZnQJL8C3XpYQ33ITW1tPqb2/Mo9zxysMJHUsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pzal9c8HLRA/21I32HavKZkFdC1hy8EIdVKQj7Q6U6UwramZ0F4Jg1mcOKZt4Yo8o McIJYa4sfzrDcDyc7ACBGfgzCiCzy0Aq3NmRcs/f0YCGksjT3fvKczvVgGt7romG0q kLtZCUpO3kRuV3IVJGWQIovYtCze/3i7TdRvOOaLYMlSywNh5mnMhVwqdzDyDRybTX LxyTAbu3R6YF0XIzp/0jakCO9zGJ3r0AIQFwISwv4jG4/C08nRoAv9UzdkN5f7UkW0 fNE4XuNbJ1Cb73h8wy/R3V71fdcMDvyLbpYuOcdMnRsIwwSwfCj4O+oFelvKpG8bpj Fzk+8bUo1Hv7w== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Marc Herbert , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/6] kconfig: hide irrelevant sub-menus for oldconfig Date: Wed, 28 Feb 2018 09:15:24 +0900 Message-Id: <1519776926-30459-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519776926-30459-1-git-send-email-yamada.masahiro@socionext.com> References: <1519776926-30459-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Historically, "make oldconfig" has changed its behavior several times, quieter or louder. (I attached the history below.) Currently, it is not as quiet as it should be. This commit addresses it. Test Case --------- ---------------------------(Kconfig)---------------------------- menu "menu" config FOO bool "foo" menu "sub menu" config BAR bool "bar" endmenu endmenu menu "sibling menu" config BAZ bool "baz" endmenu ---------------------------------------------------------------- ---------------------------(.config)---------------------------- CONFIG_BAR=y CONFIG_BAZ=y ---------------------------------------------------------------- With the Kconfig and .config above, "make silentoldconfig" and "make oldconfig" work differently, like follows: $ make silentoldconfig scripts/kconfig/conf --silentoldconfig Kconfig * * Restart config... * * * menu * foo (FOO) [N/y/?] (NEW) y # # configuration written to .config # $ make oldconfig scripts/kconfig/conf --oldconfig Kconfig * * Restart config... * * * menu * foo (FOO) [N/y/?] (NEW) y * * sub menu * bar (BAR) [Y/n/?] y # # configuration written to .config # Both hide "sibling node" since it is irrelevant. The difference is that silentoldconfig hides "sub menu" whereas oldconfig does not. The behavior of silentoldconfig is preferred since the "sub menu" does not contain any new symbol. The root cause is in conf(). There are three input modes that can call conf(); oldaskconfig, oldconfig, and silentoldconfig. Everytime conf() encounters a menu entry, it calls check_conf() to check if it contains new symbols. If no new symbol is found, the menu is just skipped. Currently, this happens only when input_mode == silentoldconfig. The oldaskconfig enters into the check_conf() loop as silentoldconfig, so oldaskconfig works likewise for the second loop or later, but it never happens for oldconfig. So, irrelevant sub-menus are shown for oldconfig. Change the test condition to "input_mode != oldaskconfig". This is false only for the first loop of oldaskconfig; it must ask the user all symbols, so no need to call check_conf(). History of oldconfig -------------------- [0] Originally, "make oldconfig" was as loud as "make config" (It showed the entire .config file) [1] Commit cd9140e1e73a ("kconfig: make oldconfig is now less chatty") made oldconfig quieter, but it was still less quieter than silentoldconfig. (oldconfig did not hide sub-menus) [2] Commit 204c96f60904 ("kconfig: fix silentoldconfig") changed the input_mode of oldconfig to "ask_silent" from "ask_new". So, oldconfig really became as quiet as silentoldconfig. (oldconfig hided irrelevant sub-menus) [3] Commit 4062f1a4c030 ("kconfig: use long options in conf") made oldconfig as loud as [0] due to misconversion. [4] Commit 14828349719a ("kconfig: fix make oldconfig") addressed the misconversion of [3], but it made oldconfig quieter only to the same level as [1], not [2]. This commit is restoring the behavior of [2]. Signed-off-by: Masahiro Yamada Reviewed-by: Ulf Magnusson --- Changes in v2: - Add a brief comment scripts/kconfig/conf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 59656d3..11a4e45 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -358,8 +358,11 @@ static void conf(struct menu *menu) switch (prop->type) { case P_MENU: - if (input_mode == silentoldconfig && - rootEntry != menu) { + /* + * Except in oldaskconfig mode, we show only menus that + * contain new symbols. + */ + if (input_mode != oldaskconfig && rootEntry != menu) { check_conf(menu); return; } @@ -660,7 +663,7 @@ int main(int ac, char **av) case oldaskconfig: rootEntry = &rootmenu; conf(&rootmenu); - input_mode = silentoldconfig; + input_mode = oldconfig; /* fall through */ case oldconfig: case listnewconfig: