Commit 5a4e1a795d7c5b47e94067a72db09f8cfb52bcff
1 parent
56968d0c1a
Exists in
master
and in
20 other branches
uwb: clean up whci_wait_for() timeout error message
All callers of whci_wait_for() should get consistant error message if a timeout occurs. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Showing 2 changed files with 8 additions and 32 deletions Side-by-side Diff
drivers/uwb/whc-rc.c
... | ... | @@ -332,47 +332,23 @@ |
332 | 332 | static int whcrc_start_rc(struct uwb_rc *rc) |
333 | 333 | { |
334 | 334 | struct whcrc *whcrc = rc->priv; |
335 | - int result = 0; | |
336 | 335 | struct device *dev = &whcrc->umc_dev->dev; |
337 | - unsigned long start, duration; | |
338 | 336 | |
339 | 337 | /* Reset the thing */ |
340 | 338 | le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD); |
341 | - if (d_test(3)) | |
342 | - start = jiffies; | |
343 | 339 | if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0, |
344 | - 5000, "device to reset at init") < 0) { | |
345 | - result = -EBUSY; | |
346 | - goto error; | |
347 | - } else if (d_test(3)) { | |
348 | - duration = jiffies - start; | |
349 | - if (duration > msecs_to_jiffies(40)) | |
350 | - dev_err(dev, "Device took %ums to " | |
351 | - "reset. MAX expected: 40ms\n", | |
352 | - jiffies_to_msecs(duration)); | |
353 | - } | |
340 | + 5000, "hardware reset") < 0) | |
341 | + return -EBUSY; | |
354 | 342 | |
355 | 343 | /* Set the event buffer, start the controller (enable IRQs later) */ |
356 | 344 | le_writel(0, whcrc->rc_base + URCINTR); |
357 | 345 | le_writel(URCCMD_RS, whcrc->rc_base + URCCMD); |
358 | - result = -ETIMEDOUT; | |
359 | - if (d_test(3)) | |
360 | - start = jiffies; | |
361 | 346 | if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0, |
362 | - 5000, "device to start") < 0) | |
363 | - goto error; | |
364 | - if (d_test(3)) { | |
365 | - duration = jiffies - start; | |
366 | - if (duration > msecs_to_jiffies(40)) | |
367 | - dev_err(dev, "Device took %ums to start. " | |
368 | - "MAX expected: 40ms\n", | |
369 | - jiffies_to_msecs(duration)); | |
370 | - } | |
347 | + 5000, "radio controller start") < 0) | |
348 | + return -ETIMEDOUT; | |
371 | 349 | whcrc_enable_events(whcrc); |
372 | - result = 0; | |
373 | 350 | le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR); |
374 | -error: | |
375 | - return result; | |
351 | + return 0; | |
376 | 352 | } |
377 | 353 | |
378 | 354 | |
... | ... | @@ -394,7 +370,7 @@ |
394 | 370 | |
395 | 371 | le_writel(0, whcrc->rc_base + URCCMD); |
396 | 372 | whci_wait_for(&umc_dev->dev, whcrc->rc_base + URCSTS, |
397 | - URCSTS_HALTED, URCSTS_HALTED, 100, "URCSTS.HALTED"); | |
373 | + URCSTS_HALTED, URCSTS_HALTED, 100, "radio controller stop"); | |
398 | 374 | } |
399 | 375 | |
400 | 376 | static void whcrc_init(struct whcrc *whcrc) |
drivers/uwb/whci.c
... | ... | @@ -67,11 +67,11 @@ |
67 | 67 | val = le_readl(reg); |
68 | 68 | if ((val & mask) == result) |
69 | 69 | break; |
70 | - msleep(10); | |
71 | 70 | if (t >= max_ms) { |
72 | - dev_err(dev, "timed out waiting for %s ", tag); | |
71 | + dev_err(dev, "%s timed out\n", tag); | |
73 | 72 | return -ETIMEDOUT; |
74 | 73 | } |
74 | + msleep(10); | |
75 | 75 | t += 10; |
76 | 76 | } |
77 | 77 | return 0; |