From patchwork Sat Jul 30 23:13:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 1023192 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6UNDpHi022976 for ; Sat, 30 Jul 2011 23:13:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751886Ab1G3XNu (ORCPT ); Sat, 30 Jul 2011 19:13:50 -0400 Received: from casper.infradead.org ([85.118.1.10]:33616 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751370Ab1G3XNt (ORCPT ); Sat, 30 Jul 2011 19:13:49 -0400 Received: from i7.infradead.org ([2001:8b0:10b:1:225:64ff:fee8:e9df]) by casper.infradead.org with esmtpsa (Exim 4.76 #1 (Red Hat Linux)) id 1QnIj4-0008UO-MU; Sat, 30 Jul 2011 23:13:47 +0000 Subject: [PATCH 1/2] kconfig: Factor out conf_validate_choice_val() function from conf_read_simple() From: David Woodhouse To: Arnaud Lacombe Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Date: Sun, 31 Jul 2011 00:13:45 +0100 In-Reply-To: <1312067499.22074.59.camel@i7.infradead.org> References: <1312067499.22074.59.camel@i7.infradead.org> X-Mailer: Evolution 3.0.2 (3.0.2-3.fc15) Message-ID: <1312067626.22074.60.camel@i7.infradead.org> Mime-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 30 Jul 2011 23:13:51 +0000 (UTC) We're going to want to do this from elsewhere, shortly... Signed-off-by: David Woodhouse --- scripts/kconfig/confdata.c | 42 +++++++++++++++++++++++------------------- 1 files changed, 23 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 2bafd9a..a518ab3 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -179,6 +179,27 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) return 0; } +static void conf_validate_choice_val(struct symbol *sym, int def, int def_flags) +{ + struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); + switch (sym->def[def].tri) { + case no: + break; + case mod: + if (cs->def[def].tri == yes) { + conf_warning("%s creates inconsistent choice state", sym->name); + cs->flags &= ~def_flags; + } + break; + case yes: + if (cs->def[def].tri != no) + conf_warning("override: %s changes choice state", sym->name); + cs->def[def].val = sym; + break; + } + cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); +} + int conf_read_simple(const char *name, int def) { FILE *in = NULL; @@ -311,25 +332,8 @@ load: continue; } setsym: - if (sym && sym_is_choice_value(sym)) { - struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); - switch (sym->def[def].tri) { - case no: - break; - case mod: - if (cs->def[def].tri == yes) { - conf_warning("%s creates inconsistent choice state", sym->name); - cs->flags &= ~def_flags; - } - break; - case yes: - if (cs->def[def].tri != no) - conf_warning("override: %s changes choice state", sym->name); - cs->def[def].val = sym; - break; - } - cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); - } + if (sym && sym_is_choice_value(sym)) + conf_validate_choice_val(sym, def, def_flags); } fclose(in);