[Asterisk-cvs] zaptel zaptel.c,1.88,1.89

markster at lists.digium.com markster at lists.digium.com
Wed Jul 28 10:45:28 CDT 2004


Update of /usr/cvsroot/zaptel
In directory localhost.localdomain:/tmp/cvs-serv18396

Modified Files:
	zaptel.c 
Log Message:
Fix 2.6 kernel build


Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- zaptel.c	28 Jul 2004 13:35:55 -0000	1.88
+++ zaptel.c	28 Jul 2004 14:31:31 -0000	1.89
@@ -1513,11 +1513,6 @@
 {
 	int x;
 	unsigned long flags;
-	write_lock_irqsave(&chan_lock, flags);
-	if (chan->flags & ZT_FLAG_REGISTERED) {
-		chans[chan->channo] = NULL;
-		chan->flags &= ~ZT_FLAG_REGISTERED;
-	}
 #ifdef CONFIG_ZAPATA_NET
 	if (chan->flags & ZT_FLAG_NETDEV) {
 #ifdef LINUX26
@@ -1530,6 +1525,11 @@
 		chan->hdlcnetdev = NULL;
 	}
 #endif
+	write_lock_irqsave(&chan_lock, flags);
+	if (chan->flags & ZT_FLAG_REGISTERED) {
+		chans[chan->channo] = NULL;
+		chan->flags &= ~ZT_FLAG_REGISTERED;
+	}
 #ifdef CONFIG_ZAPATA_PPP
 	if (chan->ppp) {
 		printk("HUH???  PPP still attached??\n");
@@ -3010,7 +3010,9 @@
 				return -EBUSY;
 			}
 #ifdef LINUX26
+			spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
 			unregister_hdlc_device(chans[ch.chan]->hdlcnetdev->netdev);
+			spin_lock_irqsave(&chans[ch.chan]->lock, flags);
 			free_netdev(chans[ch.chan]->hdlcnetdev->netdev);
 #else
 			unregister_hdlc_device(&chans[ch.chan]->hdlcnetdev->netdev);
@@ -3102,7 +3104,10 @@
 					chans[ch.chan]->hdlcnetdev->netdev->stop = zt_net_stop;
 					dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->attach = zt_net_attach;
 					dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->xmit = zt_xmit;
+					spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
+					/* Briefly restore interrupts while we register the device */
 					res = register_hdlc_device(chans[ch.chan]->hdlcnetdev->netdev);
+					spin_lock_irqsave(&chans[ch.chan]->lock, flags);
 				} else {
 					printk("Unable to allocate hdlc: *shrug*\n");
 					res = -1;
@@ -5415,11 +5420,6 @@
 #if defined(CONFIG_ZAPATA_NET)  || defined(CONFIG_ZAPATA_PPP)
 	/* SKB for receiving network stuff */
 	struct sk_buff *skb=NULL;
-#ifdef LINUX26
-	struct net_device_stats *stats = hdlc_stats(ms->hdlcnetdev->netdev);
-#else
-	struct net_device_stats *stats = &ms->hdlcnetdev->netdev.stats;
-#endif	
 #endif	
 	int oldbuf;
 	int eof=0;
@@ -5505,6 +5505,13 @@
 #endif
 #if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP)
 				if (ms->flags & (ZT_FLAG_NETDEV | ZT_FLAG_PPP)) {
+#ifdef CONFIG_ZAPATA_NET
+#ifdef LINUX26
+					struct net_device_stats *stats = hdlc_stats(ms->hdlcnetdev->netdev);
+#else  /* LINUX26 */
+					struct net_device_stats *stats = &ms->hdlcnetdev->netdev.stats;
+#endif /* LINUX26 */
+#endif /* CONFIG_ZAPATA_NET */
 					/* Our network receiver logic is MUCH
 					  different.  We actually only use a single
 					  buffer */
@@ -5595,6 +5602,11 @@
 
 #ifdef CONFIG_ZAPATA_NET
 				if (ms->flags & ZT_FLAG_NETDEV) {
+#ifdef LINUX26
+					struct net_device_stats *stats = hdlc_stats(ms->hdlcnetdev->netdev);
+#else  /* LINUX26 */
+					struct net_device_stats *stats = &ms->hdlcnetdev->netdev.stats;
+#endif /* LINUX26 */
 					stats->rx_errors++;
 					if (abort == ZT_EVENT_OVERRUN)
 						stats->rx_over_errors++;
@@ -5628,7 +5640,7 @@
 			skb->mac.raw = skb->data;
 			skb->dev = ztchan_to_dev(ms);
 #ifdef ZAP_HDLC_TYPE_TRANS
-			skb->protocol = hdlc_type_trans(skb, &ms->hdlcnetdev->netdev.netdev);
+			skb->protocol = hdlc_type_trans(skb, ztchan_to_dev(ms));
 #else
 			skb->protocol = htons (ETH_P_HDLC);
 #endif




More information about the svn-commits mailing list