All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: "Pierre-Clément Tosi" <ptosi@google.com>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 4/9] linux/const.h: Upgrade & Merge vDSO and uAPI
Date: Wed, 16 Mar 2022 13:23:44 -0600	[thread overview]
Message-ID: <CAPnjgZ2cfk6ZerD7byQC1A-kzq044TwMEq0xCdwwknLpS8GZnQ@mail.gmail.com> (raw)
In-Reply-To: <20220316153948.197650-4-ptosi@google.com>

Hi Pierre-Clément,

On Wed, 16 Mar 2022 at 09:40, Pierre-Clément Tosi <ptosi@google.com> wrote:
>
> Import the header from version 5.16 of the kernel:
>
>     commit df0cc57e057f18e44dac8e6c18aba47ab53202f9
>
> Inline <vdso/const.h> and <uapi/linux/const.h>. This is wrapped in
> "#ifndef __UBOOT__/#include/#else/{inline}" to better document the
> origin of the code being added to the U-Boot header (but not present in
> the original header) and make diff tools happier when comparing the file
> with its reference, which should be useful when porting future changes
> from the Linux header and/or if we decide to also import those included
> headers into the U-Boot codebase.
>
> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>  include/linux/const.h | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/const.h b/include/linux/const.h
> index 379c889232..3e3803d767 100644
> --- a/include/linux/const.h
> +++ b/include/linux/const.h
> @@ -2,8 +2,13 @@
>  #ifndef _LINUX_CONST_H
>  #define _LINUX_CONST_H
>
> -/* const.h: Macros for dealing with constants.  */
> +#ifndef __UBOOT__
> +#include <vdso/const.h>
> +#else
>
> +#ifndef __UBOOT__
> +#include <uapi/linux/const.h>
> +#else
>  /* Some constant macros are used in both assembler and
>   * C code.  Therefore we cannot annotate them always with
>   * 'UL' and other type specifiers unilaterally.  We
> @@ -28,7 +33,22 @@
>  #define _BITUL(x)      (_UL(1) << (x))
>  #define _BITULL(x)     (_ULL(1) << (x))
>
> +#define __ALIGN_KERNEL(x, a)           __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
> +#define __ALIGN_KERNEL_MASK(x, mask)   (((x) + (mask)) & ~(mask))

How does this compare to the existing ALIGN()? It looks the same to me.

> +
> +#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> +#endif
> +
>  #define UL(x)          (_UL(x))
>  #define ULL(x)         (_ULL(x))
> +#endif
> +
> +/*
> + * This returns a constant expression while determining if an argument is
> + * a constant expression, most importantly without evaluating the argument.
> + * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de>
> + */
> +#define __is_constexpr(x) \
> +       (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
>
>  #endif /* _LINUX_CONST_H */
> --
> 2.35.1.723.g4982287a31-goog
>

REgards,
Simon

  reply	other threads:[~2022-03-16 19:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 15:39 [PATCH 1/9] net: gmac_rockchip: Fix misuse of GENMASK macro Pierre-Clément Tosi
2022-03-16 15:39 ` [PATCH 2/9] lib: crypt: Avoid redefining static_assert Pierre-Clément Tosi
2022-03-16 19:23   ` Simon Glass
2022-03-16 19:41     ` Steffen Jaeckel
2022-03-16 15:39 ` [PATCH 3/9] scripts: Makefile.lib: Pass __UBOOT__ to DTC's CPP Pierre-Clément Tosi
2022-03-16 19:23   ` Simon Glass
2022-03-17 10:42     ` Pierre-Clément Tosi
2022-03-16 15:39 ` [PATCH 4/9] linux/const.h: Upgrade & Merge vDSO and uAPI Pierre-Clément Tosi
2022-03-16 19:23   ` Simon Glass [this message]
2022-03-17 11:00     ` Pierre-Clément Tosi
2022-03-28  6:35       ` Simon Glass
2022-03-16 15:39 ` [PATCH 5/9] include: Import <linux/bits.h> & Update bitops.h Pierre-Clément Tosi
2022-03-16 19:23   ` Simon Glass
2022-03-16 15:39 ` [PATCH 6/9] include: Carve <linux/export.h> out of compat.h Pierre-Clément Tosi
2022-03-16 19:23   ` Simon Glass
2022-03-16 15:39 ` [PATCH 7/9] include: Upgrade <linux/typecheck.h> Pierre-Clément Tosi
2022-03-16 19:23   ` Simon Glass
2022-03-17 11:46     ` Pierre-Clément Tosi
2022-03-28  6:35       ` Simon Glass
2022-03-16 15:39 ` [PATCH 8/9] arm64: Import <asm/sysreg.h> from Linux Pierre-Clément Tosi
2022-03-16 15:39 ` [PATCH 9/9] arm64: Import <asm/esr.h> " Pierre-Clément Tosi
2022-03-16 19:47   ` Sean Anderson
2022-03-17 17:39     ` Pierre-Clément Tosi
2022-03-22 20:39       ` Sean Anderson
2022-03-17 19:13 ` [PATCH 1/9] net: gmac_rockchip: Fix misuse of GENMASK macro Ramon Fried
2022-04-06 15:08 ` Kever Yang
2022-04-07 12:28   ` David Wu

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=CAPnjgZ2cfk6ZerD7byQC1A-kzq044TwMEq0xCdwwknLpS8GZnQ@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=ptosi@google.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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.