diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-07-28 14:31:31 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-07-28 14:31:31 +0000 |
commit | 31bdf40b8d1c450d57c76961961089f0a7dcd8b6 (patch) | |
tree | fc022fed6c75a9be5ee403d51cdf7d4b714ff6e6 | |
parent | d178c59876ebc7e620b8829f6d07c715fa64373b (diff) |
Fix 2.6 kernel build
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@444 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-x | zaptel.c | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -1513,11 +1513,6 @@ static void zt_chan_unreg(struct zt_chan *chan) { 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 @@ static void zt_chan_unreg(struct zt_chan *chan) 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 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd 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 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd 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 @@ static inline void __zt_putbuf_chunk(struct zt_chan *ss, unsigned char *rxb) #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 @@ static inline void __zt_putbuf_chunk(struct zt_chan *ss, unsigned char *rxb) #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 @@ out in the later versions, and is put back now. */ #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 @@ out in the later versions, and is put back now. */ 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 |