diff options
author | Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> | 2008-02-19 17:09:59 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:40:48 -0400 |
commit | 8cf36d2bc5832da17a58c5f10adf2d92d138c992 (patch) | |
tree | 3b9f590fec3d328a93e519ffc8131fc737e2edc1 | |
parent | 325f86ec6d2ae4ab9879e745a92444f8bac20233 (diff) |
x86: coding style fixes to arch/x86/lib/string_32.c
The patch kills 45 errors and a few warnings.
The file is now error/warning free:
total: 0 errors, 0 warnings, 237 lines checked
arch/x86/lib/string_32.c has no obvious style problems and is ready for submission.
no code changed:
arch/x86/lib/string_32.o:
text data bss dec hex filename
639 0 0 639 27f string_32.o.before
639 0 0 639 27f string_32.o.after
md5:
2db1c48187cf5113bb595153ee1fc73d string_32.o.before.asm
2db1c48187cf5113bb595153ee1fc73d string_32.o.after.asm
Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/lib/string_32.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c index c2c0504a3071..94972e7c094d 100644 --- a/arch/x86/lib/string_32.c +++ b/arch/x86/lib/string_32.c | |||
@@ -14,25 +14,25 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | 15 | ||
16 | #ifdef __HAVE_ARCH_STRCPY | 16 | #ifdef __HAVE_ARCH_STRCPY |
17 | char *strcpy(char * dest,const char *src) | 17 | char *strcpy(char *dest, const char *src) |
18 | { | 18 | { |
19 | int d0, d1, d2; | 19 | int d0, d1, d2; |
20 | asm volatile( "1:\tlodsb\n\t" | 20 | asm volatile("1:\tlodsb\n\t" |
21 | "stosb\n\t" | 21 | "stosb\n\t" |
22 | "testb %%al,%%al\n\t" | 22 | "testb %%al,%%al\n\t" |
23 | "jne 1b" | 23 | "jne 1b" |
24 | : "=&S" (d0), "=&D" (d1), "=&a" (d2) | 24 | : "=&S" (d0), "=&D" (d1), "=&a" (d2) |
25 | :"0" (src),"1" (dest) : "memory"); | 25 | :"0" (src), "1" (dest) : "memory"); |
26 | return dest; | 26 | return dest; |
27 | } | 27 | } |
28 | EXPORT_SYMBOL(strcpy); | 28 | EXPORT_SYMBOL(strcpy); |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifdef __HAVE_ARCH_STRNCPY | 31 | #ifdef __HAVE_ARCH_STRNCPY |
32 | char *strncpy(char * dest,const char *src,size_t count) | 32 | char *strncpy(char *dest, const char *src, size_t count) |
33 | { | 33 | { |
34 | int d0, d1, d2, d3; | 34 | int d0, d1, d2, d3; |
35 | asm volatile( "1:\tdecl %2\n\t" | 35 | asm volatile("1:\tdecl %2\n\t" |
36 | "js 2f\n\t" | 36 | "js 2f\n\t" |
37 | "lodsb\n\t" | 37 | "lodsb\n\t" |
38 | "stosb\n\t" | 38 | "stosb\n\t" |
@@ -42,17 +42,17 @@ char *strncpy(char * dest,const char *src,size_t count) | |||
42 | "stosb\n" | 42 | "stosb\n" |
43 | "2:" | 43 | "2:" |
44 | : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3) | 44 | : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3) |
45 | :"0" (src),"1" (dest),"2" (count) : "memory"); | 45 | :"0" (src), "1" (dest), "2" (count) : "memory"); |
46 | return dest; | 46 | return dest; |
47 | } | 47 | } |
48 | EXPORT_SYMBOL(strncpy); | 48 | EXPORT_SYMBOL(strncpy); |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #ifdef __HAVE_ARCH_STRCAT | 51 | #ifdef __HAVE_ARCH_STRCAT |
52 | char *strcat(char * dest,const char * src) | 52 | char *strcat(char *dest, const char *src) |
53 | { | 53 | { |
54 | int d0, d1, d2, d3; | 54 | int d0, d1, d2, d3; |
55 | asm volatile( "repne\n\t" | 55 | asm volatile("repne\n\t" |
56 | "scasb\n\t" | 56 | "scasb\n\t" |
57 | "decl %1\n" | 57 | "decl %1\n" |
58 | "1:\tlodsb\n\t" | 58 | "1:\tlodsb\n\t" |
@@ -67,10 +67,10 @@ EXPORT_SYMBOL(strcat); | |||
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | #ifdef __HAVE_ARCH_STRNCAT | 69 | #ifdef __HAVE_ARCH_STRNCAT |
70 | char *strncat(char * dest,const char * src,size_t count) | 70 | char *strncat(char *dest, const char *src, size_t count) |
71 | { | 71 | { |
72 | int d0, d1, d2, d3; | 72 | int d0, d1, d2, d3; |
73 | asm volatile( "repne\n\t" | 73 | asm volatile("repne\n\t" |
74 | "scasb\n\t" | 74 | "scasb\n\t" |
75 | "decl %1\n\t" | 75 | "decl %1\n\t" |
76 | "movl %8,%3\n" | 76 | "movl %8,%3\n" |
@@ -83,7 +83,7 @@ char *strncat(char * dest,const char * src,size_t count) | |||
83 | "2:\txorl %2,%2\n\t" | 83 | "2:\txorl %2,%2\n\t" |
84 | "stosb" | 84 | "stosb" |
85 | : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3) | 85 | : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3) |
86 | : "0" (src),"1" (dest),"2" (0),"3" (0xffffffffu), "g" (count) | 86 | : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu), "g" (count) |
87 | : "memory"); | 87 | : "memory"); |
88 | return dest; | 88 | return dest; |
89 | } | 89 | } |
@@ -91,11 +91,11 @@ EXPORT_SYMBOL(strncat); | |||
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | #ifdef __HAVE_ARCH_STRCMP | 93 | #ifdef __HAVE_ARCH_STRCMP |
94 | int strcmp(const char * cs,const char * ct) | 94 | int strcmp(const char *cs, const char *ct) |
95 | { | 95 | { |
96 | int d0, d1; | 96 | int d0, d1; |
97 | int res; | 97 | int res; |
98 | asm volatile( "1:\tlodsb\n\t" | 98 | asm volatile("1:\tlodsb\n\t" |
99 | "scasb\n\t" | 99 | "scasb\n\t" |
100 | "jne 2f\n\t" | 100 | "jne 2f\n\t" |
101 | "testb %%al,%%al\n\t" | 101 | "testb %%al,%%al\n\t" |
@@ -106,7 +106,7 @@ int strcmp(const char * cs,const char * ct) | |||
106 | "orb $1,%%al\n" | 106 | "orb $1,%%al\n" |
107 | "3:" | 107 | "3:" |
108 | :"=a" (res), "=&S" (d0), "=&D" (d1) | 108 | :"=a" (res), "=&S" (d0), "=&D" (d1) |
109 | :"1" (cs),"2" (ct) | 109 | :"1" (cs), "2" (ct) |
110 | :"memory"); | 110 | :"memory"); |
111 | return res; | 111 | return res; |
112 | } | 112 | } |
@@ -114,11 +114,11 @@ EXPORT_SYMBOL(strcmp); | |||
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | #ifdef __HAVE_ARCH_STRNCMP | 116 | #ifdef __HAVE_ARCH_STRNCMP |
117 | int strncmp(const char * cs,const char * ct,size_t count) | 117 | int strncmp(const char *cs, const char *ct, size_t count) |
118 | { | 118 | { |
119 | int res; | 119 | int res; |
120 | int d0, d1, d2; | 120 | int d0, d1, d2; |
121 | asm volatile( "1:\tdecl %3\n\t" | 121 | asm volatile("1:\tdecl %3\n\t" |
122 | "js 2f\n\t" | 122 | "js 2f\n\t" |
123 | "lodsb\n\t" | 123 | "lodsb\n\t" |
124 | "scasb\n\t" | 124 | "scasb\n\t" |
@@ -131,7 +131,7 @@ int strncmp(const char * cs,const char * ct,size_t count) | |||
131 | "orb $1,%%al\n" | 131 | "orb $1,%%al\n" |
132 | "4:" | 132 | "4:" |
133 | :"=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2) | 133 | :"=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2) |
134 | :"1" (cs),"2" (ct),"3" (count) | 134 | :"1" (cs), "2" (ct), "3" (count) |
135 | :"memory"); | 135 | :"memory"); |
136 | return res; | 136 | return res; |
137 | } | 137 | } |
@@ -139,11 +139,11 @@ EXPORT_SYMBOL(strncmp); | |||
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | #ifdef __HAVE_ARCH_STRCHR | 141 | #ifdef __HAVE_ARCH_STRCHR |
142 | char *strchr(const char * s, int c) | 142 | char *strchr(const char *s, int c) |
143 | { | 143 | { |
144 | int d0; | 144 | int d0; |
145 | char * res; | 145 | char *res; |
146 | asm volatile( "movb %%al,%%ah\n" | 146 | asm volatile("movb %%al,%%ah\n" |
147 | "1:\tlodsb\n\t" | 147 | "1:\tlodsb\n\t" |
148 | "cmpb %%ah,%%al\n\t" | 148 | "cmpb %%ah,%%al\n\t" |
149 | "je 2f\n\t" | 149 | "je 2f\n\t" |
@@ -153,7 +153,7 @@ char *strchr(const char * s, int c) | |||
153 | "2:\tmovl %1,%0\n\t" | 153 | "2:\tmovl %1,%0\n\t" |
154 | "decl %0" | 154 | "decl %0" |
155 | :"=a" (res), "=&S" (d0) | 155 | :"=a" (res), "=&S" (d0) |
156 | :"1" (s),"0" (c) | 156 | :"1" (s), "0" (c) |
157 | :"memory"); | 157 | :"memory"); |
158 | return res; | 158 | return res; |
159 | } | 159 | } |
@@ -161,16 +161,16 @@ EXPORT_SYMBOL(strchr); | |||
161 | #endif | 161 | #endif |
162 | 162 | ||
163 | #ifdef __HAVE_ARCH_STRLEN | 163 | #ifdef __HAVE_ARCH_STRLEN |
164 | size_t strlen(const char * s) | 164 | size_t strlen(const char *s) |
165 | { | 165 | { |
166 | int d0; | 166 | int d0; |
167 | int res; | 167 | int res; |
168 | asm volatile( "repne\n\t" | 168 | asm volatile("repne\n\t" |
169 | "scasb\n\t" | 169 | "scasb\n\t" |
170 | "notl %0\n\t" | 170 | "notl %0\n\t" |
171 | "decl %0" | 171 | "decl %0" |
172 | :"=c" (res), "=&D" (d0) | 172 | :"=c" (res), "=&D" (d0) |
173 | :"1" (s),"a" (0), "0" (0xffffffffu) | 173 | :"1" (s), "a" (0), "0" (0xffffffffu) |
174 | :"memory"); | 174 | :"memory"); |
175 | return res; | 175 | return res; |
176 | } | 176 | } |
@@ -178,19 +178,19 @@ EXPORT_SYMBOL(strlen); | |||
178 | #endif | 178 | #endif |
179 | 179 | ||
180 | #ifdef __HAVE_ARCH_MEMCHR | 180 | #ifdef __HAVE_ARCH_MEMCHR |
181 | void *memchr(const void *cs,int c,size_t count) | 181 | void *memchr(const void *cs, int c, size_t count) |
182 | { | 182 | { |
183 | int d0; | 183 | int d0; |
184 | void *res; | 184 | void *res; |
185 | if (!count) | 185 | if (!count) |
186 | return NULL; | 186 | return NULL; |
187 | asm volatile( "repne\n\t" | 187 | asm volatile("repne\n\t" |
188 | "scasb\n\t" | 188 | "scasb\n\t" |
189 | "je 1f\n\t" | 189 | "je 1f\n\t" |
190 | "movl $1,%0\n" | 190 | "movl $1,%0\n" |
191 | "1:\tdecl %0" | 191 | "1:\tdecl %0" |
192 | :"=D" (res), "=&c" (d0) | 192 | :"=D" (res), "=&c" (d0) |
193 | :"a" (c),"0" (cs),"1" (count) | 193 | :"a" (c), "0" (cs), "1" (count) |
194 | :"memory"); | 194 | :"memory"); |
195 | return res; | 195 | return res; |
196 | } | 196 | } |
@@ -198,7 +198,7 @@ EXPORT_SYMBOL(memchr); | |||
198 | #endif | 198 | #endif |
199 | 199 | ||
200 | #ifdef __HAVE_ARCH_MEMSCAN | 200 | #ifdef __HAVE_ARCH_MEMSCAN |
201 | void *memscan(void * addr, int c, size_t size) | 201 | void *memscan(void *addr, int c, size_t size) |
202 | { | 202 | { |
203 | if (!size) | 203 | if (!size) |
204 | return addr; | 204 | return addr; |
@@ -219,7 +219,7 @@ size_t strnlen(const char *s, size_t count) | |||
219 | { | 219 | { |
220 | int d0; | 220 | int d0; |
221 | int res; | 221 | int res; |
222 | asm volatile( "movl %2,%0\n\t" | 222 | asm volatile("movl %2,%0\n\t" |
223 | "jmp 2f\n" | 223 | "jmp 2f\n" |
224 | "1:\tcmpb $0,(%0)\n\t" | 224 | "1:\tcmpb $0,(%0)\n\t" |
225 | "je 3f\n\t" | 225 | "je 3f\n\t" |
@@ -229,7 +229,7 @@ size_t strnlen(const char *s, size_t count) | |||
229 | "jne 1b\n" | 229 | "jne 1b\n" |
230 | "3:\tsubl %2,%0" | 230 | "3:\tsubl %2,%0" |
231 | :"=a" (res), "=&d" (d0) | 231 | :"=a" (res), "=&d" (d0) |
232 | :"c" (s),"1" (count) | 232 | :"c" (s), "1" (count) |
233 | :"memory"); | 233 | :"memory"); |
234 | return res; | 234 | return res; |
235 | } | 235 | } |