summaryrefslogtreecommitdiff
path: root/include/linux/kernel.h
Commit message (Collapse)AuthorAgeFilesLines
* include: move panic() prototype to <printk.h>Ahmad Fatoum2022-10-051-2/+0
| | | | | | | | | | | | The panic declaration in <linux/kernel.h> is out of place and unexpected as it's not a Linux kernel. printf() and printk() are defined in <printk.h>, so move it there too. Most files making use of panic(), pull it in via <common.h>, so we only need to adjust two headers for the new location. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220930154247.756577-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: move ARRAY_AND_SIZE to <linux/kernel.h>Ahmad Fatoum2021-11-011-0/+1
| | | | | | | | | | Linux defines this macro at multiple places. We define it once, but in <common.h>, which is a bit heavy weight. Move it next to the ARRAY_SIZE() definition. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141739.2207431-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: include <linux/math64.h> wrapper instead of <asm-generic/div64.h>Ahmad Fatoum2021-02-191-1/+1
| | | | | | | | | | | <asm-generic/div64.h> isn't meant for direct usage as <asm/div64.h> may override this on a per-architecture basis. We don't do that currently, but in the future we might. Include the <linux/math64.h> instead. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add _RET_IP_ macroSascha Hauer2020-09-181-0/+2
| | | | | | Use in KAsan code, so added for barebox Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: linux/kernel.h: port DIV_ROUND_CLOSEST_ULL definitionAhmad Fatoum2020-04-151-0/+13
| | | | | | | | We already have DIV_ROUND_CLOSEST, but no DIV_ROUND_CLOSEST_ULL. Import the latter for use by later commits. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: split *_MAX and *_MIN macros into <linux/limits.h>Masahiro Yamada2019-03-211-27/+2
| | | | | | | | | | | | | | | | | | Copy include/linux/limits.h from Linux 5.1-rc1 (removing #include <uapi/linux/limits.h>). While we are here, add SPDX License tag to <linux/kernel.h>. Based on the following Linux commits: - 54d50897d544 ("linux/kernel.h: split *_MAX and *_MIN macros into <linux/limits.h>") - 2dc0e68d5ada ("linux/kernel.h: use 'short' to define USHRT_MAX, SHRT_MAX, SHRT_MIN") Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: Import min_not_zero() macro from LinuxAndrey Smirnov2019-02-181-0/+10
| | | | | | | Import min_not_zero() macro from Linux used by some kernel code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add divider_recalc_rate helperLucas Stach2019-01-151-0/+5
| | | | | | | | Closer to Linux kernel implementation and needed for imx8mq composite clock. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Port kstrtox.c from Linux kernelAndrey Smirnov2018-10-291-0/+95
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: move ALIGN_DOWN() to include/linux/kernel.hMasahiro Yamada2018-01-051-0/+1
| | | | | | | | | | Linux commit ed067d4a859f ("linux/kernel.h: Add ALIGN_DOWN macro") moved ALIGN_DOWN to include/linux/kernel.h. Let's do likewise. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: implement simple_strtollSascha Hauer2017-04-111-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add hex2bin and bin2hex implementationsSascha Hauer2015-03-131-0/+4
| | | | | | | Taken from the Kernel, put into the same place as in the kernel, although the hexdump.c does not actually contain hexdum functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: Add gcd() functionAndrey Panov2015-03-051-0/+5
| | | | | | | It calculates greatest common divisor. Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: move some macros and prototypesMasahiro Yamada2015-01-291-0/+61
| | | | | | | | | | The include/common.h is still cluttered (although much better than U-Boot). It contains various utility macros that originates in Linux. Move them to the original place, include/linux/kernel.h, to slim down include/common.h. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: add more *_MAX, *_MIN macrosMasahiro Yamada2015-01-211-0/+14
| | | | | | | Imported from Linux 3.19-rc5. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: rename USHORT_MAX, SHORT_MAX, SHORT_MINMasahiro Yamada2015-01-211-3/+3
| | | | | | | | Linux uses SHRT_* instead of SHORT_*. The <limits.h> of C does the same. Let's follow this standard. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* linux/kernel.h: move *_MAX, *_MIN macrosMasahiro Yamada2015-01-211-0/+13
| | | | | | | | | | | Linux defines *_MAX, *_MIN macros in include/linux/kernel.h. Let's follow this way to slim down the common.h. This change should have no impact because include/common.h already includes <linux/kernel.h>. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb-host'Sascha Hauer2014-08-071-0/+18
|\ | | | | | | | | Conflicts: drivers/usb/core/Makefile
| * USB: EHCI: use min3 from LinuxSebastian Hesselbarth2014-07-281-0/+18
| | | | | | | | | | | | | | | | | | EHCI HCD has a private version of min3() determining the smallest number out of 3. We already have min()/max() imported from Linux, also get min3()/max3() and use it instead of EHCI's private one. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2014-08-071-0/+13
|\ \ | | | | | | | | | | | | Conflicts: lib/Makefile
| * | include: Add round_up/round_down macros from kernelSascha Hauer2014-07-171-0/+13
| |/ | | | | | | | | | | | | | | | | Yes, we already have roundup/rounddown. Unlike these macros round_up/round_down are optimized to (and only work with) power-of-2 arguments. It's a poor name, but kernel code needs it, so add it to barebox aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add hex_byte_pack and hex_byte_pack_upper from kernelSascha Hauer2014-07-111-1/+22
|/ | | | | | Utility functions needed by the UUID/GUID printf support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: reimport UBI from Linux v3.10Sascha Hauer2013-07-251-0/+12
| | | | | | | | | | | This is a fresh UBI import from Linux v3.10 This is done mainly to get fastmap support. This was tested with the i.MX nand driver, the MXS nand driver and on CFI NOR flash. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add roundup and rounddown supportJean-Christophe PLAGNIOL-VILLARD2012-11-151-0/+15
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename U-Boot-v2 project to bareboxSascha Hauer2009-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This has been done with the following script: find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \ -e 's/u2boot/barebox/g' \ -e 's/U2Boot/barebox/g' \ -e 's/U-boot V2/barebox/g' \ -e 's/u-boot v2/barebox/g' \ -e 's/U-Boot V2/barebox/g' \ -e 's/U-Boot-v2/barebox/g' \ -e 's/U_BOOT/BAREBOX/g' \ -e 's/UBOOT/BAREBOX/g' \ -e 's/uboot/barebox/g' \ -e 's/u-boot/barebox/g' \ -e 's/u_boot/barebox/g' \ -e 's/U-Boot/barebox/g' \ -e 's/U-boot/barebox/g' \ -e 's/U-BOOT/barebox/g' find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \ xargs -0 -r rename 's/u[-_]?boot/barebox/' It needs some manual fixup following in the next patch Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add include/linux/kernel.hSascha Hauer2008-08-131-0/+94
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>