[amazon] Add some build fixes for kernel 2.6.21 and the infineon amazon target.
[openwrt-10.03/.git] / target / linux / generic-2.6 / patches-2.6.21 / 32-time_fix_timespec_add_ns.patch
1 time: prevent the loop in timespec_add_ns() from being optimised away
2
3 Since some architectures don't support __udivdi3().
4
5 --- a/include/linux/time.h
6 +++ b/include/linux/time.h
7 @@ -170,6 +170,10 @@ static inline void timespec_add_ns(struc
8  {
9         ns += a->tv_nsec;
10         while(unlikely(ns >= NSEC_PER_SEC)) {
11 +               /* The following asm() prevents the compiler from
12 +                * optimising this loop into a modulo operation.  */
13 +               asm("" : "+r"(ns));
14 +
15                 ns -= NSEC_PER_SEC;
16                 a->tv_sec++;
17         }