List Info

Thread: mattf: branch 1.4 r2465 - in /branches/1.4: ./ wcte11xp.c




mattf: branch 1.4 r2465 - in /branches/1.4: ./ wcte11xp.c
user name
2007-04-28 14:11:21
Author: mattf
Date: Sat Apr 28 14:11:20 2007
New Revision: 2465

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2465
Log:
Merged revisions 2464 via svnmerge from 
ht
tps://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2464 | mattf | 2007-04-28 14:04:50 -0500 (Sat, 28 Apr 2007)
| 2 lines

Fix for potential deadlock in drivers

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/wcte11xp.c

Propchange: branches/1.4/
------------------------------------------------------------
------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/wcte11xp.c
URL: http://s
vn.digium.com/view/zaptel/branches/1.4/wcte11xp.c?view=diff&
amp;rev=2465&r1=2464&r2=2465
============================================================
==================
--- branches/1.4/wcte11xp.c (original)
+++ branches/1.4/wcte11xp.c Sat Apr 28 14:11:20 2007
 -559,24
+559,35 
 	return 0;
 }
 
-static void __t1_check_sigbits(struct t1 *wc)
+static void t1_check_sigbits(struct t1 *wc)
 {
 	int a,i,rxs;
+	unsigned long flags;
+
 	if (!(wc->span.flags & ZT_FLAG_RUNNING))
 		return;
+
+	spin_lock_irqsave(&wc->lock, flags);
+
 	if (wc->spantype == TYPE_E1) {
 		for (i = 0; i < 15; i++) {
 			a = __t1_framer_in(wc, 0x71 + i);
 			/* Get high channel in low bits */
 			rxs = (a & 0xf);
 			if (!(wc->span.chans[i+16].sig & ZT_SIG_CLEAR))
{
-				if (wc->span.chans[i+16].rxsig != rxs)
+				if (wc->span.chans[i+16].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i+16], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 			rxs = (a >> 4) & 0xf;
 			if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) {
-				if (wc->span.chans[i].rxsig != rxs)
+				if (wc->span.chans[i].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 		}
 	} else if (wc->span.lineconfig & ZT_CONFIG_D4) {
 -585,23
+596,35 
 			/* Get high channel in low bits */
 			rxs = (a & 0x3) << 2;
 			if (!(wc->span.chans[i+3].sig & ZT_SIG_CLEAR)) {
-				if (wc->span.chans[i+3].rxsig != rxs)
+				if (wc->span.chans[i+3].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i+3], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 			rxs = (a & 0xc);
 			if (!(wc->span.chans[i+2].sig & ZT_SIG_CLEAR)) {
-				if (wc->span.chans[i+2].rxsig != rxs)
+				if (wc->span.chans[i+2].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i+2], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 			rxs = (a >> 2) & 0xc;
 			if (!(wc->span.chans[i+1].sig & ZT_SIG_CLEAR)) {
-				if (wc->span.chans[i+1].rxsig != rxs)
+				if (wc->span.chans[i+1].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i+1], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 			rxs = (a >> 4) & 0xc;
 			if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) {
-				if (wc->span.chans[i].rxsig != rxs)
+				if (wc->span.chans[i].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 		}
 	} else {
 -610,16
+633,23 
 			/* Get high channel in low bits */
 			rxs = (a & 0xf);
 			if (!(wc->span.chans[i+1].sig & ZT_SIG_CLEAR)) {
-				if (wc->span.chans[i+1].rxsig != rxs)
+				if (wc->span.chans[i+1].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i+1], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 			rxs = (a >> 4) & 0xf;
 			if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) {
-				if (wc->span.chans[i].rxsig != rxs)
+				if (wc->span.chans[i].rxsig != rxs) {
+					spin_unlock_irqrestore(&wc->lock, flags);
 					zt_rbsbits(&wc->span.chans[i], rxs);
+					spin_lock_irqsave(&wc->lock, flags);
+				}
 			}
 		}
 	}
+	spin_unlock_irqrestore(&wc->lock, flags);
 }
 
 static void t4_serial_setup(struct t1 *wc)
 -1143,14
+1173,17 
 	zt_receive(&wc->span);
 }
 
-static void __t1_check_alarms(struct t1 *wc)
+static void t1_check_alarms(struct t1 *wc)
 {
 	unsigned char c,d;
 	int alarms;
 	int x,j;
+	unsigned long flags;
 
 	if (!(wc->span.flags & ZT_FLAG_RUNNING))
 		return;
+
+	spin_lock_irqsave(&wc->lock, flags);
 
 	c = __t1_framer_in(wc, 0x4c);
 	if (wc->spanflags & FLAG_FALC12)
 -1265,18
+1298,25 
 	if (wc->span.mainttimer || wc->span.maintstat) 
 		alarms |= ZT_ALARM_LOOPBACK;
 	wc->span.alarms = alarms;
+	spin_unlock_irqrestore(&wc->lock, flags);
 	zt_alarm_notify(&wc->span);
 }
 
 
-static void __t1_do_counters(struct t1 *wc)
-{
+static void t1_do_counters(struct t1 *wc)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&wc->lock, flags);
 	if (wc->alarmtimer) {
 		if (!--wc->alarmtimer) {
 			wc->span.alarms &= ~(ZT_ALARM_RECOVER);
+			spin_unlock_irqrestore(&wc->lock, flags);
 			zt_alarm_notify(&wc->span);
+			spin_lock_irqsave(&wc->lock, flags);
 		}
 	}
+	spin_unlock_irqrestore(&wc->lock, flags);
 }
 
 ZAP_IRQ_HANDLER(t1xxp_interrupt)
 -1314,8
+1354,10 
 	__handle_leds(wc);
 #endif
 
+	spin_unlock_irqrestore(&wc->lock, flags);
+
 	/* Count down timers */
-	__t1_do_counters(wc);
+	t1_do_counters(wc);
 
 	/* Do some things that we don't have to do very often */
 	x = wc->intcount & 15 /* 63 */;
 -1324,17
+1366,15 
 	case 1:
 		break;
 	case 2:
-		__t1_check_sigbits(wc);
+		t1_check_sigbits(wc);
 		break;
 	case 4:
 		/* Check alarms 1/4 as frequently */
 		if (!(wc->intcount & 0x30))
-			__t1_check_alarms(wc);
+			t1_check_alarms(wc);
 		break;
 	}
 	
-	spin_unlock_irqrestore(&wc->lock, flags);
-
 	if (ints & 0x10) 
 		printk("PCI Master abortn");
 

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

zaptel-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/zaptel-commits

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )