From d399fe5883537d0b33636a548626c1d494de82a4 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Fri, 11 Mar 2011 15:17:09 -0600 Subject: wctdm24xxp: Shorten up some of the sleeps/waits. Signed-off-by: Shaun Ruffell --- drivers/dahdi/wctdm24xxp/base.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 2397c91..cab51c9 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -2324,7 +2324,7 @@ wctdm_proslic_insane(struct wctdm *wc, struct wctdm_module *const mod) static int wctdm_proslic_powerleak_test(struct wctdm *wc, struct wctdm_module *const mod) { - unsigned long origjiffies; + unsigned long start; unsigned char vbat; /* Turn off linefeed */ @@ -2333,16 +2333,15 @@ wctdm_proslic_powerleak_test(struct wctdm *wc, struct wctdm_module *const mod) /* Power down */ wctdm_setreg(wc, mod, 14, 0x10); - /* Wait for one second */ - origjiffies = jiffies; + start = jiffies; - /* TODO: Why is this sleep necessary. WIthout it, the first read + /* TODO: Why is this sleep necessary. Without it, the first read * comes back with a 0 value. */ msleep(20); while ((vbat = wctdm_getreg(wc, mod, 82)) > 0x6) { - if ((jiffies - origjiffies) >= (HZ/2)) - break;; + if (time_after(jiffies, start + HZ/4)) + break; } if (vbat < 0x06) { @@ -2350,7 +2349,7 @@ wctdm_proslic_powerleak_test(struct wctdm *wc, struct wctdm_module *const mod) "Excessive leakage detected on module %d: %d " "volts (%02x) after %d ms\n", mod->card, 376 * vbat / 1000, vbat, - (int)((jiffies - origjiffies) * 1000 / HZ)); + (int)((jiffies - start) * 1000 / HZ)); return -1; } else if (debug & DEBUG_CARD) { dev_info(&wc->vb.pdev->dev, @@ -2689,12 +2688,12 @@ wctdm_init_voicedaa(struct wctdm *wc, struct wctdm_module *mod, spin_lock_irqsave(&wc->reglock, flags); mod->type = NONE; spin_unlock_irqrestore(&wc->reglock, flags); - msleep(100); + msleep(20); spin_lock_irqsave(&wc->reglock, flags); mod->type = FXO; spin_unlock_irqrestore(&wc->reglock, flags); - msleep(100); + msleep(20); if (!sane && wctdm_voicedaa_insane(wc, mod)) return -2; @@ -2825,7 +2824,7 @@ wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod, mod->type = FXS; spin_unlock_irqrestore(&wc->reglock, flags); - msleep(100); + /* msleep(100); */ /* Sanity check the ProSLIC */ if (!sane && wctdm_proslic_insane(wc, mod)) @@ -4226,7 +4225,7 @@ static void wctdm_identify_modules(struct wctdm *wc) /* Wait just a bit; this makes sure that cmd_dequeue is emitting SPI * commands in the appropriate mode(s). */ - msleep(20); + udelay(2000); /* Now that all the cards have been reset, we can stop checking them * all if there aren't as many */ -- cgit v1.2.3