From patchwork Fri Jun 7 03:37:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Arve_Hj=C3=B8nnev=C3=A5g?= X-Patchwork-Id: 2684071 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 73B623FD4E for ; Fri, 7 Jun 2013 03:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752157Ab3FGDiK (ORCPT ); Thu, 6 Jun 2013 23:38:10 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:44458 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751916Ab3FGDiJ (ORCPT ); Thu, 6 Jun 2013 23:38:09 -0400 Received: by mail-pa0-f42.google.com with SMTP id rl6so2227395pac.29 for ; Thu, 06 Jun 2013 20:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20120917; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=ygyLyDhBWHv8o2k+lr9QwZe+c+VCx6oRq38O5gmZLc0=; b=aYxtMR+S4cQpXBvneTq6dlnnuGkPEf94mOAlwon0tYxuvmCXwwIZPlLWYoz+luSS0z fGOVKgYISUsATYvYYcyOnlsG+q3l4vIfHQIsjpyDKoRinkXVYYb+O1PMzlz2D8Bv/9uK vMYAbnvqzaJv5FHkjISCddJD/qZCfo+R4nnPK6nUs9zLx4OdHWHxU4aNwL6XM77nzcyF hGgq5oI9r17KVCbBxa103zXayp9XiUtipN4GYkXDPyD+XIoUlMHIoaRHFKmQa/oUmodN 9ine8aLVCv2Q59iMoY3wIO73jzUizjxODQQ2dg4YSputqE7uatwkyy4U1bIBHxmIdGu1 QTig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding:x-gm-message-state; bh=ygyLyDhBWHv8o2k+lr9QwZe+c+VCx6oRq38O5gmZLc0=; b=A5eFTPy/fZs1NrzIWEHGPtr2EHK4QuJwEqmr2kAspTo0dQ1KOVQj9z3NA4vv/mVcdc 9CawOzA4XKpYktJRf1pSU6j5NndcNgG+bEbN9z1M8K0ZUenoYaKiAvVRVvF4viZKCX9W gtGyXRFBDNkBHGnbw7xU0V5KETAeTGOqClMk1vtv4o3+wnjiSnDVUWijrq4pS3mSLwv5 MV3WkBr2VQbEkjbfCCzu59mWK6E2MECedSf//dt2tB7K6kxGdYmCv/zrJu/m6+ab+d7b lUXiUSonZOoly1py28c42Xji3tngc/845EQuf4+cul6BYY1ouKucV0O6jXOfbceUOiDH uavQ== X-Received: by 10.66.82.162 with SMTP id j2mr730583pay.168.1370576288473; Thu, 06 Jun 2013 20:38:08 -0700 (PDT) Received: from arveh.mtv.corp.google.com (arveh.mtv.corp.google.com [172.18.104.28]) by mx.google.com with ESMTPSA id p2sm905272pag.22.2013.06.06.20.38.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 20:38:07 -0700 (PDT) From: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Michal Marek , "Yann E. MORIN" , Peter Korsgaard , Cody Schafer , Benjamin Poirier , Alan Cox , linux-kbuild@vger.kernel.org Subject: [RFC][PATCH] kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on Date: Thu, 6 Jun 2013 20:37:00 -0700 Message-Id: <1370576226-7597-1-git-send-email-arve@android.com> X-Mailer: git-send-email 1.8.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnnJeFU0oVol/hMCWwSFqvKbDW/zzsxl9oC9vG7j1+yJ2VFg8ZAGyKPQYDTy2ZB/eWQN+m1 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The defconfig and Kconfig combination below, which is based on 3.10-rc4 Kconfigs, resulted in several options getting set to "m" instead of "y". defconfig: --- CONFIG_MODULES=y CONFIG_USB_GADGET=y CONFIG_USB_ZERO=y --- Kconfig: --- menuconfig MODULES bool "Enable loadable module support" config CONFIGFS_FS tristate "Userspace-driven configuration filesystem" config OCFS2_FS tristate "OCFS2 file system support" depends on CONFIGFS_FS select CRC32 config USB_LIBCOMPOSITE tristate select CONFIGFS_FS choice tristate "USB Gadget Drivers" default USB_ETH config USB_ZERO tristate "Gadget Zero (DEVELOPMENT)" select USB_LIBCOMPOSITE config USB_ETH tristate "Ethernet Gadget (with CDC Ethernet support)" select USB_LIBCOMPOSITE endchoice config CRC32 tristate "CRC32/CRC32c functions" default y choice prompt "CRC32 implementation" depends on CRC32 default CRC32_SLICEBY8 config CRC32_SLICEBY8 bool "Slice by 8 bytes" endchoice --- Signed-off-by: Arve Hjønnevåg --- scripts/kconfig/confdata.c | 14 ++++++++++---- scripts/kconfig/expr.h | 3 +++ scripts/kconfig/lkc.h | 1 + scripts/kconfig/symbol.c | 11 +++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 43eda40..35e0f16 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -1083,7 +1083,7 @@ static void randomize_choice_values(struct symbol *csym) csym->flags &= ~(SYMBOL_VALID); } -static void set_all_choice_values(struct symbol *csym) +void set_all_choice_values(struct symbol *csym) { struct property *prop; struct symbol *sym; @@ -1100,7 +1100,7 @@ static void set_all_choice_values(struct symbol *csym) } csym->flags |= SYMBOL_DEF_USER; /* clear VALID to get value calculated */ - csym->flags &= ~(SYMBOL_VALID); + csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES); } void conf_set_all_new_symbols(enum conf_def_mode mode) @@ -1202,6 +1202,14 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) * selected in a choice block and we set it to yes, * and the rest to no. */ + if (mode != def_random) { + for_all_symbols(i, csym) { + if ((sym_is_choice(csym) && !sym_has_value(csym)) || + sym_is_choice_value(csym)) + csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES; + } + } + for_all_symbols(i, csym) { if (sym_has_value(csym) || !sym_is_choice(csym)) continue; @@ -1209,7 +1217,5 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) sym_calc_value(csym); if (mode == def_random) randomize_choice_values(csym); - else - set_all_choice_values(csym); } } diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index cdd4860..df198a5 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -106,6 +106,9 @@ struct symbol { #define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */ #define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */ +/* choice values need to be set before calculating this symbol value */ +#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000 + #define SYMBOL_MAXLENGTH 256 #define SYMBOL_HASHSIZE 9973 diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index f8aee5f..0c8d419 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -87,6 +87,7 @@ char *conf_get_default_confname(void); void sym_set_change_count(int count); void sym_add_change_count(int count); void conf_set_all_new_symbols(enum conf_def_mode mode); +void set_all_choice_values(struct symbol *csym); struct conf_printer { void (*print_symbol)(FILE *, struct symbol *, const char *, void *); diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index ecc5aa5..ab8f4c8 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -300,6 +300,14 @@ void sym_calc_value(struct symbol *sym) if (sym->flags & SYMBOL_VALID) return; + + if (sym_is_choice_value(sym) && + sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) { + sym->flags &= ~SYMBOL_NEED_SET_CHOICE_VALUES; + prop = sym_get_choice_prop(sym); + sym_calc_value(prop_get_symbol(prop)); + } + sym->flags |= SYMBOL_VALID; oldval = sym->curr; @@ -425,6 +433,9 @@ void sym_calc_value(struct symbol *sym) if (sym->flags & SYMBOL_AUTO) sym->flags &= ~SYMBOL_WRITE; + + if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) + set_all_choice_values(sym); } void sym_clear_all_valid(void)