diff options
author | Avi Kivity <avi@qumranet.com> | 2008-04-24 12:08:06 +0300 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-24 14:50:17 +0300 |
commit | fc66f399640facca7e2e5f667fcfbf174724346b (patch) | |
tree | 43194021e42e2cfcd7ed3273e52a459a4774bf23 /kernel | |
parent | c55b2e3840702a89f75afa39c6d00c55b600cc1c (diff) |
kvm: external module: move compat div64_64 to .c file
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/external-module-compat.c | 29 | ||||
-rw-r--r-- | kernel/external-module-compat.h | 19 |
2 files changed, 30 insertions, 18 deletions
diff --git a/kernel/external-module-compat.c b/kernel/external-module-compat.c index 7b0b9833..1eca5fc0 100644 --- a/kernel/external-module-compat.c +++ b/kernel/external-module-compat.c @@ -77,3 +77,32 @@ int kvm_smp_call_function_single(int cpu, void (*func)(void *info), #define smp_call_function_single kvm_smp_call_function_single #endif + +/* div64_64 is fairly new */ +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21) + +#ifndef CONFIG_64BIT + +/* 64bit divisor, dividend and result. dynamic precision */ +uint64_t div64_64(uint64_t dividend, uint64_t divisor) +{ + uint32_t high, d; + + high = divisor >> 32; + if (high) { + unsigned int shift = fls(high); + + d = divisor >> shift; + dividend >>= shift; + } else + d = divisor; + + do_div(dividend, d); + + return dividend; +} + +#endif + +#endif + diff --git a/kernel/external-module-compat.h b/kernel/external-module-compat.h index acc7a036..8723ae3d 100644 --- a/kernel/external-module-compat.h +++ b/kernel/external-module-compat.h @@ -332,24 +332,7 @@ static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) #else -/* 64bit divisor, dividend and result. dynamic precision */ -static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) -{ - uint32_t high, d; - - high = divisor >> 32; - if (high) { - unsigned int shift = fls(high); - - d = divisor >> shift; - dividend >>= shift; - } else - d = divisor; - - do_div(dividend, d); - - return dividend; -} +uint64_t div64_64(uint64_t dividend, uint64_t divisor); #endif |