Re: [PATCH 1/2] linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 9, 2021 at 6:24 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Fri, Apr 9, 2021 at 12:00 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> 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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux