From patchwork Tue Feb 6 00:34:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126936 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441933ljc; Mon, 5 Feb 2018 16:40:00 -0800 (PST) X-Google-Smtp-Source: AH8x225QegOZNGKeY/0WLDM9+/f1VUp0C15H4wR1ucRPmZu9lzXEpJhAl1xJqXoW1PbFWGNZ+LF/ X-Received: by 2002:a17:902:6042:: with SMTP id a2-v6mr555170plt.335.1517877600288; Mon, 05 Feb 2018 16:40:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877600; cv=none; d=google.com; s=arc-20160816; b=lvao5mMMMq+wngr8A0B/ag3l4e2+VdYVE37FrndkCj4QeuhBCZOdOJE/HMAXO1/zA4 wBW1B2+TTCe7VdW/llwFpxVXhrtr+lSP8uUV6cmC3BUmXHY4TlgMC5IOksJ8XjnCc8oq pgIg3vOckabBSjNNcca07kPnplzdzUrSShBYY3BHo5EnXJ6aTSx0NWhX4ccIoUHuuekV +q7p0pSgfl+E4Kzh1kjYpFe3W8u85kDwbGMKvXTRPvsuuJFrsm4ytYLi8orUvl3j6Wks dwBALlcV3PWOL4Sk2A9K0YZ8pX9fBN7odLPGJ5MXPcofb/5kNybczyDjWRJHwXuVyQmE TvLg== 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=GMlbL4n4TZmnicc5N3ATpO1/g+JjbJbNcZa/SH7AxAo=; b=TUT2oCsA2K62loL3dCwx8RjTl/s63uwlQeyKUty2IoByW5VfAph1Xe4IdF+8zMogVm xWzf3SaVc9aXFoQfyT/VfJ0q4DIj1zQ9gucIRVjLP43rrpvvGQMDaFZLhvVpEzLqTdF4 6dOdBqvnTTjTR0HoCYgEnvglFKOzGGL4radzIXHw4wPLI/FmEg5Ri7cwJpQMMrWJl5EO GrV0n1JiHCFQb+tfQS7ycz08sJ/885WghoSU4d9PWlh65Hjw4zRuB2UFAMzHMLT7AAuz 5tl3GGk3UZi70B0fDigXAqbWLLq/GsCLPSvnrEsNuo0rzmcHToh7ouE79AT7IKs960nU GWBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=QSclydS1; 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 i22-v6si712233pll.332.2018.02.05.16.40.00; Mon, 05 Feb 2018 16:40:00 -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=QSclydS1; 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 S1752656AbeBFAj6 (ORCPT + 21 others); Mon, 5 Feb 2018 19:39:58 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39985 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752337AbeBFAiB (ORCPT ); Mon, 5 Feb 2018 19:38:01 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w160ZHAh011351; Tue, 6 Feb 2018 09:35:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAh011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877320; bh=GMlbL4n4TZmnicc5N3ATpO1/g+JjbJbNcZa/SH7AxAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QSclydS116Lo2ofpkjkI7keS06ykFOx83H3055BbsRYQBtrgkTzkDq+qhUO+9NsCi RepIf792fvyQp/Yg/Fql9GjuJdplz9951sKZMxtAYIz3MQ05N3g/XqUNM66SqzXJYj EWpqoEOFo+7QRS7c0qD2IPelb8dMLxcILyUsMh2Y4mv3UPT0Gz0HoEfiOORH43Vxeg 4G2S5ixB0i9sc2/vXzPvkmeTLKZLA8vXen0QHJDVe2g2nFBxTKVWSHMOGnaMUv6xHm kEweq7QdJJ2cCbTGMtr5TunF//klbMxtz4akvueqyj/Dfx1Dg1KTxdFOqbtTTtU4yz aKlnBboqGDOqQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg Kroah-Hartman , Andrew Morton , Nicolas Pitre , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , Linus Torvalds , Masahiro Yamada , "Luis R. Rodriguez" , linux-kernel@vger.kernel.org, Heinrich Schuchardt Subject: [PATCH 02/14] kconfig: do not write choice values when their dependency becomes n Date: Tue, 6 Feb 2018 09:34:42 +0900 Message-Id: <1517877294-4826-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517877294-4826-1-git-send-email-yamada.masahiro@socionext.com> References: <1517877294-4826-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 "# CONFIG_... is not set" for choice values are wrongly written into the .config file if they are once visible, then become invisible later. Test case --------- ---------------------------(Kconfig)---------------------------- config A bool "A" choice prompt "Choice ?" depends on A config CHOICE_B bool "Choice B" config CHOICE_C bool "Choice C" endchoice ---------------------------------------------------------------- ---------------------------(.config)---------------------------- CONFIG_A=y ---------------------------------------------------------------- With the Kconfig and .config above, $ make config scripts/kconfig/conf --oldaskconfig Kconfig * * Linux Kernel Configuration * A (A) [Y/n] n # # configuration written to .config # $ cat .config # # Automatically generated file; DO NOT EDIT. # Linux Kernel Configuration # # CONFIG_A is not set # CONFIG_CHOICE_B is not set # CONFIG_CHOICE_C is not set Here, # CONFIG_CHOICE_B is not set # CONFIG_CHOICE_C is not set should not be written into the .config file because their dependency "depends on A" is unmet. Currently, there is no code that clears SYMBOL_WRITE of choice values. Clear SYMBOL_WRITE for all symbols in sym_calc_value(), then set it again after calculating visibility. Signed-off-by: Masahiro Yamada --- scripts/kconfig/symbol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index c9123ed..5d6f6b1 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -371,8 +371,7 @@ void sym_calc_value(struct symbol *sym) sym->curr.tri = no; return; } - if (!sym_is_choice_value(sym)) - sym->flags &= ~SYMBOL_WRITE; + sym->flags &= ~SYMBOL_WRITE; sym_calc_visibility(sym); @@ -385,6 +384,7 @@ void sym_calc_value(struct symbol *sym) if (sym_is_choice_value(sym) && sym->visible == yes) { prop = sym_get_choice_prop(sym); newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; + sym->flags |= SYMBOL_WRITE; } else { if (sym->visible != no) { /* if the symbol is visible use the user value