Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp428177pxb; Thu, 30 Sep 2021 09:00:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBxI8SPg+4egy72RclYW792aAh42mMB92QO6o0s5O0L5ibdKCe+6UPyG6mLQ5eACXX1Dio X-Received: by 2002:a17:906:ece1:: with SMTP id qt1mr7672970ejb.281.1633017603363; Thu, 30 Sep 2021 09:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633017603; cv=none; d=google.com; s=arc-20160816; b=L4LtmxR+xKrN5m3yEhONdqfRzjXGISgTEV4pZKIg2USxkfJZvYVgDTKqOzwHg9dBBJ W6FZF8DPrQw9ZksnHfHo6YluSkvBkwk3m0m13BThwjNXaUIWuIOFwlX5NF8GGd2PrYrX Ns/eXOChNdXJQ5rJgQuhqgyV8VPtmTwuycizP2aOuxxIBUfXT/kH7pWsmR7vmW8k0LWr Cj4wzi5yk14fuXOKQnLyf5yMsE5HVuU45+exnRAun6LuFeTdlwJkKJ13AhuT0E6uQ2I6 7itKD9FyLls7hCvGNf27ikUwwyCRZHb/Gu8mSVQWHhINfYRLJYtKPzyPpHI+5Fnr+9N4 eLiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=HDPLoXoGNQcs65rJ4UWxLusEVSEtUpLFnP1zCSXQuqg=; b=fqKEbiPZKqDmH1eoJqPfuJigPKEsllmJHb6GLD4BrscgnaGdtbLLE2Ru24TvaFX+u3 D2akIiWNvCbGhKuwsQQs2H31HPA+GkSqiZeViUQfy99h0aHxDBaJzFU6gRF1/EqZ6QLp 9YVPpP41pc7yCpwPRYkNsWfFi48gJ3tTWbKsC5DURa6r4S8vFsuaQ6yWggCfileqsT+u hZOeIB92RIWp/msoeDNoSPWJCPAXkyNdJCtw1tazBpnhQS59HpBLRroA4aNU8uWmaLGl j6KNsGTT3fmKyA+Yjlp/x9eAb9ffpRqZCVaixPs+ssDvVs3lkagHwdQ/nn6mfIjUr56+ EFvg== 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 g22si1445052edy.28.2021.09.30.08.59.39; Thu, 30 Sep 2021 09:00:03 -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 S1347172AbhI3P5d (ORCPT + 99 others); Thu, 30 Sep 2021 11:57:33 -0400 Received: from mga04.intel.com ([192.55.52.120]:58861 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347152AbhI3P5b (ORCPT ); Thu, 30 Sep 2021 11:57:31 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10123"; a="223329889" X-IronPort-AV: E=Sophos;i="5.85,336,1624345200"; d="scan'208";a="223329889" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 08:55:48 -0700 X-IronPort-AV: E=Sophos;i="5.85,336,1624345200"; d="scan'208";a="457485570" Received: from kjepstei-mobl.amr.corp.intel.com (HELO ldmartin-desk2) ([10.212.192.243]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 08:55:47 -0700 Date: Thu, 30 Sep 2021 08:55:47 -0700 From: Lucas De Marchi To: Masahiro Yamada Cc: intel-gfx , Daniel Vetter , dri-devel , Linux Kernel Mailing List Subject: Re: [PATCH v2 3/3] Move IS_CONFIG_NONZERO() to kconfig.h Message-ID: <20210930155547.rtz6pdae42gqvm6p@ldmartin-desk2> X-Patchwork-Hint: comment References: <20210929183357.1490204-1-lucas.demarchi@intel.com> <20210929183357.1490204-4-lucas.demarchi@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 11:01:36PM +0900, Masahiro Yamada wrote: >On Thu, Sep 30, 2021 at 3:34 AM Lucas De Marchi > wrote: >> >> The check for config value doesn't really belong to i915_utils.h - we >> are trying to eliminate that utils helper and share them when possible >> with other drivers and subsystems. >> >> Rationale for having such macro is in commit >> babaab2f4738 ("drm/i915: Encapsulate kconfig constant values inside boolean predicates") >> whereas later it is improved to not break the build if used with >> undefined configs. The caveat is detailed in the documentation: unlike >> IS_ENABLED(): it's not preprocessor-only logic so can't be used for >> things like `#if IS_CONFIG_NONZERO(...)` >> >> Signed-off-by: Lucas De Marchi > > >Hypothetical "it would be nice to have ..." is really unneeded. > > if (context && CONFIG_DRM_I915_FENCE_TIMEOUT > 0) > return >msecs_to_jiffies_timeout(CONFIG_DRM_I915_FENCE_TIMEOUT); > > >is enough, and much cleaner. > > > >This warning is shown only when a constant is used >together with '&&'. > >Most of IS_ACTIVE can go away. > >Given that, there are not many places where the IS_ACTIVE macro >is useful, even in the i915 driver. > >For a few sources of the warnings, >replacing it with != 0 or > 0 is just fine. humn... maybe. Let me do a conversion in that direction and see what is the outcome. My original intention was to make IS_ENABLED() even uglier to cover the int case, but after some tries it seems impossible to do on preprocessor context, so I thought maybe it would be ok as a separate one. > >Of course, such an ugly macro is not worth being moved to if we don't handle the undefined case and only worry about encapsulating it inside a boolean predicate, the macro would be very simple. Would that be worth having in kconfig.h maybe? thanks Lucas De Marchi