From patchwork Wed Jan 10 06:56:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124027 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4925452qgn; Tue, 9 Jan 2018 22:59:25 -0800 (PST) X-Google-Smtp-Source: ACJfBou2S1OKXIdWHEfg73WnvhczeIpa49r5qLCUSiibvZvtUgkRJZvs1JzLxfWJXZBsug80BJby X-Received: by 10.84.131.65 with SMTP id 59mr18362573pld.276.1515567565803; Tue, 09 Jan 2018 22:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515567565; cv=none; d=google.com; s=arc-20160816; b=zGMWy9JDbaPPs5AJpZZSR4swNDBYmzJEpza42cw5NvRSSYfTn/3RatXI/zChjlr3fE LfqzuA5eq4HMytejT0Zn6Vup9x90hVIdekdRKwJiYshAuc2bs0sfHGSnjMd2I8HKFpcd 8beiEny43n6UUUIeXFzKXyIBWdHAAIDMZLHlX5MhudWMU+UeYGM7LKhiPKk/rSHxeihE qgiybldJA0hxeq8wsBjYFYW5xQtooPyax6YJw5IB63L1XX7Dt6uNcb4OiFJqGOd2OAo0 ACs6KPoy78nq0ohf5KsheyCXmhExH4fu6rIKXnvII1DeKraaL+sPbzaqNFVcB6JTM36R i8Qg== 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=skXBkihUQNRyLVqEzoujP647sJJ2vyfDY0+hQCN76b4=; b=mrYmH4ENkaxiuGR+NjG6SawayRC+3JEgChsE6hngN+iCorcgOJZC4XH6WsLKlmo24t VhvxtQ+JSlDAff1t0hs3yVUxVkvN0BWTeQh9ZisNdCBC9XpOsS2Tz8iVp/ORlDzWCFhN Wdhk5V4iaSuEr95PzmT5ooB070DMP9k+6WVaBPSPag2MpEQ2EWhdEbUMjoou/jW3+3rU TLtmyPFjcihbNoXwQ+4mSWbAKYW3ZOiLRgDD1j4L8VedCdtVkJ6oIDHFyTxqW3zaV3Ex e8wKiALs1Xgcpjl+weUqtbKxvakKoUIk27Tla9xloPAofdskLur9rSkONcMZ5uTQ6ahh LONA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=cpRNHbBO; 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 t134si10175987pgc.168.2018.01.09.22.59.25; Tue, 09 Jan 2018 22:59:25 -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=cpRNHbBO; 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 S1753691AbeAJG5b (ORCPT + 28 others); Wed, 10 Jan 2018 01:57:31 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:22642 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753532AbeAJG51 (ORCPT ); Wed, 10 Jan 2018 01:57:27 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0A6uM2o020629; Wed, 10 Jan 2018 15:56:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0A6uM2o020629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1515567387; bh=skXBkihUQNRyLVqEzoujP647sJJ2vyfDY0+hQCN76b4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cpRNHbBO8CP2BxdTJIRNId7gg3Yu9I1i7jd7bb1vTPqjyfuB3nw7tvMtcbu/Q0QPk eF+NGcd8ERKoaoHXVT02dcxH2h4OzZ1Gus/6z+ytYI85JcMa5yvxJyRyhGIFCTBPLH OH8qD1fnV52/vcxhheOGkmoUGXObFpBTNSuAS8w55WBfDYXC2EfG8Onau1uADpRYlg d+CADwAZPZKIiI9SbssHo6t8eNhBQ97Ks+YDIv+VDBqx/UXTOlGYhEgLI6YfjmV4ju SAh7VVinLv4RtgIvkCy8VjNP7b1AULn2XxbljvPiolhv0RT/pYgYoqzRJnySLBHCft RR3opCaMIKgjw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Michal Marek , Ulf Magnusson , Marc Herbert , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] kconfig: hide irrelevant menu for oldconfig Date: Wed, 10 Jan 2018 15:56:14 +0900 Message-Id: <1515567374-12722-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515567374-12722-1-git-send-email-yamada.masahiro@socionext.com> References: <1515567374-12722-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 as 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 --- scripts/kconfig/conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.7.4 Acked-by: Ulf Magnusson diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 1d2ed3e..8b9cdf4 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -368,8 +368,7 @@ static void conf(struct menu *menu) switch (prop->type) { case P_MENU: - if (input_mode == silentoldconfig && - rootEntry != menu) { + if (input_mode != oldaskconfig && rootEntry != menu) { check_conf(menu); return; } @@ -660,7 +659,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: