X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Flinux%2Ftime.h;h=d32ef0ad4c0aaf8964d94abe215c5dbf4dde8aaf;hb=13c48c490208d9e70d8d66d56f96c5054db69af7;hp=2091a19f1655aab8e5130256f83af4103efa9e3f;hpb=b5eb9513f7c1bee862ada22bf1489f53752686bd;p=linux-2.6 diff --git a/include/linux/time.h b/include/linux/time.h index 2091a19f16..d32ef0ad4c 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -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++; }