[svn-commits] sruffell: branch linux/sruffell/wctdm24xxp-cmdlist r9866 - /linux/team/sruffe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 16 16:41:17 CDT 2011


Author: sruffell
Date: Wed Mar 16 16:41:13 2011
New Revision: 9866

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9866
Log:
wctdm24xxp: Make sure the interrupt handler isn't using the vpm instance.

Modified:
    linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=9866&r1=9865&r2=9866
==============================================================================
--- linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c Wed Mar 16 16:41:13 2011
@@ -4277,6 +4277,8 @@
 {
 	int res;
 	struct vpmadt032_options options;
+	struct vpmadt032 *vpm;
+	unsigned long flags;
 
 	options.debug = debug;
 	options.vpmnlptype = vpmnlptype;
@@ -4294,8 +4296,11 @@
 	 * the analog channels. */
 	res = vpmadt032_init(wc->vpmadt032, &wc->vb);
 	if (res) {
-		vpmadt032_free(wc->vpmadt032);
+		vpm = wc->vpmadt032;
+		spin_lock_irqsave(&wc->reglock, flags);
 		wc->vpmadt032 = NULL;
+		spin_unlock_irqrestore(&wc->reglock, flags);
+		vpmadt032_free(vpm);
 		return res;
 	}
 
@@ -4303,8 +4308,11 @@
 	 * particular board. */
 	res = config_vpmadt032(wc->vpmadt032, wc);
 	if (res) {
-		vpmadt032_free(wc->vpmadt032);
+		vpm = wc->vpmadt032;
+		spin_lock_irqsave(&wc->reglock, flags);
 		wc->vpmadt032 = NULL;
+		spin_unlock_irqrestore(&wc->reglock, flags);
+		vpmadt032_free(vpm);
 		return res;
 	}
 
@@ -5452,38 +5460,42 @@
 static void __devexit wctdm_remove_one(struct pci_dev *pdev)
 {
 	struct wctdm *wc = pci_get_drvdata(pdev);
-	struct vpmadt032 *vpm = wc->vpmadt032;
+	struct vpmadt032 *vpm;
 	int i;
-
-
-	if (wc) {
-
-		remove_sysfs_files(wc);
-
-		if (vpm) {
-			flush_workqueue(vpm->wq);
-			clear_bit(VPM150M_ACTIVE, &vpm->control);
-			flush_workqueue(vpm->wq);
-		}
-
-		/* shut down any BRI modules */
-		for (i = 0; i < wc->mods_per_board; i += 4) {
-			if (wc->mods[i].type == BRI)
-				wctdm_unload_b400m(wc, i);
-		}
-
-		voicebus_stop(&wc->vb);
-
-		if (vpm) {
-			vpmadt032_free(wc->vpmadt032);
-			wc->vpmadt032 = NULL;
-		}
-
-		dev_info(&wc->vb.pdev->dev, "Freed a %s\n",
-				(is_hx8(wc)) ? "Hybrid card" : "Wildcard");
-		/* Release span */
-		wctdm_release(wc);
-	}
+	unsigned long flags;
+
+	if (!wc)
+		return;
+
+	remove_sysfs_files(wc);
+
+	vpm = wc->vpmadt032;
+	if (vpm) {
+		flush_workqueue(vpm->wq);
+		clear_bit(VPM150M_ACTIVE, &vpm->control);
+		flush_workqueue(vpm->wq);
+	}
+
+	/* shut down any BRI modules */
+	for (i = 0; i < wc->mods_per_board; i += 4) {
+		if (wc->mods[i].type == BRI)
+			wctdm_unload_b400m(wc, i);
+	}
+
+	voicebus_stop(&wc->vb);
+
+	if (vpm) {
+		spin_lock_irqsave(&wc->reglock, flags);
+		wc->vpmadt032 = NULL;
+		spin_unlock_irqrestore(&wc->reglock, flags);
+		vpmadt032_free(vpm);
+	}
+
+	dev_info(&wc->vb.pdev->dev,
+		 "Freed a %s\n", (is_hx8(wc)) ? "Hybrid card" : "Wildcard");
+
+	/* Release span */
+	wctdm_release(wc);
 }
 
 static DEFINE_PCI_DEVICE_TABLE(wctdm_pci_tbl) = {




More information about the svn-commits mailing list