summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wcte12xp
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-06-02 20:01:59 +0000
committerShaun Ruffell <sruffell@digium.com>2011-06-02 20:01:59 +0000
commit490a1cba75f3dc714eff05471e4867c76ce26493 (patch)
tree6f8fbd756fcec216c4140523e078ef14ba79d6fa /drivers/dahdi/wcte12xp
parentab16381fa5cb2c0af61149194c18e43e3b287b83 (diff)
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 <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9945 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wcte12xp')
-rw-r--r--drivers/dahdi/wcte12xp/base.c35
-rw-r--r--drivers/dahdi/wcte12xp/wcte12xp.h1
2 files changed, 36 insertions, 0 deletions
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;
}
diff --git a/drivers/dahdi/wcte12xp/wcte12xp.h b/drivers/dahdi/wcte12xp/wcte12xp.h
index 5f6dbce..21b59ac 100644
--- a/drivers/dahdi/wcte12xp/wcte12xp.h
+++ b/drivers/dahdi/wcte12xp/wcte12xp.h
@@ -111,6 +111,7 @@ struct t1 {
int loopdowncnt;
#define INITIALIZED 1
#define SHUTDOWN 2
+#define READY 3
unsigned long bit_flags;
unsigned long alarmtimer;
unsigned char ledstate;