Received: by 10.223.176.5 with SMTP id f5csp61850wra; Mon, 5 Feb 2018 16:42:51 -0800 (PST) X-Google-Smtp-Source: AH8x226NmUk6GF6ERba66jp6b1mGFd893DELiRGj4sGiYXpFizjC6cm3vaq6VgxWoj4jtK3LUuMm X-Received: by 2002:a17:902:66e6:: with SMTP id e93-v6mr574639plk.173.1517877771450; Mon, 05 Feb 2018 16:42:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877771; cv=none; d=google.com; s=arc-20160816; b=JdbbviDUqIO2kHLlPj5bWA55GTVZ22EnoqM5Vyrj1mWyK5O+h1CRZYZFF3WaFnEDhn kc7eoChaw2GiQ6mSvsJJl8J1sMkLuPnO/YudTzTs2euJ0RkfVceYhjzewW4HYhFpUbHN IzeN5gkM8uCGHEbwJvpT42dFjj/Qs9dnanuNQjYq9m6gNRkCzxEV7dg7XrQS/8VICIAc Yk3GjjMZEheFdRI3KUfxxWDgyZQPFaL9X7xJo2QA45L3VWrkUjA14jAe71rD2y7bhxnc ZNkD+PpCzPISq2GpEOjFXZdsoOA5mXBE8YKdAZgdHq69g7QzgFIXDYRlGvuw3uOWMo+G aS0g== 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 u13si3424105pgr.530.2018.02.05.16.42.34; Mon, 05 Feb 2018 16:42:51 -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 S1752404AbeBFAj6 (ORCPT + 99 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(-) 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 -- 2.7.4