[dahdi-commits] sruffell: linux/trunk r10332 - /linux/trunk/drivers/dahdi/wctdm24xxp/base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon Nov 7 16:40:24 CST 2011


Author: sruffell
Date: Mon Nov  7 16:40:20 2011
New Revision: 10332

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10332
Log:
wctdm24xxp: Wait for background threads to complete on failed load.

Some of the VPM loading / probing threads use global system workqueues. They
might now be running when we abort early so we should wait for them to
complete their runs before freeing memory that may be in use.

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

Modified:
    linux/trunk/drivers/dahdi/wctdm24xxp/base.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=10332&r1=10331&r2=10332
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Mon Nov  7 16:40:20 2011
@@ -4937,7 +4937,29 @@
 {
 	int i;
 	unsigned long flags;
+	struct vpmadt032 *vpm;
 	LIST_HEAD(local_list);
+
+	spin_lock_irqsave(&wc->reglock, flags);
+	if (wc->not_ready) {
+		wc->not_ready--;
+		spin_unlock_irqrestore(&wc->reglock, flags);
+		while (wctdm_wait_for_ready(wc))
+			schedule();
+		spin_lock_irqsave(&wc->reglock, flags);
+	}
+	spin_unlock_irqrestore(&wc->reglock, flags);
+
+	if (wc->vpmadt032) {
+		flush_workqueue(wc->vpmadt032->wq);
+		clear_bit(VPM150M_ACTIVE, &wc->vpmadt032->control);
+		flush_workqueue(wc->vpmadt032->wq);
+		spin_lock_irqsave(&wc->reglock, flags);
+		vpm = wc->vpmadt032;
+		wc->vpmadt032 = NULL;
+		spin_unlock_irqrestore(&wc->reglock, flags);
+		vpmadt032_free(vpm);
+	}
 
 	voicebus_release(&wc->vb);
 #ifdef CONFIG_VOICEBUS_ECREFERENCE
@@ -5991,6 +6013,8 @@
 		while (wctdm_wait_for_ready(wc))
 			schedule();
 	}
+
+	flush_scheduled_work();
 
 	/* shut down any BRI modules */
 	for (i = 0; i < wc->mods_per_board; i += 4) {




More information about the dahdi-commits mailing list