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 <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9471 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
parent
c674c147fd
commit
8c24b0fd8f
@ -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))
|
||||
|
@ -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);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/ppp_defs.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#define FAST_HDLC_NEED_TABLES
|
||||
#include <dahdi/kernel.h>
|
||||
@ -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); */
|
||||
|
Loading…
Reference in New Issue
Block a user