aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/whc-rc.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-11-25 09:34:47 -0500
committerDavid Vrabel <david.vrabel@csr.com>2008-11-25 09:34:47 -0500
commit5a4e1a795d7c5b47e94067a72db09f8cfb52bcff (patch)
tree71fe74f4b652d346ffc1651b0a36015abed36541 /drivers/uwb/whc-rc.c
parent56968d0c1a920eb165c06318f5c458724e1df0af (diff)
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>
Diffstat (limited to 'drivers/uwb/whc-rc.c')
-rw-r--r--drivers/uwb/whc-rc.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/drivers/uwb/whc-rc.c b/drivers/uwb/whc-rc.c
index e0d66938ccd8..5f00386e26c7 100644
--- a/drivers/uwb/whc-rc.c
+++ b/drivers/uwb/whc-rc.c
@@ -332,47 +332,23 @@ void whcrc_release_rc_umc(struct whcrc *whcrc)
332static int whcrc_start_rc(struct uwb_rc *rc) 332static int whcrc_start_rc(struct uwb_rc *rc)
333{ 333{
334 struct whcrc *whcrc = rc->priv; 334 struct whcrc *whcrc = rc->priv;
335 int result = 0;
336 struct device *dev = &whcrc->umc_dev->dev; 335 struct device *dev = &whcrc->umc_dev->dev;
337 unsigned long start, duration;
338 336
339 /* Reset the thing */ 337 /* Reset the thing */
340 le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD); 338 le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD);
341 if (d_test(3))
342 start = jiffies;
343 if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0, 339 if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0,
344 5000, "device to reset at init") < 0) { 340 5000, "hardware reset") < 0)
345 result = -EBUSY; 341 return -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 }
354 342
355 /* Set the event buffer, start the controller (enable IRQs later) */ 343 /* Set the event buffer, start the controller (enable IRQs later) */
356 le_writel(0, whcrc->rc_base + URCINTR); 344 le_writel(0, whcrc->rc_base + URCINTR);
357 le_writel(URCCMD_RS, whcrc->rc_base + URCCMD); 345 le_writel(URCCMD_RS, whcrc->rc_base + URCCMD);
358 result = -ETIMEDOUT;
359 if (d_test(3))
360 start = jiffies;
361 if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0, 346 if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0,
362 5000, "device to start") < 0) 347 5000, "radio controller start") < 0)
363 goto error; 348 return -ETIMEDOUT;
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 }
371 whcrc_enable_events(whcrc); 349 whcrc_enable_events(whcrc);
372 result = 0;
373 le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR); 350 le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR);
374error: 351 return 0;
375 return result;
376} 352}
377 353
378 354
@@ -394,7 +370,7 @@ void whcrc_stop_rc(struct uwb_rc *rc)
394 370
395 le_writel(0, whcrc->rc_base + URCCMD); 371 le_writel(0, whcrc->rc_base + URCCMD);
396 whci_wait_for(&umc_dev->dev, whcrc->rc_base + URCSTS, 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
400static void whcrc_init(struct whcrc *whcrc) 376static void whcrc_init(struct whcrc *whcrc)