From 254c020802926f14014b09e4d901fc317e561a4f Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 4 Nov 2010 16:41:02 +0000 Subject: wctdm24xxp: 'wait_just_a_bit()' -> 'msleep()' If we're waiting for tens or hundreds of milliseconds we will just go to sleep instead of spinning. Signed-off-by: Shaun Ruffell git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9471 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wctdm24xxp/base.c | 21 +++++---------------- drivers/dahdi/wctdm24xxp/wctdm24xxp.h | 1 - drivers/dahdi/wctdm24xxp/xhfc.c | 5 +++-- 3 files changed, 8 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 656054e..59622c8 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -2476,14 +2476,6 @@ static int wctdm_proslic_calibrate(struct wctdm *wc, int card) return 0; } -void wait_just_a_bit(int foo) -{ - long newjiffies; - newjiffies = jiffies + foo; - while (jiffies < newjiffies) - ; -} - /********************************************************************* * Set the hwgain on the analog modules * @@ -2619,22 +2611,19 @@ static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual, spin_lock_irqsave(&wc->reglock, flags); wc->modtype[card] = MOD_TYPE_NONE; spin_unlock_irqrestore(&wc->reglock, flags); - /* Wait just a bit */ - wait_just_a_bit(HZ/10); + msleep(100); spin_lock_irqsave(&wc->reglock, flags); wc->modtype[card] = MOD_TYPE_FXO; spin_unlock_irqrestore(&wc->reglock, flags); - wait_just_a_bit(HZ/10); + msleep(100); if (!sane && wctdm_voicedaa_insane(wc, card)) return -2; /* Software reset */ wctdm_setreg(wc, card, 1, 0x80); - - /* Wait just a bit */ - wait_just_a_bit(HZ/10); + msleep(100); /* Set On-hook speed, Ringer impedence, and ringer threshold */ reg16 |= (fxo_modes[_opermode].ohs << 6); @@ -2671,7 +2660,7 @@ static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual, newjiffies = jiffies; newjiffies += 2 * HZ; while ((jiffies < newjiffies) && !(wctdm_getreg(wc, card, 11) & 0xf0)) - wait_just_a_bit(HZ/10); + msleep(100); if (!(wctdm_getreg(wc, card, 11) & 0xf0)) { dev_notice(&wc->vb.pdev->dev, "VoiceDAA did not bring up ISO link properly!\n"); @@ -2730,7 +2719,7 @@ static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual, wc->modtype[card] = MOD_TYPE_FXS; spin_unlock_irqrestore(&wc->reglock, flags); - wait_just_a_bit(HZ/10); + msleep(100); /* Sanity check the ProSLIC */ if (!sane && wctdm_proslic_insane(wc, card)) diff --git a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h index 70df96a..562761b 100644 --- a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h +++ b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h @@ -285,7 +285,6 @@ struct wctdm { /* Atomic flag bits for checkflag field */ #define WCTDM_CHECK_TIMING 0 -void wait_just_a_bit(int foo); int wctdm_getreg(struct wctdm *wc, int card, int addr); int wctdm_setreg(struct wctdm *wc, int card, int addr, int val); diff --git a/drivers/dahdi/wctdm24xxp/xhfc.c b/drivers/dahdi/wctdm24xxp/xhfc.c index 65cdfb7..b65245f 100644 --- a/drivers/dahdi/wctdm24xxp/xhfc.c +++ b/drivers/dahdi/wctdm24xxp/xhfc.c @@ -24,6 +24,7 @@ #include #include #include +#include #define FAST_HDLC_NEED_TABLES #include @@ -785,7 +786,7 @@ static void hfc_reset(struct b400m *b4) b400m_setreg(b4, R_CIRM, V_SRES); flush_hw(); - wait_just_a_bit(HZ/10); + msleep(100); b400m_setreg(b4, R_CIRM, 0x00); flush_hw(); @@ -2711,7 +2712,7 @@ void wctdm_unload_b400m(struct wctdm *wc, int card) if (b4) { b4->inited = 0; - wait_just_a_bit(HZ/10); + msleep(100); /* TODO: wait for tdm24xx driver to unregister the spans */ /* do { ... } while(not_unregistered); */ -- cgit v1.2.3