Commit d0da23b0debcef135c866cc8117d197fb40a6079
Committed by
Linus Torvalds
1 parent
61b3d6c48f
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
lib/list_sort.c: convert to pr_foo
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Cc: Don Mullis <don.mullis@gmail.com> Cc: Dave Chinner <david@fromorbit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 21 additions and 28 deletions Side-by-side Diff
lib/list_sort.c
1 | + | |
2 | +#define pr_fmt(fmt) "list_sort_test: " fmt | |
3 | + | |
1 | 4 | #include <linux/kernel.h> |
2 | 5 | #include <linux/module.h> |
3 | 6 | #include <linux/list_sort.h> |
... | ... | @@ -125,9 +128,7 @@ |
125 | 128 | } |
126 | 129 | if (lev > max_lev) { |
127 | 130 | if (unlikely(lev >= ARRAY_SIZE(part)-1)) { |
128 | - printk_once(KERN_DEBUG "list passed to" | |
129 | - " list_sort() too long for" | |
130 | - " efficiency\n"); | |
131 | + printk_once(KERN_DEBUG "list too long for efficiency\n"); | |
131 | 132 | lev--; |
132 | 133 | } |
133 | 134 | max_lev = lev; |
134 | 135 | |
135 | 136 | |
136 | 137 | |
137 | 138 | |
... | ... | @@ -170,27 +171,25 @@ |
170 | 171 | static int __init check(struct debug_el *ela, struct debug_el *elb) |
171 | 172 | { |
172 | 173 | if (ela->serial >= TEST_LIST_LEN) { |
173 | - printk(KERN_ERR "list_sort_test: error: incorrect serial %d\n", | |
174 | - ela->serial); | |
174 | + pr_err("error: incorrect serial %d\n", ela->serial); | |
175 | 175 | return -EINVAL; |
176 | 176 | } |
177 | 177 | if (elb->serial >= TEST_LIST_LEN) { |
178 | - printk(KERN_ERR "list_sort_test: error: incorrect serial %d\n", | |
179 | - elb->serial); | |
178 | + pr_err("error: incorrect serial %d\n", elb->serial); | |
180 | 179 | return -EINVAL; |
181 | 180 | } |
182 | 181 | if (elts[ela->serial] != ela || elts[elb->serial] != elb) { |
183 | - printk(KERN_ERR "list_sort_test: error: phantom element\n"); | |
182 | + pr_err("error: phantom element\n"); | |
184 | 183 | return -EINVAL; |
185 | 184 | } |
186 | 185 | if (ela->poison1 != TEST_POISON1 || ela->poison2 != TEST_POISON2) { |
187 | - printk(KERN_ERR "list_sort_test: error: bad poison: %#x/%#x\n", | |
188 | - ela->poison1, ela->poison2); | |
186 | + pr_err("error: bad poison: %#x/%#x\n", | |
187 | + ela->poison1, ela->poison2); | |
189 | 188 | return -EINVAL; |
190 | 189 | } |
191 | 190 | if (elb->poison1 != TEST_POISON1 || elb->poison2 != TEST_POISON2) { |
192 | - printk(KERN_ERR "list_sort_test: error: bad poison: %#x/%#x\n", | |
193 | - elb->poison1, elb->poison2); | |
191 | + pr_err("error: bad poison: %#x/%#x\n", | |
192 | + elb->poison1, elb->poison2); | |
194 | 193 | return -EINVAL; |
195 | 194 | } |
196 | 195 | return 0; |
197 | 196 | |
198 | 197 | |
... | ... | @@ -214,20 +213,18 @@ |
214 | 213 | struct list_head *cur; |
215 | 214 | LIST_HEAD(head); |
216 | 215 | |
217 | - printk(KERN_DEBUG "list_sort_test: start testing list_sort()\n"); | |
216 | + pr_debug("start testing list_sort()\n"); | |
218 | 217 | |
219 | 218 | elts = kcalloc(TEST_LIST_LEN, sizeof(*elts), GFP_KERNEL); |
220 | 219 | if (!elts) { |
221 | - printk(KERN_ERR "list_sort_test: error: cannot allocate " | |
222 | - "memory\n"); | |
220 | + pr_err("error: cannot allocate memory\n"); | |
223 | 221 | return err; |
224 | 222 | } |
225 | 223 | |
226 | 224 | for (i = 0; i < TEST_LIST_LEN; i++) { |
227 | 225 | el = kmalloc(sizeof(*el), GFP_KERNEL); |
228 | 226 | if (!el) { |
229 | - printk(KERN_ERR "list_sort_test: error: cannot " | |
230 | - "allocate memory\n"); | |
227 | + pr_err("error: cannot allocate memory\n"); | |
231 | 228 | goto exit; |
232 | 229 | } |
233 | 230 | /* force some equivalencies */ |
234 | 231 | |
235 | 232 | |
236 | 233 | |
237 | 234 | |
238 | 235 | |
... | ... | @@ -247,42 +244,38 @@ |
247 | 244 | int cmp_result; |
248 | 245 | |
249 | 246 | if (cur->next->prev != cur) { |
250 | - printk(KERN_ERR "list_sort_test: error: list is " | |
251 | - "corrupted\n"); | |
247 | + pr_err("error: list is corrupted\n"); | |
252 | 248 | goto exit; |
253 | 249 | } |
254 | 250 | |
255 | 251 | cmp_result = cmp(NULL, cur, cur->next); |
256 | 252 | if (cmp_result > 0) { |
257 | - printk(KERN_ERR "list_sort_test: error: list is not " | |
258 | - "sorted\n"); | |
253 | + pr_err("error: list is not sorted\n"); | |
259 | 254 | goto exit; |
260 | 255 | } |
261 | 256 | |
262 | 257 | el = container_of(cur, struct debug_el, list); |
263 | 258 | el1 = container_of(cur->next, struct debug_el, list); |
264 | 259 | if (cmp_result == 0 && el->serial >= el1->serial) { |
265 | - printk(KERN_ERR "list_sort_test: error: order of " | |
266 | - "equivalent elements not preserved\n"); | |
260 | + pr_err("error: order of equivalent elements not " | |
261 | + "preserved\n"); | |
267 | 262 | goto exit; |
268 | 263 | } |
269 | 264 | |
270 | 265 | if (check(el, el1)) { |
271 | - printk(KERN_ERR "list_sort_test: error: element check " | |
272 | - "failed\n"); | |
266 | + pr_err("error: element check failed\n"); | |
273 | 267 | goto exit; |
274 | 268 | } |
275 | 269 | count++; |
276 | 270 | } |
277 | 271 | if (head.prev != cur) { |
278 | - printk(KERN_ERR "list_sort_test: error: list is corrupted\n"); | |
272 | + pr_err("error: list is corrupted\n"); | |
279 | 273 | goto exit; |
280 | 274 | } |
281 | 275 | |
282 | 276 | |
283 | 277 | if (count != TEST_LIST_LEN) { |
284 | - printk(KERN_ERR "list_sort_test: error: bad list length %d", | |
285 | - count); | |
278 | + pr_err("error: bad list length %d", count); | |
286 | 279 | goto exit; |
287 | 280 | } |
288 | 281 |