]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
add an inlined version of iter_div_u64_rem
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Thu, 12 Jun 2008 08:47:58 +0000 (10:47 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 12 Jun 2008 08:47:58 +0000 (10:47 +0200)
iter_div_u64_rem is used in the x86-64 vdso, which cannot call other
kernel code.  For this case, provide the always_inlined version,
__iter_div_u64_rem.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/math64.h
lib/div64.c

index 177785e1e4a36bb535b1a39655f7078c39f761a2..c87f1528703a68c2dd024d612a203ae4517b5cea 100644 (file)
@@ -83,4 +83,23 @@ static inline s64 div_s64(s64 dividend, s32 divisor)
 
 u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);
 
+static __always_inline u32
+__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
+{
+       u32 ret = 0;
+
+       while (dividend >= divisor) {
+               /* The following asm() prevents the compiler from
+                  optimising this loop into a modulo operation.  */
+               asm("" : "+rm"(dividend));
+
+               dividend -= divisor;
+               ret++;
+       }
+
+       *remainder = dividend;
+
+       return ret;
+}
+
 #endif /* _LINUX_MATH64_H */
index 76c01542d3e13101e6e300bb7c5d70ae7df8c86d..a111eb8de9cfeefb2bc82011ef580f970091bfcd 100644 (file)
@@ -105,19 +105,6 @@ EXPORT_SYMBOL(div64_u64);
  */
 u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
 {
-       u32 ret = 0;
-
-       while (dividend >= divisor) {
-               /* The following asm() prevents the compiler from
-                  optimising this loop into a modulo operation.  */
-               asm("" : "+rm"(dividend));
-
-               dividend -= divisor;
-               ret++;
-       }
-
-       *remainder = dividend;
-
-       return ret;
+       return __iter_div_u64_rem(dividend, divisor, remainder);
 }
 EXPORT_SYMBOL(iter_div_u64_rem);