[PATCH 3/4] vdso: arm: use __iter_div_u64_rem() for 64-bit division

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some compilers, e.g. clang-8, can turn a loop back into a division
operation, which here results in a link failure:

arch/arm/kernel/vdso.o: In function `update_vsyscall':
vdso.c:(.text+0x1c4): undefined reference to `__aeabi_uldivmod'

The problem is already solved in the generic __iter_div_u64_rem()
function, so use that here.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
 arch/arm/kernel/vdso.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c
index 68930c90c504..32ad392e403b 100644
--- a/arch/arm/kernel/vdso.c
+++ b/arch/arm/kernel/vdso.c
@@ -328,11 +328,8 @@ void update_vsyscall(struct timekeeper *tk)
 	vdso_ts->sec		= tk->xtime_sec + tk->wall_to_monotonic.tv_sec;
 	nsec			= tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift;
 	nsec			= nsec + tk->wall_to_monotonic.tv_nsec;
-	while (nsec >= NSEC_PER_SEC) {
-		nsec = nsec - NSEC_PER_SEC;
-		vdso_ts->sec++;
-	}
-	vdso_ts->nsec		= nsec;
+
+	vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);
 
 	if (__tk_is_cntvct) {
 		vdso_data->clock_mode	= 0;
-- 
2.20.0




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux