Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38332cb9 authored by Segher Boessenkool's avatar Segher Boessenkool Committed by Thomas Gleixner
Browse files

time: prevent the loop in timespec_add_ns() from being optimised away



Since some architectures don't support __udivdi3().

Signed-off-by: default avatarSegher Boessenkool <segher@kernel.crashing.org>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent e48af19f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -174,6 +174,10 @@ static inline void timespec_add_ns(struct timespec *a, u64 ns)
{
	ns += a->tv_nsec;
	while(unlikely(ns >= NSEC_PER_SEC)) {
		/* The following asm() prevents the compiler from
		 * optimising this loop into a modulo operation.  */
		asm("" : "+r"(ns));

		ns -= NSEC_PER_SEC;
		a->tv_sec++;
	}