summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2015-11-02 19:02:46 +0100
committerNicolas Pitre <nicolas.pitre@linaro.org>2015-11-16 20:42:12 +0100
commitdce1eb93b19b2a1a441708f51c97c4a554054d00 (patch)
tree584554913e7eae7f3ab7686862fac8c59eaf0394 /lib
parent__div64_const32(): abstract out the actual 128-bit cross product code (diff)
downloadlinux-dce1eb93b19b2a1a441708f51c97c4a554054d00.tar.xz
linux-dce1eb93b19b2a1a441708f51c97c4a554054d00.zip
__div64_32(): make it overridable at compile time
Some architectures may want to override the default implementation at compile time to do things inline. For example, ARM uses a non-standard calling convention for better efficiency in this case. Signed-off-by: Nicolas Pitre <nico@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/div64.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/div64.c b/lib/div64.c
index 62a698a432bc..7f345259c32f 100644
--- a/lib/div64.c
+++ b/lib/div64.c
@@ -13,7 +13,8 @@
*
* Code generated for this function might be very inefficient
* for some CPUs. __div64_32() can be overridden by linking arch-specific
- * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S.
+ * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S
+ * or by defining a preprocessor macro in arch/include/asm/div64.h.
*/
#include <linux/export.h>
@@ -23,6 +24,7 @@
/* Not needed on 64bit architectures */
#if BITS_PER_LONG == 32
+#ifndef __div64_32
uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base)
{
uint64_t rem = *n;
@@ -55,8 +57,8 @@ uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base)
*n = res;
return rem;
}
-
EXPORT_SYMBOL(__div64_32);
+#endif
#ifndef div_s64_rem
s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)