Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2004799ybz; Sat, 18 Apr 2020 13:11:13 -0700 (PDT) X-Google-Smtp-Source: APiQypIkvlYEE6943TxhoEddB5unp3bm+RoqxMi7T8H7yR28Gv0q/0IqmBkZB3PpGpIqkv5VsnoF X-Received: by 2002:a50:cf8a:: with SMTP id h10mr8561611edk.142.1587240672985; Sat, 18 Apr 2020 13:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587240672; cv=none; d=google.com; s=arc-20160816; b=atojeVJB8qu6npU1l1ctGj1Yg1yu1EhsfL8otG2Y6eGuUkF+U1PhAG3YKa6zgZZYjo Nb9ejl+7S/YoOk8k5m0hJA9d+BZ1KlEqIZ5JcS7ejRpV4vTdQ3J+3RmHOVbQnC/n8ggF qMCgqdYvHY6aV6cnSdvU9PsBhD4WdeayWg0tHLMdq4AZs1RGCMY5H1ggbdY3KNokIYVl EN6OLcQBzN7O79+2Pxk+SId6omvQBcEkcNyfuR8X8FIc6hk6SoDbMDUOKagNYFz4qlUZ SFMB+tqcWh2hXUkkvxuPhT3NQIOW1bKoi4K/upGEy3HYleWFp5PL/XN5NJlQMoRa4ill S3Ag== 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=FHGQZW3L61l0ht0FqMOh2lDbaq5P4UJ78OF0DaS8gXw=; b=H1bmCjTVILoUoscH5QMSaFOkA+S95w1HUIfdBEczqqLd26ncwRIBGlSQqxtwZ0PwkV BiYaLPmeOVXta9/db/KM5Uyk13yeToZAFgZAU0p7OA5SYvCRcnZ5gPYDyvzpCm+STESS Sy05HF0cOhbAZiLH0rbAPHLrOQd7wZTpQnFjy5kRARzIoK9bCCw6xrKUFhOGJWP1a9f8 42lWveQ6/XP+yLTd0CLybCOYrNRNHkYdQ2zQjmeTRPsh31RI3qsAZM5DhMnJfZRhM1s/ pNkk4Y+Q5jMeAwL2iarrZMk/r0NrEVBUHEvnJaLThssc7q0hnIhz7rxH/+mXrSmPL0+p lBZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=E90rOCko; 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 y3si15586958edy.397.2020.04.18.13.10.05; Sat, 18 Apr 2020 13:11:12 -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=E90rOCko; 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 S1728241AbgDRUI5 (ORCPT + 99 others); Sat, 18 Apr 2020 16:08:57 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:50151 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727927AbgDRUI5 (ORCPT ); Sat, 18 Apr 2020 16:08:57 -0400 Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 03IK8KnK027464; Sun, 19 Apr 2020 05:08:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 03IK8KnK027464 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587240501; bh=FHGQZW3L61l0ht0FqMOh2lDbaq5P4UJ78OF0DaS8gXw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=E90rOCkolc4VeNd0U16ZLeAyevVrnC0jfgTv/flP1QA6O5Xtu16KJ/yPoJSSWpIY/ NNoCDZD45SUBLY7346VKhAMDkrw4Tey3zmbXj49KOwBL+ZqWr1h1fwrIxp2J4d5ZHb LL0TrFEGuddsTVn+f5JECpUepekY/yXP9R2hK3qzR+iyZ6A++b4ZwrLX9tIOwAT2Fp Qv6mf9RSpzU7ROoCWZHAKuCZUUY/3ZPSuTXCuM9bGWFvQs/TplBdgsIc04TPy/3ZwE zMJ1dk8Bn3BOxzTuuYivVdS6VW11gceVDlvgowTKUCbfpOubgijJh1wxn6iHStEgDJ aXj+i0zaInSPA== X-Nifty-SrcIP: [209.85.222.50] Received: by mail-ua1-f50.google.com with SMTP id x18so2066557uap.8; Sat, 18 Apr 2020 13:08:20 -0700 (PDT) X-Gm-Message-State: AGi0PuY+cgyHgUSBaNhdKiPkB8EqL1a+z+Zldb2A8OtToDR5Yq6ONeYS /vw3Qb0Ol4M4dUJ4kKpxYr5IKTbuektTNpwQwkY= X-Received: by 2002:ab0:1166:: with SMTP id g38mr1810895uac.40.1587240499498; Sat, 18 Apr 2020 13:08:19 -0700 (PDT) MIME-Version: 1.0 References: <20200417011146.83973-1-saeedm@mellanox.com> In-Reply-To: From: Masahiro Yamada Date: Sun, 19 Apr 2020 05:07:43 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 1/2] Kconfig: Introduce "uses" keyword To: Nicolas Pitre Cc: Saeed Mahameed , Linux Kbuild mailing list , Arnd Bergmann , Jason Gunthorpe , 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 Sun, Apr 19, 2020 at 4:11 AM Nicolas Pitre wrote: > > On Sun, 19 Apr 2020, Masahiro Yamada wrote: > > > (FOO || !FOO) is difficult to understand, but > > the behavior of "uses FOO" is as difficult to grasp. > > Can't this be expressed as the following instead: > > depends on FOO if FOO > > That would be a little clearer. > > > Nicolas 'depends on' does not take the 'if ' 'depends on A if B' is the syntax sugar of 'depends on (A || !B), right ? I do not know how clearer it would make things. depends on (m || FOO != m) is another equivalent, but we are always talking about a matter of expression. How important is it to stick to depends on (FOO || !FOO) or its equivalents? If a driver wants to use the feature FOO in most usecases, 'depends on FOO' is sensible. If FOO is just optional, you can get rid of the dependency, and IS_REACHABLE() will do logically correct things. I do not think IS_REACHABLE() is too bad, but if it is confusing, we can add one more option to make it explicit. config DRIVER_X tristate "driver x" config DRIVER_X_USES_FOO bool "use FOO from driver X" depends on DRIVER_X depends on DRIVER_X <= FOO help DRIVER_X works without FOO, but Using FOO will provide better usability. Say Y if you want to make driver X use FOO. Of course, if (IS_ENABLED(CONFIG_DRIVER_X_USES_FOO)) foo_init(); works like if (IS_REACHABLE(CONFIG_FOO)) foo_init(); At lease, it will eliminate a question like "I loaded the module FOO, I swear. But my built-in driver X still would not use FOO, why?" -- Best Regards Masahiro Yamada