summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-13 19:16:44 +0900
committerTom Rini <trini@konsulko.com>2017-10-05 21:31:04 -0400
commit84570a0c111ac50372d51271eadc13ff5cbb1a54 (patch)
tree2f37525a13e110c0cfefee3c5e3031d293f8e124 /include/linux
parent3ea0520512089cffbe02b7d6eb645cdfddb09c5c (diff)
linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux
These macros are useful to avoid link error on 32-bit systems. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kernel.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 0b616713cc..87d2d9554d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -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