[svn-commits] sruffell: linux/trunk r9944 - /linux/trunk/drivers/dahdi/wctdm24xxp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 2 15:01:58 CDT 2011


Author: sruffell
Date: Thu Jun  2 15:01:54 2011
New Revision: 9944

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9944
Log:
wctdm24xxp: Block chanconfig and spanconfig until board is ready.

Currently the board will always be ready if the module initialization
function is complete but this change will facilitate allowing some of
the more time consuming configuration steps to happen in parallel on
system start.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c
    linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
    linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=9944&r1=9943&r2=9944
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Thu Jun  2 15:01:54 2011
@@ -3564,6 +3564,42 @@
 	return 0;
 }
 
+/**
+ * wctdm_wait_for_ready
+ *
+ * Check if the board has finished any setup and is ready to start processing
+ * calls.
+ */
+int wctdm_wait_for_ready(const struct wctdm *wc)
+{
+	while (!wc->initialized) {
+		if (fatal_signal_pending(current))
+			return -EIO;
+		msleep_interruptible(250);
+	}
+	return 0;
+}
+
+/**
+ * wctdm_chanconfig - Called when the channels are being configured.
+ *
+ * Ensure that the card is completely ready to go before we allow the channels
+ * to be completely configured. This is to allow lengthy initialization
+ * actions to take place in background on driver load and ensure we're synced
+ * up by the time dahdi_cfg is run.
+ *
+ */
+static int
+wctdm_chanconfig(struct file *file, struct dahdi_chan *chan, int sigtype)
+{
+	struct wctdm *wc = chan->pvt;
+
+	if ((file->f_flags & O_NONBLOCK) && !wc->initialized)
+		return -EAGAIN;
+
+	return wctdm_wait_for_ready(wc);
+}
+
 static const struct dahdi_span_ops wctdm24xxp_analog_span_ops = {
 	.owner = THIS_MODULE,
 	.hooksig = wctdm_hooksig,
@@ -3571,6 +3607,7 @@
 	.close = wctdm_close,
 	.ioctl = wctdm_ioctl,
 	.watchdog = wctdm_watchdog,
+	.chanconfig = wctdm_chanconfig,
 	.dacs = wctdm_dacs,
 #ifdef VPM_SUPPORT
 	.echocan_create = wctdm_echocan_create,

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=9944&r1=9943&r2=9944
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Thu Jun  2 15:01:54 2011
@@ -270,6 +270,8 @@
 int wctdm_getreg(struct wctdm *wc, int card, int addr);
 int wctdm_setreg(struct wctdm *wc, int card, int addr, int val);
 
+int wctdm_wait_for_ready(const struct wctdm *wc);
+
 extern struct semaphore ifacelock;
 extern struct wctdm *ifaces[WC_MAX_IFACES];
 

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c?view=diff&rev=9944&r1=9943&r2=9944
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/xhfc.c Thu Jun  2 15:01:54 2011
@@ -2183,10 +2183,18 @@
 	struct wctdm *wc;
 	int te_mode, term;
 	int pos;
+	int res;
 
 	bspan = bspan_from_dspan(span);
 	b4 = bspan->parent;
 	wc = b4->wc;
+
+	if ((file->f_flags & O_NONBLOCK) && !wc->initialized)
+		return -EAGAIN;
+
+	res = wctdm_wait_for_ready(wc);
+	if (res)
+		return res;
 
 	b400m_disable_workqueues(b4->wc);
 
@@ -2257,6 +2265,13 @@
 	struct b400m_span *bspan = bspan_from_dspan(chan->span);
 	struct b400m *b4 = bspan->parent;
 	int res;
+
+	if ((file->f_flags & O_NONBLOCK) && !b4->wc->initialized)
+		return -EAGAIN;
+
+	res = wctdm_wait_for_ready(b4->wc);
+	if (res)
+		return res;
 
 	alreadyrunning = bspan->wspan->span.flags & DAHDI_FLAG_RUNNING;
 




More information about the svn-commits mailing list