From patchwork Wed Oct 30 14:26:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Gouders X-Patchwork-Id: 3114791 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C7929F3E2 for ; Wed, 30 Oct 2013 14:25:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 263C220122 for ; Wed, 30 Oct 2013 14:25:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1AEF2010E for ; Wed, 30 Oct 2013 14:25:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754350Ab3J3OZp (ORCPT ); Wed, 30 Oct 2013 10:25:45 -0400 Received: from services.gouders.net ([141.101.32.176]:37299 "EHLO services.gouders.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752548Ab3J3OZo (ORCPT ); Wed, 30 Oct 2013 10:25:44 -0400 Received: from localhost ([193.175.198.193]) (authenticated bits=0) by services.gouders.net (8.14.7/8.14.7) with ESMTP id r9UEOiD1019395 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Oct 2013 15:24:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gouders.net; s=gnet; t=1383143085; bh=nwk3AoJdluwtPyMmEAa6hIa5UXumQNym+U9rMgmj4F4=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=QboUyqKviAPElTFHM35mSPaXRnkk3hUV5M+TMOMbBeIk7BhVdFsESkDNrzL6D8Vu/ 6YmEB+qZKw0MsqjN1mzH08bCcZj7/Mvq3q5KPS+UPw5BlhET6JUFZ1+mwAWtDyTMHW rEM2k+04yBQ3WzcrH9IdGGdFtGTK1DnobZ1hma1c= From: Dirk Gouders To: Dirk Gouders Cc: Sebastian Andrzej Siewior , "Yann E. MORIN" , Michal Marek , linux-kbuild@vger.kernel.org, Felipe Balbi , USB list , Tomi Valkeinen , Roger Quadros Subject: Re: choice =y selection becomes lost after having multiple entries =m with depends on In-Reply-To: (Dirk Gouders's message of "Wed, 30 Oct 2013 11:00:21 +0100") References: <5267AA3E.1040003@linutronix.de> <20131023112331.GA3869@free.fr> <5267B2D3.3000109@linutronix.de> <52694894.8090201@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Date: Wed, 30 Oct 2013 15:26:30 +0100 Message-ID: MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_DISCARD, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Dirk Gouders writes: > Sebastian Andrzej Siewior writes: > >> On 10/24/2013 05:30 PM, Dirk Gouders wrote: >>> Hi Sebastian, >> >> Hi Dirk, >> >>> I was looking at what you described and initially had a hard time to >>> reproduce the problem, probably because I tried it after `make >>> mrproper'. I am only able to reproduce the problem with an existing >>> .config of my running kernel, for example. >>> >>> Just to make sure that I am correctly trying to reproduce the problem: >>> did you already try to do what you described after a `make mrproper' and >>> do you then also notice the described problems? If not, could you >>> please try that? >> >> What is the purpose behind mrproper? >> The key to reproduce it is to have a .config with atleast two items >> within a choice statement which also have a "depends on" statement and >> those set to =m. If you don't have this after mrproper (with your fresh >> .config) then you don't see it. > > Hi Sebastian, Yann, all > > apologies for my previous misunderstanding. > > I hope I now understood the problem and I tried to fix it with the > attached patch. Could you please test the patch if it fixes the problem > you noticed? > > Another problem that I noticed is that if a choice is set to 'y', then > I think the choice list should not include symbols that depend on > symbols set to 'm', because they cannot be chosen, anyway. Well, this > is rather confusing but does not produce real errors; I will see if I > can fix that, too. Hi Sebastian, Yann, all, below is a patch that prevents choice_values to appear in the list if they depend on 'm' symbols and the choice symbol is set to 'y'. I would be glad if you could have a look at it. Yann, in this patch I wrote " if (choice_sym != NULL..." -- I guess that is one point that you will probably remark in the previous patch. Another point is that all the conditionals in both patches could be limited to only those choice_values that are of type tristate but I think that makes the code even harder to read... Dirk From 677f5830588749cbb0bdb0568cbdaba271937c8d Mon Sep 17 00:00:00 2001 From: Dirk Gouders Date: Wed, 30 Oct 2013 15:06:05 +0100 Subject: [PATCH 2/2] kconfig/symbol.c: handle visibility of choice_values that depend on 'm' symbols If choice_values depend on symbols that are set to 'm' then these choice_values should not be visible in choice lists if the choice symbol is set to 'y'. See USB Gadget Drivers, for example. Reported-by: Sebastian Andrzej Siewior Signed-of-by: Dirk Gouders --- scripts/kconfig/symbol.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 043c041..fbabb80 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -189,12 +189,23 @@ static void sym_validate_range(struct symbol *sym) static void sym_calc_visibility(struct symbol *sym) { struct property *prop; + struct symbol *choice_sym = NULL; tristate tri; /* any prompt visible? */ tri = no; + + if (sym_is_choice_value(sym)) + choice_sym = prop_get_symbol(sym_get_choice_prop(sym)); + for_all_prompts(sym, prop) { prop->visible.tri = expr_calc_value(prop->visible.expr); + /* + * choice_values with visibility 'mod' are not visible if the + * corresponding choice's value is 'yes'. + */ + if (prop->visible.tri == mod && (choice_sym != NULL && choice_sym->curr.tri == yes)) + prop->visible.tri = no; tri = EXPR_OR(tri, prop->visible.tri); } if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))