LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] Move IS_CONFIG_NONZERO() to kconfig.h
Date: Thu, 30 Sep 2021 23:01:36 +0900	[thread overview]
Message-ID: <CAK7LNAQ765CBjg83Kpt8XdOjqPw8Xuv--_bcTvd3udZ=tsgMdA@mail.gmail.com> (raw)
In-Reply-To: <20210929183357.1490204-4-lucas.demarchi@intel.com>

On Thu, Sep 30, 2021 at 3:34 AM Lucas De Marchi
<lucas.demarchi@intel.com> 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 <lucas.demarchi@intel.com>


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 <linux/kconfig.h>




-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2021-09-30 14:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 18:33 [PATCH v2 0/3] Rename IS_ACTIVE() and move " Lucas De Marchi
2021-09-29 18:33 ` [PATCH v2 1/3] drm/i915: rename IS_ACTIVE Lucas De Marchi
2021-09-30 10:46   ` Jani Nikula
2021-09-30 15:47     ` Lucas De Marchi
2021-09-29 18:33 ` [PATCH v2 2/3] drm/i915/utils: do not depend on config being defined Lucas De Marchi
2021-09-29 21:08   ` Andrzej Hajda
2021-09-29 22:54     ` Lucas De Marchi
2021-09-30  7:01       ` Andrzej Hajda
2021-09-30 10:00   ` Steven Price
2021-09-30 15:43     ` Lucas De Marchi
2021-09-29 18:33 ` [PATCH v2 3/3] Move IS_CONFIG_NONZERO() to kconfig.h Lucas De Marchi
2021-09-30 14:01   ` Masahiro Yamada [this message]
2021-09-30 15:55     ` Lucas De Marchi
2021-10-01  2:33       ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK7LNAQ765CBjg83Kpt8XdOjqPw8Xuv--_bcTvd3udZ=tsgMdA@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --subject='Re: [PATCH v2 3/3] Move IS_CONFIG_NONZERO() to kconfig.h' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).