All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Paul Cercueil <paul@crapouillou.net>,
	Linus Walleij <linus.walleij@linaro.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mips@vger.kernel.org
Subject: Re: [PATCH 1/2] linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>
Date: Sat, 10 Apr 2021 12:52:32 +0900	[thread overview]
Message-ID: <CAK7LNATPWG883hydsfdJyULr9-ued3QR6M9q52XtVYQ81R5__Q@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VdZ67Tab2jOU0NSys_P1rU_GicJw_ADd1w9JY4rEG5g1w@mail.gmail.com>

On Fri, Apr 9, 2021 at 6:24 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Fri, Apr 9, 2021 at 12:00 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > <linux/kconfig.h> is included from all the kernel-space source files,
> > including C, assembly, linker scripts. It is intended to contain minimal
>
> a minimal
>
> > set of macros to evaluate CONFIG options.
> >
> > IF_ENABLED() is an intruder here because (x ? y : z) is C code, which
> > should not be included from assembly files or linker scripts.
> >
> > Also, <linux/kconfig.h> is no longer self-contained because NULL is
> > defined in <linux/stddef.h>.
> >
> > Move IF_ENABLED() out to <linux/kernel.h> as PTR_IF().
> >
> > PTR_IF(IS_ENABLED(CONFIG_FOO), ...) is slightly longer than
> > IF_ENABLED(CONFIG_FOO, ...), but it is not a big deal because
> > sub-systems often define dedicated macros such as of_match_ptr(),
> > pm_ptr() etc. for common use-cases.
>
> >  include/linux/kernel.h            |  2 ++
>
> Why kernel.h? Shouldn't it belong to a particular domain with a
> respective header file?
>
> Really what we have in the kernel.h right now is a complete train
> wreck of something.
> We have to define what exactly is kernel.h for?


<linux/kernel.h> contains random utility macros.

I did not find a good header to put it in otherwise.


>
> Arnd? Others? Shall we start a wider discussion on the topic?
>
> --
> With Best Regards,
> Andy Shevchenko


--
Best Regards
Masahiro Yamada

  reply	other threads:[~2021-04-10  3:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 20:58 [PATCH 0/2] linux/kconfig.h: move IF_ENABLED() out of <linux/kconfig.h> Masahiro Yamada
2021-04-08 20:58 ` [PATCH 1/2] linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h> Masahiro Yamada
2021-04-09  8:15   ` Paul Cercueil
2021-04-09  8:30     ` Masahiro Yamada
2021-04-09  9:38       ` Paul Cercueil
2021-04-09  9:24   ` Andy Shevchenko
2021-04-10  3:52     ` Masahiro Yamada [this message]
2021-04-08 20:58 ` [PATCH 2/2] pm: allow drivers to drop #ifdef and __maybe_unused from pm callbacks Masahiro Yamada
2021-04-08 21:29   ` Arnd Bergmann
2021-04-09  3:17     ` Masahiro Yamada
2021-04-08 23:49   ` kernel test robot
2021-04-08 23:49     ` kernel test robot
2021-04-08 23:55   ` kernel test robot
2021-04-08 23:55     ` kernel test robot

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=CAK7LNATPWG883hydsfdJyULr9-ued3QR6M9q52XtVYQ81R5__Q@mail.gmail.com \
    --to=masahiroy@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paul@crapouillou.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.