DORMANTno replies

[PATCH] fix arm/etherh.c

From: Daniel Ritz <hidden>
Date: 2004-04-01 21:17:23

arm/etherh.c was broken when converted to alloc_ei_dev(). fix is the same as
in pcnet_cs.c.

also kfree()ing ec->irqdata is wrong since it's already freed by free_netdev().

against 2.6.5-rc3-bk. untested.

--- 1.21/drivers/net/arm/etherh.c	Wed Mar  3 00:15:42 2004
+++ edited/drivers/net/arm/etherh.c	Sat Mar 27 21:53:49 2004
@@ -59,7 +59,6 @@
 static unsigned int net_debug = NET_DEBUG;
 
 struct etherh_priv {
-	struct ei_device eidev;
 	unsigned int	id;
 	unsigned int	ctrl_port;
 	unsigned int	ctrl;
@@ -99,6 +98,12 @@
 
 /* ------------------------------------------------------------------------ */
 
+static inline struct etherh_priv *PRIV(struct net_device *dev)
+{
+	char *p = netdev_priv(dev);
+	return (struct etherh_priv *)(p + sizeof(struct ei_device));
+}
+
 static inline void etherh_set_ctrl(struct etherh_priv *eh, unsigned int mask)
 {
 	eh->ctrl |= mask;
@@ -144,8 +149,7 @@
 static void
 etherh_setif(struct net_device *dev)
 {
-	struct etherh_priv *eh = netdev_priv(dev);
-	struct ei_device *ei_local = &eh->eidev;
+	struct etherh_priv *eh = PRIV(dev);
 	unsigned long addr, flags;
 
 	local_irq_save(flags);
@@ -188,8 +192,7 @@
 static int
 etherh_getifstat(struct net_device *dev)
 {
-	struct etherh_priv *eh = netdev_priv(dev);
-	struct ei_device *ei_local = &eh->eidev;
+	struct etherh_priv *eh = PRIV(dev);
 	int stat = 0;
 
 	switch (eh->id) {
@@ -551,13 +554,13 @@
 
 	etherh_banner();
 
-	dev = alloc_ei_netdev();
+	dev = __alloc_ei_netdev(sizeof(struct etherh_priv));
 	if (!dev) {
 		ret = -ENOMEM;
 		goto out;
 	}
 
-	eh = netdev_priv(dev);
+	eh = PRIV(dev);
 
 	spin_lock_init(&eh->eidev.page_lock);
 
@@ -712,7 +715,6 @@
 	free_netdev(dev);
 
 	ec->ops = NULL;
-	kfree(ec->irq_data);
 }
 
 static const struct ecard_id etherh_ids[] = {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help