[svn-commits] sruffell: linux/trunk r8488 - /linux/trunk/drivers/dahdi/wcte12xp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Apr 6 17:36:12 CDT 2010


Author: sruffell
Date: Tue Apr  6 17:36:09 2010
New Revision: 8488

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8488
Log:
wcte12xp: Check and dequeue/decipher the VPM commands atomically

Modified:
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8488&r1=8487&r2=8488
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Tue Apr  6 17:36:09 2010
@@ -150,8 +150,11 @@
 	spin_lock_irqsave(&wc->cmd_list_lock, flags);
 	list_splice_init(&wc->active_cmds, &wc->pending_cmds);
 	spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
+
+	spin_lock(&wc->reglock);
 	if (wc->vpmadt032)
 		vpmadt032_resend(wc->vpmadt032);
+	spin_unlock(&wc->reglock);
 }
 
 static void cmd_dequeue(struct t1 *wc, unsigned char *writechunk, int eframe, int slot)
@@ -1420,9 +1423,11 @@
 	res = vpmadt032_init(wc->vpmadt032, &wc->vb);
 	if (-ENODEV == res) {
 		/* There does not appear to be a VPMADT032 installed. */
+		clear_bit(4, &wc->ctlreg);
+		spin_lock_bh(&wc->reglock);
+		wc->vpmadt032 = NULL;
+		spin_unlock_bh(&wc->reglock);
 		vpmadt032_free(wc->vpmadt032);
-		wc->vpmadt032 = NULL;
-		clear_bit(4, &wc->ctlreg);
 		return res;
 
 	} else if (res) {
@@ -1850,8 +1855,10 @@
 			cmd_dequeue(wc, writechunk, x, y);
 
 #ifdef VPM_SUPPORT
+		spin_lock(&wc->reglock);
 		if (wc->vpmadt032)
 			cmd_dequeue_vpmadt032(wc, writechunk, x);
+		spin_unlock(&wc->reglock);
 #endif
 
 		if (x < DAHDI_CHUNKSIZE - 1) {
@@ -1903,11 +1910,10 @@
 		}
 		cmd_decipher(wc, readchunk);
 #ifdef VPM_SUPPORT
-		if (wc->vpmadt032) {
-			spin_lock(&wc->reglock);
+		spin_lock(&wc->reglock);
+		if (wc->vpmadt032)
 			cmd_decipher_vpmadt032(wc, readchunk);
-			spin_unlock(&wc->reglock);
-		}
+		spin_unlock(&wc->reglock);
 #endif
 		readchunk += (EFRAME_SIZE + EFRAME_GAP);
 	}
@@ -2032,13 +2038,17 @@
 
 	queue_work(wc->wq, &wc->timer_work);
 
+	spin_lock(&wc->reglock);
 	if (!wc->vpmadt032)
-		return;
+		goto unlock_exit;
 
 	if (time_after(wc->vpm_check, jiffies))
-		return;
+		goto unlock_exit;
 
 	queue_work(wc->vpmadt032->wq, &wc->vpm_check_work);
+
+unlock_exit:
+	spin_unlock(&wc->reglock);
 	return;
 }
 
@@ -2046,10 +2056,14 @@
 {
 	struct t1 *wc = container_of(vb, struct t1, vb);
 
+	spin_lock_bh(&wc->reglock);
 	if (!wc->vpmadt032)
-		return;
+		goto unlock_exit;
 	clear_bit(4, &wc->ctlreg);
 	queue_work(wc->vpmadt032->wq, &wc->vpm_check_work);
+
+unlock_exit:
+	spin_unlock_bh(&wc->reglock);
 }
 
 static const struct voicebus_operations voicebus_operations = {




More information about the svn-commits mailing list