From 490a1cba75f3dc714eff05471e4867c76ce26493 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 2 Jun 2011 20:01:59 +0000 Subject: wcte12xp: Force spanconfig/chanconfig to wait for ready. This is always true currently but will not necessarily be in the future. Signed-off-by: Shaun Ruffell git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9945 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wcte12xp/base.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'drivers/dahdi/wcte12xp/base.c') diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 8864aba..ea9fd29 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -957,6 +957,18 @@ static int t1xxp_chanconfig(struct file *file, struct dahdi_chan *chan, int sigtype) { struct t1 *wc = chan->pvt; + + if (file->f_flags & O_NONBLOCK) { + if (!test_bit(READY, &wc->bit_flags)) + return -EAGAIN; + } else { + while (!test_bit(READY, &wc->bit_flags)) { + if (fatal_signal_pending(current)) + return -EIO; + msleep_interruptible(250); + } + } + if (test_bit(DAHDI_FLAGBIT_RUNNING, &chan->span->flags) && (wc->spantype != TYPE_E1)) { __t1xxp_set_clear(wc); @@ -1368,6 +1380,12 @@ setchanconfig_from_state(struct vpmadt032 *vpm, int channel, } #ifdef VPM_SUPPORT + +struct vpm_load_work { + struct work_struct work; + struct t1 *wc; +}; + static int check_and_load_vpm(struct t1 *wc) { int res; @@ -1490,6 +1508,17 @@ t1xxp_spanconfig(struct file *file, struct dahdi_span *span, struct t1 *wc = container_of(span, struct t1, span); int i; + if (file->f_flags & O_NONBLOCK) { + if (!test_bit(READY, &wc->bit_flags)) + return -EAGAIN; + } else { + while (!test_bit(READY, &wc->bit_flags)) { + if (fatal_signal_pending(current)) + return -EIO; + msleep_interruptible(250); + } + } + /* Do we want to SYNC on receive or not */ if (lc->sync) { set_bit(7, &wc->ctlreg); @@ -2110,6 +2139,7 @@ static void vpm_check_func(struct work_struct *work) set_bit(VPM150M_ACTIVE, &wc->ctlreg); t1_info(wc, "VPMADT032 is reenabled.\n"); wc->vpm_check = jiffies + HZ*5; + set_bit(READY, &wc->bit_flags); return; } @@ -2361,6 +2391,11 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi t1_software_init(wc); t1_info(wc, "Found a %s\n", wc->variety); voicebus_unlock_latency(&wc->vb); + + /* If there is VPMADT032 module attached to this device, it will + * signal ready after the channels are configured and ready for use. */ + if (!wc->vpmadt032) + set_bit(READY, &wc->bit_flags); return 0; } -- cgit v1.2.3