Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1953630ybz; Sat, 18 Apr 2020 12:02:56 -0700 (PDT) X-Google-Smtp-Source: APiQypLuNJS8SeRFlFV1sbrMkYSTxJTXNVQfaStRRqxKPzofJMvOsx9c0ZqzeVndcniPXJoDKwLv X-Received: by 2002:a05:6402:22cc:: with SMTP id dm12mr8347525edb.159.1587236576491; Sat, 18 Apr 2020 12:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587236576; cv=none; d=google.com; s=arc-20160816; b=PRQjUs27eyiNllvN+rlEGCnS1VRwbx0wYjBl13kkB+qUdglwSKAlHhAsO8dcbetvWQ GPsGKQD9R8mjnxYQTqRi1Xkqh1qyNRScqW4Qc59fY5KroQuDKFCcCt1hk582/SqLouJu hnCDwrrinnT9Reifjp6VzI9CHoWqmNZ9WhJzUBX4ZBqxehGZcIAlY3I0pgUa1852tMcO YPA4ZKbB7ulOtOI3uP+PRozEHrTNEnN2wHFqcNEcn60DdeNBWzCb6GzOQwYezaLU7f3N g2q0cNWmHRWhx9BmKWXm4L7qdaZO8EPm84f92NU9Cmj8WKByyTXGcliOzfQ4FPdTf+27 lr0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=GMWTNYzKx2p6AtuFISRqos/DJ7YLVq9yd6sy0E83Y1g=; b=TbHW9djcdNQviWEa9mo1nbSvPuQ8+WjSSuN6hXm/diMh6qdpBPStvx72raAuqFYrHs dyZNOTlbYJPaZo9bs/+22M8YYBPHZZQX0N3vUMyCi/uVcIw6jcNvRzrNkRkgsnfxLXxe xclz6QNZZYwHR9qGolRnHB2JV1ux7iAwAeTtjvrorTwqLG/Dz92rQMCs9neFAf3DUTrs uIcUF7YsZriLSjb7ASmUES1AFP0l56NCzEqojSKa9Ml8HxbU2XglAPH9GlztYPGicD/1 M4T1uXp8Us2vXwZsbgBu+YeNWM1ewB7Ea0tW7Vf1uoUTN4HONiOiTnFVjU4FgIElJSfc p/8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LY2hnNJs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si8693250ejr.224.2020.04.18.12.02.33; Sat, 18 Apr 2020 12:02:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LY2hnNJs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728093AbgDRTBg (ORCPT + 99 others); Sat, 18 Apr 2020 15:01:36 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:40962 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726382AbgDRTBf (ORCPT ); Sat, 18 Apr 2020 15:01:35 -0400 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 03IJ1JqZ013789; Sun, 19 Apr 2020 04:01:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 03IJ1JqZ013789 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587236480; bh=GMWTNYzKx2p6AtuFISRqos/DJ7YLVq9yd6sy0E83Y1g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LY2hnNJss/p/DNWumoPJe9gAxXBpbVoMn0t2qRNhlQQxjVYS0JB3OrNSi/keiWn63 qUnt2aRQuhmxHHrQw7xWa+eKAOJ8RcEuWZGU+e2MarByOILha83js6TWc3pU9wamhW rSZ9JkyLNEFZHYAkYRtygosYGywyvChLBrx8JFXpqn7qvm5aVPOnLhyXQ8JBHHw9P9 T4cY2qtdZTxlR9mWd8DnW8ypzIW4K/HXQQAzMMWl8G+roCNcq8HlYapAIbOdxKGuDu 0udehiLgV2PCn0xVlijudxgzLIQgkSS0jvaDsWqA4t8reBddTl5XFEJAiC6ffP0mxA mRezBbUXIw0Aw== X-Nifty-SrcIP: [209.85.217.47] Received: by mail-vs1-f47.google.com with SMTP id l25so644580vso.6; Sat, 18 Apr 2020 12:01:20 -0700 (PDT) X-Gm-Message-State: AGi0PuYfws6fd8mY31j+wOcPlh7D+JMusWqwWzEdg2ZKFoOkK5BNj5/i ue1FUkgU7vX8pkv2jAuHGzMNzCS7NZzXG6Cbk1Y= X-Received: by 2002:a67:3293:: with SMTP id y141mr6907237vsy.54.1587236479217; Sat, 18 Apr 2020 12:01:19 -0700 (PDT) MIME-Version: 1.0 References: <20200417011146.83973-1-saeedm@mellanox.com> In-Reply-To: <20200417011146.83973-1-saeedm@mellanox.com> From: Masahiro Yamada Date: Sun, 19 Apr 2020 04:00:43 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 1/2] Kconfig: Introduce "uses" keyword To: Saeed Mahameed Cc: Linux Kbuild mailing list , Arnd Bergmann , Jason Gunthorpe , Nicolas Pitre , Jani Nikula , Neil Armstrong , Laurent Pinchart , Leon Romanovsky , Kieran Bingham , jonas@kwiboo.se, David Airlie , jernej.skrabec@siol.net, Linux Kernel Mailing List , Networking , linux-rdma@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 17, 2020 at 10:12 AM Saeed Mahameed wrote: > > Due to the changes to the semantics of imply keyword [1], which now > doesn't force any config options to the implied configs any more. > > A module (FOO) that has a weak dependency on some other modules (BAR) > is now broken if it was using imply to force dependency restrictions. > e.g.: FOO needs BAR to be reachable, especially when FOO=y and BAR=m. > Which might now introduce build/link errors. > > There are two options to solve this: > 1. use IS_REACHABLE(BAR), everywhere BAR is referenced inside FOO. > 2. in FOO's Kconfig add: depends on (BAR || !BAR) > > The first option is not desirable, and will leave the user confused when > setting FOO=y and BAR=m, FOO will never reach BAR even though both are > compiled. > > The 2nd one is the preferred approach, and will guarantee BAR is always > reachable by FOO if both are compiled. But, (BAR || !BAR) is really > confusing for those who don't really get how kconfig tristate arithmetics > work. > > To solve this and hide this weird expression and to avoid repetition > across the tree, we introduce new keyword "uses" to the Kconfig options > family. > > uses BAR: > Equivalent to: depends on symbol || !symbol > Semantically it means, if FOO is enabled (y/m) and has the option: > uses BAR, make sure it can reach/use BAR when possible. > > For example: if FOO=y and BAR=m, FOO will be forced to m. > > [1] https://lore.kernel.org/linux-doc/20200302062340.21453-1-masahiroy@kernel.org/ > > Link: https://lkml.org/lkml/2020/4/8/839 > Signed-off-by: Saeed Mahameed > Cc: Masahiro Yamada > Cc: linux-kbuild@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- I am not convinced with this patch. This patch adds another way to do the same thing. It is true that it _hides_ the problems, and makes the _surface_ cleaner at best, but the internal will be more complicated. (FOO || !FOO) is difficult to understand, but the behavior of "uses FOO" is as difficult to grasp. People would wonder, "what 'uses FOO' means?", then they would find the explanation in kconfig-language.rst: "Equivalent to: depends on symbol || !symbol Semantically it means, if FOO is enabled (y/m) and has the option: uses BAR, make sure it can reach/use BAR when possible." To understand this correctly, people must study the arithmetic of (symbol || !symbol) anyway. I do not want to extend Kconfig for the iffy syntax sugar. (symbol || !symbol) is horrible. But, I am also scared to see people would think 'uses symbol' is the right thing to do, and start using it liberally all over the place. -- Best Regards Masahiro Yamada