remove useless xorg macros patch
[openwrt/svn-archive/archive.git] / utils / lcd4linux / patches / 110-udelay.patch
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
5 @@ -134,28 +134,11 @@
6 #include <stdio.h>
7
8
9 -#ifdef USE_OLD_UDELAY
10 -
11 -#include <time.h>
12 -
13 -#else
14 -
15 -#include <math.h>
16 -#include <unistd.h>
17 -#include <fcntl.h>
18 -#include <errno.h>
19 -#include <string.h>
20 -#include <sys/time.h>
21 -
22 -#ifdef HAVE_ASM_MSR_H
23 -#include <asm/msr.h>
24 -#endif
25 -
26 -#endif
27 -
28 -
29 #include "debug.h"
30 #include "udelay.h"
31 +
32 +#include <time.h>
33 +#include <errno.h>
34
35 #ifdef USE_OLD_UDELAY
36
37 @@ -163,16 +146,30 @@
38
39 void ndelay(const unsigned long nsec)
40 {
41 +#if 0
42 unsigned long loop = (nsec * loops_per_usec + 999) / 1000;
43
44 __asm__(".align 16\n" "1:\tdecl %0\n" "\tjne 1b": /* no result */
45 :"a"(loop));
46 +#endif
47 + struct timespec val;
48 + struct timespec rem;
49 + int ret;
50 +
51 + val.tv_sec = 0;
52 + val.tv_nsec = nsec;
53 +
54 + do {
55 + ret = nanosleep(&val, &rem);
56 + val = rem;
57 + } while ((ret == -1) && (errno == EINTR));
58 }
59
60 /* adopted from /usr/src/linux/init/main.c */
61
62 void udelay_calibrate(void)
63 {
64 +#if 0
65 clock_t tick;
66 unsigned long bit;
67
68 @@ -197,12 +194,13 @@
69 if (clock() > tick)
70 loops_per_usec &= ~bit;
71 }
72 +#endif
73 }
74
75 #else
76
77 static unsigned int ticks_per_usec = 0;
78 -
79 +#if 0
80 static void getCPUinfo(int *hasTSC, double *MHz)
81 {
82 int fd;
83 @@ -249,10 +247,11 @@
84 }
85
86 }
87 -
88 +#endif
89
90 void udelay_init(void)
91 {
92 +#if 0
93 #ifdef HAVE_ASM_MSR_H
94
95 int tsc;
96 @@ -274,12 +273,13 @@
97 ticks_per_usec = 0;
98 info("udelay: using gettimeofday() delay loop");
99 }
100 +#endif
101 }
102
103
104 void ndelay(const unsigned long nsec)
105 {
106 -
107 +#if 0
108 #ifdef HAVE_ASM_MSR_H
109
110 if (ticks_per_usec) {
111 @@ -313,6 +313,20 @@
112 gettimeofday(&now, NULL);
113 } while (now.tv_sec == end.tv_sec ? now.tv_usec < end.tv_usec : now.tv_sec < end.tv_sec);
114 }
115 +#endif
116 +
117 + struct timespec val;
118 + struct timespec rem;
119 + int ret;
120 +
121 + val.tv_sec = 0;
122 + val.tv_nsec = nsec;
123 +
124 + do {
125 + ret = nanosleep(&val, &rem);
126 + val = rem;
127 + } while ((ret == -1) && (errno == EINTR));
128 +
129 }
130
131 #endif
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
136 @@ -72,12 +72,14 @@
137 #ifndef _UDELAY_H_
138 #define _UDELAY_H_
139
140 +#if 0
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)
144 {
145 __asm__ __volatile__("rep; nop");
146 }
147 +#endif
148
149
150 #ifdef USE_OLD_UDELAY