Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

linux/math64.h: Extract common header for vDSO

The vDSO library should only include the necessary headers required for
a userspace library (UAPI and a minimal set of kernel headers). To make
this possible it is necessary to isolate from the kernel headers the
common parts that are strictly necessary to build the library.

Split math64.h into linux and common headers to make the latter suitable
for inclusion in the vDSO library.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200320145351.32292-10-vincenzo.frascino@arm.com

authored by

Vincenzo Frascino and committed by
Thomas Gleixner
b874b835 14ee2ac6

+25 -19
+1 -19
include/linux/math64.h
··· 3 3 #define _LINUX_MATH64_H 4 4 5 5 #include <linux/types.h> 6 + #include <vdso/math64.h> 6 7 #include <asm/div64.h> 7 8 8 9 #if BITS_PER_LONG == 64 ··· 142 141 #endif 143 142 144 143 u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder); 145 - 146 - static __always_inline u32 147 - __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) 148 - { 149 - u32 ret = 0; 150 - 151 - while (dividend >= divisor) { 152 - /* The following asm() prevents the compiler from 153 - optimising this loop into a modulo operation. */ 154 - asm("" : "+rm"(dividend)); 155 - 156 - dividend -= divisor; 157 - ret++; 158 - } 159 - 160 - *remainder = dividend; 161 - 162 - return ret; 163 - } 164 144 165 145 #ifndef mul_u32_u32 166 146 /*
+24
include/vdso/math64.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef __VDSO_MATH64_H 3 + #define __VDSO_MATH64_H 4 + 5 + static __always_inline u32 6 + __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) 7 + { 8 + u32 ret = 0; 9 + 10 + while (dividend >= divisor) { 11 + /* The following asm() prevents the compiler from 12 + optimising this loop into a modulo operation. */ 13 + asm("" : "+rm"(dividend)); 14 + 15 + dividend -= divisor; 16 + ret++; 17 + } 18 + 19 + *remainder = dividend; 20 + 21 + return ret; 22 + } 23 + 24 + #endif /* __VDSO_MATH64_H */