Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp334420pxb; Thu, 30 Sep 2021 07:06:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsG7tIl4FvTMY8SHn/Un+BhrOR2QPGrsZ5Iw5EiMdNcZXy8OIXl+n9XofTAICha2xX8efG X-Received: by 2002:a17:903:11cd:b0:13e:596c:d9a7 with SMTP id q13-20020a17090311cd00b0013e596cd9a7mr5657195plh.37.1633010813297; Thu, 30 Sep 2021 07:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633010813; cv=none; d=google.com; s=arc-20160816; b=nTnUmuW+rqw94YxK+jv23irxuJflB2dXvs+N5ry1may9K1f9Q4sF0ZVkz8EWm54kpP M+Y7EWIH/0ghlanCH51FCESjVMntEHhNMKq6XwkUvXPAIgJa400QMPIeSzVyOtjUNnjj BYBAN748R/21c2gAddbYD/FIDD/EiSoL3iKPwoiApHzXIIYCF4bhvlIaUrrja3sIHI4a M0g6HkwDro4JxnIJn4pzHatnXM/lwvmYsLzpZZvoF4bUWDcR01ae5HxM4PofMjGOeLvg p7smAUj4i0hc3LOx1unTBuhld87FOE8ybvQU36EdsXdc9K+9fIcDs68qHqwCkpIG0k68 f7rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=VuabDIbpmxk72sKuiRHg+TdNhDteCOPteADF+KS7huU=; b=ZhCqdFALJRph9gUWhvaJXYEM44vOL0ecfJDU57qRUI31XknvuHFyLrUzIVbZdIrYCO zTrm3qp/Xi/DD8rIFAqsg7p0hi5exuOvfaR02A0gZZbyj+HdppaAyuIx/oMITalVoJlV BAxvbGviTme8fa7cZqEe+SX2njt7HLqgTSwQWcTyz7Ea1+GcPaMYfmKRNeBekY2f7oCx Ob3ZuFNjUbnIfLidEGdYkMFHVTDdnP7tX4hfkFml2SC1R4ZiLBrE6U0e2bFaRnsWQx/9 dfC1SaH9eG/2PZqb46i0yqlIHYqaRFfkdJBj8CLxJKPpZayNA1TB6UEGQ/S7RQ/Zrbow 3Teg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LaLEN9K3; 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 e123si3567830pgc.455.2021.09.30.07.06.29; Thu, 30 Sep 2021 07:06:53 -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=LaLEN9K3; 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 S1351730AbhI3OEk (ORCPT + 99 others); Thu, 30 Sep 2021 10:04:40 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:22792 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351585AbhI3OE0 (ORCPT ); Thu, 30 Sep 2021 10:04:26 -0400 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 18UE2IWg018776 for ; Thu, 30 Sep 2021 23:02:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 18UE2IWg018776 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1633010539; bh=VuabDIbpmxk72sKuiRHg+TdNhDteCOPteADF+KS7huU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LaLEN9K3YWFe+G5xyw5VNkDs+JH6l+gbJ0YYW67ry2nMgMKObqPqZj3X3wA/bqBvL QT9QIZq1/BxU0lzAooFf3CtkWphG50xI8HVWMNpVXcv+xlxz+UnWLC0t8Z6FAUkPMf HJKLJRburriMu29+/XxlYM10uTSqQMfw3y1EA17LCXwxkRqdNvUOEeFowBIJDe+JrG Dyvs594T44BDdAaWptJJreXJOxeZf4OE9jnIrs9r9kcBsqqFAhBmCAVaokfxq2MoTi cj9Tg0aeSYudnZ4gViFn6SI/LgU/zEJOoK4NbwWETDzFv9ilsspgUqjMGUAjBhZwCw 8lNDPWE3p3sVw== X-Nifty-SrcIP: [209.85.167.45] Received: by mail-lf1-f45.google.com with SMTP id e15so25799868lfr.10 for ; Thu, 30 Sep 2021 07:02:18 -0700 (PDT) X-Gm-Message-State: AOAM533yVDMvG2RSmhwDS2cChpEIXRufhkNJc743W1CAwxaKta29EGMn 8wn4nghJDjulgX8RMwPzvQBS8/D/kEOn0yMfA40= X-Received: by 2002:ac2:4d57:: with SMTP id 23mr6154739lfp.493.1633010533423; Thu, 30 Sep 2021 07:02:13 -0700 (PDT) MIME-Version: 1.0 References: <20210929183357.1490204-1-lucas.demarchi@intel.com> <20210929183357.1490204-4-lucas.demarchi@intel.com> In-Reply-To: <20210929183357.1490204-4-lucas.demarchi@intel.com> From: Masahiro Yamada Date: Thu, 30 Sep 2021 23:01:36 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/3] Move IS_CONFIG_NONZERO() to kconfig.h To: Lucas De Marchi Cc: intel-gfx , Daniel Vetter , dri-devel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Of course, such an ugly macro is not worth being moved to -- Best Regards Masahiro Yamada