[svn-commits] sruffell: branch linux/2.4 r9655 - /linux/branches/2.4/drivers/dahdi/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 20 23:27:37 CST 2011


Author: sruffell
Date: Thu Jan 20 23:27:32 2011
New Revision: 9655

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9655
Log:
dahdi: Fix compilation error when CONFIG_DAHDI_NET is defined.

Kernel interface for network devices changed. This is the patch from issue
plus a few trivial checkpatch.pl formatting changes (minus the >80 column
warnings).

(closes issue #17857)
Reported by: msink
Patches:
      dahdi_net-v2.patch uploaded by msink (license 1103)

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=9247

Modified:
    linux/branches/2.4/drivers/dahdi/dahdi-base.c

Modified: linux/branches/2.4/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.4/drivers/dahdi/dahdi-base.c?view=diff&rev=9655&r1=9654&r2=9655
==============================================================================
--- linux/branches/2.4/drivers/dahdi/dahdi-base.c (original)
+++ linux/branches/2.4/drivers/dahdi/dahdi-base.c Thu Jan 20 23:27:32 2011
@@ -1665,6 +1665,13 @@
 #endif
 
 #ifdef CONFIG_DAHDI_NET
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+static inline struct net_device_stats *hdlc_stats(struct net_device *dev)
+{
+	return &dev->stats;
+}
+#endif
+
 #ifdef NEW_HDLC_INTERFACE
 static int dahdi_net_open(struct net_device *dev)
 {
@@ -4134,6 +4141,15 @@
 #endif
 }
 
+#if defined(CONFIG_DAHDI_NET) && defined(HAVE_NET_DEVICE_OPS)
+static const struct net_device_ops dahdi_netdev_ops = {
+	.ndo_open       = dahdi_net_open,
+	.ndo_stop       = dahdi_net_stop,
+	.ndo_do_ioctl   = dahdi_net_ioctl,
+	.ndo_start_xmit = dahdi_xmit,
+};
+#endif
+
 static int dahdi_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 {
 	/* I/O CTL's for control interface */
@@ -4382,9 +4398,13 @@
 #endif
 					chans[ch.chan]->hdlcnetdev->netdev->irq = chans[ch.chan]->span->irq;
 					chans[ch.chan]->hdlcnetdev->netdev->tx_queue_len = 50;
+#ifdef HAVE_NET_DEVICE_OPS
+					chans[ch.chan]->hdlcnetdev->netdev->netdev_ops = &dahdi_netdev_ops;
+#else
 					chans[ch.chan]->hdlcnetdev->netdev->do_ioctl = dahdi_net_ioctl;
 					chans[ch.chan]->hdlcnetdev->netdev->open = dahdi_net_open;
 					chans[ch.chan]->hdlcnetdev->netdev->stop = dahdi_net_stop;
+#endif
 					dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->attach = dahdi_net_attach;
 					dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->xmit = dahdi_xmit;
 					spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
@@ -7636,8 +7656,11 @@
 #ifdef CONFIG_DAHDI_PPP
 						if (!ms->do_ppp_error)
 #endif
-							skb = dev_alloc_skb(ms->readn[ms->inreadbuf]);
+							skb = dev_alloc_skb(ms->readn[ms->inreadbuf] + 2);
 						if (skb) {
+							unsigned char cisco_addr = *(ms->readbuf[ms->inreadbuf]);
+							if (cisco_addr != 0x0f && cisco_addr != 0x8f)
+								skb_reserve(skb, 2);
 							/* XXX Get rid of this memcpy XXX */
 							memcpy(skb->data, ms->readbuf[ms->inreadbuf], ms->readn[ms->inreadbuf]);
 							skb_put(skb, ms->readn[ms->inreadbuf]);




More information about the svn-commits mailing list