1 Index: lcd4linux-0.10.0+cvs20051015.orig/udelay.c
2 ===================================================================
3 --- lcd4linux-0.10.0+cvs20051015.orig.orig/udelay.c 2007-07-07 14:02:55.000000000 +0200
4 +++ lcd4linux-0.10.0+cvs20051015.orig/udelay.c 2007-07-07 14:02:56.000000000 +0200
20 -#include <sys/time.h>
22 -#ifdef HAVE_ASM_MSR_H
39 void ndelay(const unsigned long nsec)
42 unsigned long loop = (nsec * loops_per_usec + 999) / 1000;
44 __asm__(".align 16\n" "1:\tdecl %0\n" "\tjne 1b": /* no result */
47 + struct timespec val;
48 + struct timespec rem;
55 + ret = nanosleep(&val, &rem);
57 + } while ((ret == -1) && (errno == EINTR));
60 /* adopted from /usr/src/linux/init/main.c */
62 void udelay_calibrate(void)
70 loops_per_usec &= ~bit;
77 static unsigned int ticks_per_usec = 0;
80 static void getCPUinfo(int *hasTSC, double *MHz)
90 void udelay_init(void)
98 info("udelay: using gettimeofday() delay loop");
104 void ndelay(const unsigned long nsec)
108 #ifdef HAVE_ASM_MSR_H
110 if (ticks_per_usec) {
112 gettimeofday(&now, NULL);
113 } while (now.tv_sec == end.tv_sec ? now.tv_usec < end.tv_usec : now.tv_sec < end.tv_sec);
117 + struct timespec val;
118 + struct timespec rem;
122 + val.tv_nsec = nsec;
125 + ret = nanosleep(&val, &rem);
127 + } while ((ret == -1) && (errno == EINTR));
132 Index: lcd4linux-0.10.0+cvs20051015.orig/udelay.h
133 ===================================================================
134 --- lcd4linux-0.10.0+cvs20051015.orig.orig/udelay.h 2007-07-07 14:02:56.000000000 +0200
135 +++ lcd4linux-0.10.0+cvs20051015.orig/udelay.h 2007-07-07 14:02:56.000000000 +0200
141 /* stolen from linux/asm-i386/processor.h */
142 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
143 static inline void rep_nop(void)
145 __asm__ __volatile__("rep; nop");
150 #ifdef USE_OLD_UDELAY