patch-2.3.34 linux/drivers/net/wan/cosa.c

Next file: linux/drivers/net/wan/hostess_sv11.c
Previous file: linux/drivers/net/tlan.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.33/linux/drivers/net/wan/cosa.c linux/drivers/net/wan/cosa.c
@@ -118,6 +118,7 @@
 /* Per-channel data structure */
 
 struct channel_data {
+	void *if_ptr;	/* General purpose pointer (used by SPPP) */
 	int usage;	/* Usage count; >0 for chrdev, -1 for netdev */
 	int num;	/* Number of the channel */
 	struct cosa_data *cosa;	/* Pointer to the per-card structure */
@@ -577,8 +578,10 @@
 static void sppp_channel_init(struct channel_data *chan)
 {
 	struct net_device *d;
+	chan->if_ptr = &chan->pppdev;
+	chan->pppdev.dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
 	sppp_attach(&chan->pppdev);
-	d=&chan->pppdev.dev;
+	d=chan->pppdev.dev;
 	d->name = chan->name;
 	d->base_addr = chan->cosa->datareg;
 	d->irq = chan->cosa->irq;
@@ -593,15 +596,15 @@
 	dev_init_buffers(d);
 	if (register_netdev(d) == -1) {
 		printk(KERN_WARNING "%s: register_netdev failed.\n", d->name);
-		sppp_detach(&chan->pppdev.dev);
+		sppp_detach(chan->pppdev.dev);
 		return;
 	}
 }
 
 static void sppp_channel_delete(struct channel_data *chan)
 {
-	sppp_detach(&chan->pppdev.dev);
-	unregister_netdev(&chan->pppdev.dev);
+	sppp_detach(chan->pppdev.dev);
+	unregister_netdev(chan->pppdev.dev);
 }
 
 
@@ -717,7 +720,7 @@
 		chan->stats.rx_dropped++;
 		return NULL;
 	}
-	chan->pppdev.dev.trans_start = jiffies;
+	chan->pppdev.dev->trans_start = jiffies;
 	return skb_put(chan->rx_skb, size);
 }
 
@@ -731,13 +734,13 @@
 		return 0;
 	}
 	chan->rx_skb->protocol = htons(ETH_P_WAN_PPP);
-	chan->rx_skb->dev = &chan->pppdev.dev;
+	chan->rx_skb->dev = chan->pppdev.dev;
 	chan->rx_skb->mac.raw = chan->rx_skb->data;
 	chan->stats.rx_packets++;
 	chan->stats.rx_bytes += chan->cosa->rxsize;
 	netif_rx(chan->rx_skb);
 	chan->rx_skb = 0;
-	chan->pppdev.dev.trans_start = jiffies;
+	chan->pppdev.dev->trans_start = jiffies;
 	return 0;
 }
 
@@ -755,7 +758,7 @@
 	chan->tx_skb = 0;
 	chan->stats.tx_packets++;
 	chan->stats.tx_bytes += size;
-	chan->pppdev.dev.tbusy = 0;
+	chan->pppdev.dev->tbusy = 0;
 	mark_bh(NET_BH);
 	return 1;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)