summaryrefslogtreecommitdiff
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-12-28 22:00:24 -0500
committerTom Rini <trini@konsulko.com>2018-12-28 22:00:24 -0500
commit9735326fff8488663e27350917ccf01f2e71730a (patch)
treeb9ddf50bc81aec6f8223e244f9ccb22d4639cf6e /include/linux/kernel.h
parentbea3d826203f90507ff32ed24bd0a3c53479e55c (diff)
parent2001a81cba9554ee8b7f6d2ecd53510640ce4f35 (diff)
Merge branch 'master' of git://git.denx.de/u-boot-uniphier
Please pull UniPhier updates v2019.01 - import DIV_ROUND_CLOSEST_ULL macro from Linux - import improvement and fix of Denali NAND driver from Linux - add NAND 200MHz clock to clk driver - allow CONFIG_BOOTCOMMAND to run custom boot command/script - sync DT with Linux 4.20
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index bd88483b9f6..a85c15d8dc2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -102,6 +102,18 @@
(((__x) - ((__d) / 2)) / (__d)); \
} \
)
+/*
+ * Same as above but for u64 dividends. divisor must be a 32-bit
+ * number.
+ */
+#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \
+{ \
+ typeof(divisor) __d = divisor; \
+ unsigned long long _tmp = (x) + (__d) / 2; \
+ do_div(_tmp, __d); \
+ _tmp; \
+} \
+)
/*
* Multiplies an integer by a fraction, while avoiding unnecessary