UPSTREAM: linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux

These macros are useful to avoid link error on 32-bit systems.

Change-Id: Id451c874a2a89e3ebff352e4c90d2d4d0613b9bc
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 84570a0c111ac50372d51271eadc13ff5cbb1a54)
This commit is contained in:
Masahiro Yamada 2017-09-13 19:16:44 +09:00 committed by Kever Yang
parent bcf5156aaa
commit 263b1d7d68
1 changed files with 5 additions and 0 deletions

View File

@ -57,6 +57,11 @@
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#define DIV_ROUND_DOWN_ULL(ll, d) \
({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; })
#define DIV_ROUND_UP_ULL(ll, d) DIV_ROUND_DOWN_ULL((ll) + (d) - 1, (d))
#if BITS_PER_LONG == 32
# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
#else