Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3395536ybz; Mon, 20 Apr 2020 01:46:08 -0700 (PDT) X-Google-Smtp-Source: APiQypKGmPC9jrsFjULF62Z1ote2TqlYtdSHSeHeN3F8BMLQ/y/rp44FnORB63C0VJPYwOMXljLP X-Received: by 2002:a17:906:8501:: with SMTP id i1mr13935856ejx.203.1587372367813; Mon, 20 Apr 2020 01:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587372367; cv=none; d=google.com; s=arc-20160816; b=WsFTNAPV4qV4Buvu1BEtnrbjng7HWmYn0eCCwaT1CMmOIxbNM18nBbZuQgshB0ERPl 3/+H1bVggb+4NXibW6jQ3RLh85dJ5zH4BrCtGCZArifR4o5tl+o7Sb4qF97iwS01+dOY 5f5aBTezdbRH/4LZUl19zdjKOhDuxKr1XVRs6YoQYYponPQiD1dX78pvkO5XF0T/hzv7 RVA/B1nQPVfFBHaZ6yRRire4/cNg/ivqVpNtzvNtJBflHnGg7qTfRn/KDjh0o/dVh0kV SBk3ErfEZz+5JIgPQ/8BurOE9WUO73CfztHjojP7mAWheyXBN+qCQEQs+M3aAB6hU25r hNvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=Qzz2mSyfMneTAR3nANG///Qqz/24Hh9WiM4zrvGsAVk=; b=mwsCI4X3B+8f6MA44q4gQ8l0OyLiuA8C4LPDMp4lqkKaiDXyBPQo9KYRGDgXTMXN7F zdiexxoq8sJWEKxH7KkwDYR4tuSXI/42DEK/xzjm77oIxadWNtgS/4UODpX3rtX529zz kUHxVaHkhB7qwFni9v/aVVxog9rpG3lsTWe5UrbNBDGm9SlvpkDe88C87cPjbpobmy/n 9EDGcMENqUVB0L9QiMjbmAn+S9hmlfR1nES6vHYELPHpo13DYav8i1iG836aI5YZC/xC dvDee8m/p1ujsYklWH6HY+HwTldZB4lhuhpsYRM3yv7ybhHY3j4ASqU8Pi46U52SNKtw WJug== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si113011eju.376.2020.04.20.01.45.44; Mon, 20 Apr 2020 01:46:07 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbgDTInZ (ORCPT + 99 others); Mon, 20 Apr 2020 04:43:25 -0400 Received: from mga06.intel.com ([134.134.136.31]:15992 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbgDTInX (ORCPT ); Mon, 20 Apr 2020 04:43:23 -0400 IronPort-SDR: h0lYUhWJZdooRot5/D6i4tHIo4pA1sefPqFOqsLqlRmss7ekuU4SBK/deZaIujNKTqkUgq+NPo aoWctAx2Ztpw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2020 01:43:21 -0700 IronPort-SDR: lSsNa/ish74j6oe4by+cDFOKlC8LCWgp3ExdSfVUMqp21bW54LB3nnX+4ZKKJBzmLXQYApaB8d IXoKfosg8Emg== X-IronPort-AV: E=Sophos;i="5.72,406,1580803200"; d="scan'208";a="429047884" Received: from iastakh-mobl.ccr.corp.intel.com (HELO localhost) ([10.252.63.229]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2020 01:43:16 -0700 From: Jani Nikula To: Masahiro Yamada , Nicolas Pitre Cc: Saeed Mahameed , Linux Kbuild mailing list , Arnd Bergmann , Jason Gunthorpe , 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 Subject: Re: [RFC PATCH 1/2] Kconfig: Introduce "uses" keyword In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200417011146.83973-1-saeedm@mellanox.com> Date: Mon, 20 Apr 2020 11:43:13 +0300 Message-ID: <87v9lu1ra6.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 19 Apr 2020, Masahiro Yamada wrote: > 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. If by logically correct you mean the kernel builds, you're right. However the proliferation of IS_REACHABLE() is making the kernel config *harder* to understand. User enables FOO=m and expects BAR to use it, however if BAR=y it silently gets ignored. I have and I will oppose adding IS_REACHABLE() usage to i915 because it's just silently accepting configurations that should be flagged and forbidden at kconfig stage. > 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?" Please let's not make that a more widespread problem than it already is. I have yet to hear *one* good rationale for allowing that in the first place. And if that pops up, you can make it work by using IS_REACHABLE() *without* the depends, simply by checking if the module is there. Most use cases increasingly solved by IS_REACHABLE() should use the "depends on FOO || FOO=n" construct, but the problem is that's not widely understood. I'd like to have another keyword for people to copy-paste into their Kconfigs. In another mail I suggested optionally depends on FOO might be a better alternative than "uses". BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center