[zaptel-commits] mattf: branch 1.2 r1605 - /branches/1.2/zaptel.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Thu Nov 16 16:12:01 MST 2006


Author: mattf
Date: Thu Nov 16 17:12:00 2006
New Revision: 1605

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1605
Log:
Fix for 7769

Modified:
    branches/1.2/zaptel.c

Modified: branches/1.2/zaptel.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/zaptel.c?view=diff&rev=1605&r1=1604&r2=1605
==============================================================================
--- branches/1.2/zaptel.c (original)
+++ branches/1.2/zaptel.c Thu Nov 16 17:12:00 2006
@@ -2228,8 +2228,10 @@
 		else if ((chans[unit]->sig & __ZT_SIG_DACS) == __ZT_SIG_DACS)
 			res = -EBUSY;
 		else {
+			unsigned long flags;
 			/* Assume everything is going to be okay */
 			res = initialize_channel(chans[unit]);
+			spin_lock_irqsave(&chans[unit]->lock, flags);
 			if (chans[unit]->flags & ZT_FLAG_PSEUDO) 
 				chans[unit]->flags |= ZT_FLAG_AUDIO;
 			if (chans[unit]->span && chans[unit]->span->open)
@@ -2241,7 +2243,9 @@
 					MOD_INC_USE_COUNT;
 #endif					
 				chans[unit]->flags |= ZT_FLAG_OPEN;
+				spin_unlock_irqrestore(&chans[unit]->lock, flags);
 			} else {
+				spin_unlock_irqrestore(&chans[unit]->lock, flags);
 				close_channel(chans[unit]);
 			}
 		}
@@ -2254,7 +2258,10 @@
 {
 	int res=0;
 	if (chans[unit]) {
+		unsigned long flags;
+		spin_lock_irqsave(&chans[unit]->lock, flags);
 		chans[unit]->flags &= ~ZT_FLAG_OPEN;
+		spin_unlock_irqrestore(&chans[unit]->lock, flags);
 		chans[unit]->file = NULL;
 		close_channel(chans[unit]);
 		if (chans[unit]->span && chans[unit]->span->close)



More information about the zaptel-commits mailing list