aboutsummaryrefslogtreecommitdiff
path: root/include/linux/kernel.h
AgeCommit message (Collapse)Author
2023-03-30include: kernel.h: port find_closest() from LinuxChris Packham
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>
2020-08-24include: kernel.h: define SSIZE_MAXHeinrich Schuchardt
Define SSIZE_MAX, the largest value fitting into a variable of type ssize_t. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-17common: Move ROUND() into kernel.hSimon Glass
Move this macro in with all the other rounding macros. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move check_member() to kernel.hSimon Glass
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>
2019-12-06include: kernel.h: include printk.hAKASHI Takahiro
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>
2019-11-04fdt: Add INT32_MAX to kernel.h for libfdtSimon Glass
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>
2018-12-29linux/kernel.h: import DIV_ROUND_CLOSEST_ULL from LinuxMasahiro Yamada
Copied from Linux v4.20-rc7. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-05Add UINT32_MAX and UINT64_MAXSimon Glass
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>
2018-01-10linux/kernel.h: Add ALIGN_DOWN macroMasahiro Yamada
Follow Linux commit ed067d4a859f ("linux/kernel.h: Add ALIGN_DOWN macro"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-05linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from LinuxMasahiro Yamada
These macros are useful to avoid link error on 32-bit systems. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2014-11-25Fix SIZE_MAX compiler warning when using stdint.hSimon Glass
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>
2014-11-23linux/kernel.h: sync min, max, min3, max3 macros with LinuxMasahiro Yamada
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>
2014-11-20linux/kernel.h: add typechecking to roundup macroMasahiro Yamada
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>
2014-11-20linux/kernel.h: import more macrosMasahiro Yamada
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>
2014-11-20include: move various macros to include/linux/kernel.hMasahiro Yamada
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>