Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp192937lqt; Thu, 6 Jun 2024 00:08:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXo/qN8Gqutvm7NrdB8m++mAmA/tEfyBBZog/xLD6b6T2oAahOWk2osDSvxr7AUApS+XDE13wUp30saCkaoJhTq3qurxcAuyTscRTxG0g== X-Google-Smtp-Source: AGHT+IF8CNWloe+MN9KyY9YaHy/eWUMehSIQSfQkJFnRpBqz/rGr3rleDr/iKWF9Fa40nMaPjKXR X-Received: by 2002:a05:6358:2928:b0:19c:27a0:a116 with SMTP id e5c5f4694b2df-19c6c68ae8emr544285155d.14.1717657680676; Thu, 06 Jun 2024 00:08:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717657680; cv=pass; d=google.com; s=arc-20160816; b=MEMTpmLsfLm9rPRwc7TCc8/pOrWse/urFQLKxdCzxvErc1t1h6hrmXAI8DJFDL3Gtd Vm0dcMeEqID0Oc++RLKUP3VBD36CLwS3ZoqtEW4VCpNewvZuHOMWYYRVLF85ZMF8OOL6 aZrZYvPOUC4CUpI5eH3+Rx0dQy/OhaYWSWkTOb3bFLdbbIL2RV8ULx9hUS92IulZ8KG8 xRvakqkrjFg4fDK/giEmogh0vgLpi0lJ4YptNCSQ314svMwipSN3aaK3mvOv/gH1nyla xcpssDqOrcjWJStyHBY5vb5bPvbgJyV0i7Cj5iwAZszYRBTKlhQibOVku11Rw5Vofs72 3GsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=rmHZKXngqf+GQioJ2iaHJPfIk8K1OM5AMS5F4AqSE+o=; fh=m+QKjX8X7sDdy2doVVcT1qH76sLnVtOdkCidwOFoCjo=; b=fyYXlU2uiB2dPc/5wHNCD4eKDthVyZrsbYgzVoiUuguqcEga9olYUAUiIy4pDmJAAg s84gLBIbMijZEUdrYNC/GGiolMH+1uckCWOApfrltJbuCY5GhYXYI/d4w8ODuhruBp1C uoW4bCZ1jEgw0NDecFBt8CbO7BgXyYjz6F/WvyqimxR5ca6CKQVbw2Ug/rGAcjp1prir 29P+GrHuj1JHvAwuSehYi0xXm8CoYUnotdXlMwFEJ5uWiwkbDhllRshOi7Q3v4v7zxNj yRhhq5ZoeYKIO4nLtoLlCMLOEZ2xlNRW7ccWm3u1LCuPhGM/NEsOmsGN65lyDAMwG+PR VZIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u+8HJfCW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203700-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de275faa78si659505a12.439.2024.06.06.00.08.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 00:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u+8HJfCW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203700-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CF8ADB257E7 for ; Thu, 6 Jun 2024 06:58:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC33013AA46; Thu, 6 Jun 2024 06:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u+8HJfCW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E231513A3E2; Thu, 6 Jun 2024 06:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717657112; cv=none; b=Wei/Bp+hpzUp+3eQf2twIzUngc/He3HtgWM3ozcPFZr6M+/rVWcXJBbOXApvZ5+wgUaT88njjK0Mbv7k4PmETShMtwa/F4KSeOF6D5WLp1aM7Mvy8IhBssZUdfYmSVeByUKX4+QRQ6OFkiypR2Yh6D3mIJa67JJRBjwZ2O66OFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717657112; c=relaxed/simple; bh=SOJoCNmYjMp2sd9tajLrhObVAMG8hZ817lMHcW9drbA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XJnWAtpycxB4cYgZmf5vN1Bo7mG1fLWqyy8jb3RSNMCvKV8S1YgkdRndRp6UiQWBBxCDzHMXwUieVz8mCEuaCqQKigFK5sTrVUGfwXSCdh8M8nvLoS11Wk3X8yKDgbElsgeHqgJx2NN1zErE2dwtMNXWMSyeaOTN6BW6+mNLycQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u+8HJfCW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78EB1C4AF09; Thu, 6 Jun 2024 06:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717657111; bh=SOJoCNmYjMp2sd9tajLrhObVAMG8hZ817lMHcW9drbA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=u+8HJfCWnwpS9As1djoVl2cskbTf43cGyQ+FR3IhfNp9MNDL9jkZHM6HMxjBOWN6D gIOzmbxOGgOM6QSxN5l/lU6mqOTpJoCg2Lqq7jbZ8+iInMylxkdLLQLbFB7WGKOukY FO/O+5I2Wg+c2Kae+hQRJABhCIANdK2/x63xksVIdEqSi5Zy35oOxWPgYjUDLK8eQG O6U9RZRlIH27D80bpt2Js5tRrlK7kCR6IjwXesZJDRJc/1EJghRJQKogCIRRuSPhTU MbsHRGwbJGd9tIyUzI1Jlkfx47tQLxSWd0DMDec/Im2dcqXiZB4UD4BQMem/BiwB23 2KFwB10Orm+iQ== Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2eabd22d404so6434621fa.2; Wed, 05 Jun 2024 23:58:31 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCW3AYhEUs9AKzEAfNgABH9BLwU/WB8SPpMuQWC4CWSL2opcTuXKK3gMltdZRGywr7nnS9ugcVQHorsNzV+2J3M7Cw/GnDA83qGq X-Gm-Message-State: AOJu0YzsglZYrtqN29Sg3OZ6MMbim53c+svO/T4vLrlSEIjNt1gShi07 F4R71+o9baWvzs2R8LnnLyZ94oVoys6zaDQzeQFtAKiUmG/rLyrzv7dTnkCU9i3d4YLxkhl1BX/ 6jfZ2/kZrJ5R4h+oKopWrW09kmHc= X-Received: by 2002:a2e:804b:0:b0:2e5:685a:cd24 with SMTP id 38308e7fff4ca-2eac798a96dmr26289171fa.6.1717657110169; Wed, 05 Jun 2024 23:58:30 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240602125416.976336-1-masahiroy@kernel.org> In-Reply-To: <20240602125416.976336-1-masahiroy@kernel.org> From: Masahiro Yamada Date: Thu, 6 Jun 2024 15:57:54 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] kconfig: remove tristate choice support To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jonathan Corbet , Nathan Chancellor , Nicolas Schier , linux-doc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jun 2, 2024 at 9:54=E2=80=AFPM Masahiro Yamada wrote: > > I previously submitted a fix for a bug in the choice feature [1], where > I mentioned, "Another (much cleaner) approach would be to remove the > tristate choice support entirely". > > There are more issues in the tristate choice feature. For example, you > can observe a couple of bugs in the following test code. > > [Test Code] > > config MODULES > def_bool y > modules > > choice > prompt "tristate choice" > default A > > config A > tristate "A" > > config B > tristate "B" > > endchoice > > [Bug 1] the 'default' property is not correctly processed > > 'make alldefconfig' produces: > > CONFIG_MODULES=3Dy > # CONFIG_A is not set > # CONFIG_B is not set > > However, the correct output should be: > > CONFIG_MODULES=3Dy > CONFIG_A=3Dy > # CONFIG_B is not set > > The unit test file, scripts/kconfig/tests/choice/alldef_expected_config, > is wrong as well. > > [Bug 2] choice members never get 'y' with randconfig > > For the test code above, the following combinations are possible: > > A B > (1) y n > (2) n y > (3) m m > (4) m n > (5) n m > (6) n n > > 'make randconfig' never produces (1) or (2). > > These bugs are fixable, but a more critical problem is the lack of a > sensible syntax to specify the default for the tristate choice. > The default for the choice must be one of the choice members, which > cannot specify any of the patterns (3) through (6) above. > > In addition, I have never seen it being used in a useful way. > > The following commits removed unnecessary use of tristate choices: > > - df8df5e4bc37 ("usb: get rid of 'choice' for legacy gadget drivers") > - bfb57ef0544a ("rapidio: remove choice for enumeration") > > This commit removes the tristate choice support entirely, which allows > me to delete a lot of code, making further refactoring easier. > > This includes the revert of commit fa64e5f6a35e ("kconfig/symbol.c: > handle choice_values that depend on 'm' symbols"). It was suspicious > because it did not address the root cause but introduced inconsistency > in visibility between choice members and other symbols. > > [1]: https://lore.kernel.org/linux-kbuild/20240427104231.2728905-1-masahi= roy@kernel.org/T/#m0a1bb6992581462ceca861b409bb33cb8fd7dbae > > Signed-off-by: Masahiro Yamada > --- I will fix a couple of mistakes. > diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c > index baa1c512de3c..217f85ea0910 100644 > --- a/scripts/kconfig/gconf.c > +++ b/scripts/kconfig/gconf.c > @@ -1067,10 +1067,7 @@ static gchar **fill_row(struct menu *menu) > row[COL_VALUE] =3D > g_strdup(menu_get_prompt(def_menu)); > > - if (sym_get_type(sym) =3D=3D S_BOOLEAN) { > - row[COL_BTNVIS] =3D GINT_TO_POINTER(FALSE); > - return row; > - } > + return row; I accidentally dropped row[COL_BTNVIS] =3D GINT_TO_POINTER(FALSE); I will restore it. The intention is to drop the if-condition that is always met. > @@ -479,7 +461,7 @@ void sym_calc_value(struct symbol *sym) > } > > sym->curr =3D newval; > - if (sym_is_choice(sym) && newval.tri =3D=3D yes) > + if (sym_is_choice(sym)) > sym->curr.val =3D sym_calc_choice(sym); > sym_validate_range(sym); > I will keep "&& newval.tri =3D=3D yes" here. When a choice block is hidden by 'depends on', there is no need to call sym_calc_choice(). --=20 Best Regards Masahiro Yamada