Age | Commit message (Collapse) | Author |
|
The find_closest() macro can be used to find an element in a sorted
array that is closest to an input value. Bring in this macro from
Linux v6.3-rc1-2-g8ca09d5fa354.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
|
|
Define SSIZE_MAX, the largest value fitting into a variable of type
ssize_t.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
|
Move this macro in with all the other rounding macros.
Signed-off-by: Simon Glass <sjg@chromium.org>
|
|
The kernel.h file has a number of useful macros including a few related
to structures. Move check_member() there too.
Signed-off-by: Simon Glass <sjg@chromium.org>
|
|
Adding "printk.h" will help improve portability from linux kernel
code (in my case, lib/asn1_decoder.c and others) where printf and
pr_* variant functions are used.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
|
Unfortunately libfdt needs this value now, which is present in the
stdint.h header. That file is just a placeholder in U-Boot and these sorts
of constants appear in the linux/kernel.h header instead.
To keep libfdt happy, add INT32_MAX too.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
|
|
Copied from Linux v4.20-rc7.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
These constants are defined by stdint.h but not by kernel.h, which is
its stand-in in U-Boot. Add the definitions so that libraries which expect
stdint.h constants can work.
Signed-off-by: Simon Glass <sjg@chromium.org>
|
|
Follow Linux commit ed067d4a859f ("linux/kernel.h: Add ALIGN_DOWN
macro").
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
These macros are useful to avoid link error on 32-bit systems.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
This new symbol may be defined by the compiler. If it is, avoid a compiler
warning when USE_STDINT is defined.
Signed-off-by: Simon Glass <sjg@chromium.org>
|
|
U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does. This commit gets min, max, min3, max3
macros synced with the kernel introducing type checks.
Many of references of those macros must be fixed to suppress warnings.
We have two options:
- Use min, max, min3, max3 only when the arguments have the same type
(or add casts to the arguments)
- Use min_t/max_t instead with the appropriate type for the first
argument
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Pavel Machek <pavel@denx.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
[trini: Fixup arch/blackfin/lib/string.c]
Signed-off-by: Tom Rini <trini@ti.com>
|
|
This commit replaces roundup macro with the one from Linux Kernel.
DEFINE_ALIGN_BUFFER must be fixed because typechecking can not
be used in this context.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
|
|
These macros seem to be useful for U-Boot too (or at least
harmless). Imported from Linux 3.18-rc2.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
|
|
U-Boot has imported various utility macros from Linux
scattering them to various places without consistency.
In include/common.h are min, max, min3, max3, ARRAY_SIZE, ALIGN,
container_of, DIV_ROUND_UP, etc.
In include/linux/compat.h are min_t, max_t, round_up, round_down,
etc.
We also have duplicated defines of min_t in some *.c files.
Moreover, we are suffering from too cluttered include/common.h.
This commit moves various macros that originate in
include/linux/kernel.h of Linux to their original position.
Note:
This commit simply moves the macros; the macros roundup,
min, max, min2, max3, ARRAY_SIZE are different
from those of Linux at this point.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
|