
From: Dominik Brodowski <linux@dominikbrodowski.de>

This patch updates pcmcia network drivers so that their class devices are
linked to the correct physical device.  Based on an patch by Adam Belay, but
adapted to a different pcmcia driver model implementation.

Signed-off-by: Dominik Brodowski <linux@brodo.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/net/pcmcia/3c574_cs.c    |    1 +
 25-akpm/drivers/net/pcmcia/3c589_cs.c    |    1 +
 25-akpm/drivers/net/pcmcia/axnet_cs.c    |    1 +
 25-akpm/drivers/net/pcmcia/com20020_cs.c |    1 +
 25-akpm/drivers/net/pcmcia/fmvj18x_cs.c  |    1 +
 25-akpm/drivers/net/pcmcia/ibmtr_cs.c    |    1 +
 25-akpm/drivers/net/pcmcia/nmclan_cs.c   |    1 +
 25-akpm/drivers/net/pcmcia/pcnet_cs.c    |    1 +
 25-akpm/drivers/net/pcmcia/smc91c92_cs.c |    1 +
 25-akpm/drivers/net/pcmcia/xirc2ps_cs.c  |    1 +
 25-akpm/include/pcmcia/ds.h              |    1 +
 11 files changed, 11 insertions(+)

diff -puN drivers/net/pcmcia/3c574_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/3c574_cs.c
--- 25/drivers/net/pcmcia/3c574_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.111621144 -0800
+++ 25-akpm/drivers/net/pcmcia/3c574_cs.c	2004-12-03 18:44:47.131618104 -0800
@@ -519,6 +519,7 @@ static void tc574_config(dev_link_t *lin
 
 	link->state &= ~DEV_CONFIG_PENDING;
 	link->dev = &lp->node;
+	SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
 	if (register_netdev(dev) != 0) {
 		printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
diff -puN drivers/net/pcmcia/3c589_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/3c589_cs.c
--- 25/drivers/net/pcmcia/3c589_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.112620992 -0800
+++ 25-akpm/drivers/net/pcmcia/3c589_cs.c	2004-12-03 18:44:47.132617952 -0800
@@ -391,6 +391,7 @@ static void tc589_config(dev_link_t *lin
     
     link->dev = &lp->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
     if (register_netdev(dev) != 0) {
 	printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
diff -puN drivers/net/pcmcia/axnet_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/axnet_cs.c
--- 25/drivers/net/pcmcia/axnet_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.114620688 -0800
+++ 25-akpm/drivers/net/pcmcia/axnet_cs.c	2004-12-03 18:44:47.134617648 -0800
@@ -458,6 +458,7 @@ static void axnet_config(dev_link_t *lin
     info->phy_id = (i < 32) ? i : -1;
     link->dev = &info->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
     if (register_netdev(dev) != 0) {
 	printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
diff -puN drivers/net/pcmcia/com20020_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/com20020_cs.c
--- 25/drivers/net/pcmcia/com20020_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.116620384 -0800
+++ 25-akpm/drivers/net/pcmcia/com20020_cs.c	2004-12-03 18:44:47.135617496 -0800
@@ -394,6 +394,7 @@ static void com20020_config(dev_link_t *
 
     link->dev = &info->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
     i = com20020_found(dev, 0);	/* calls register_netdev */
     
diff -puN drivers/net/pcmcia/fmvj18x_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/fmvj18x_cs.c
--- 25/drivers/net/pcmcia/fmvj18x_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.118620080 -0800
+++ 25-akpm/drivers/net/pcmcia/fmvj18x_cs.c	2004-12-03 18:44:47.136617344 -0800
@@ -591,6 +591,7 @@ static void fmvj18x_config(dev_link_t *l
     lp->cardtype = cardtype;
     link->dev = &lp->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
     if (register_netdev(dev) != 0) {
 	printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n");
diff -puN drivers/net/pcmcia/ibmtr_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/ibmtr_cs.c
--- 25/drivers/net/pcmcia/ibmtr_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.119619928 -0800
+++ 25-akpm/drivers/net/pcmcia/ibmtr_cs.c	2004-12-03 18:44:47.137617192 -0800
@@ -367,6 +367,7 @@ static void ibmtr_config(dev_link_t *lin
 
     link->dev = &info->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
     i = ibmtr_probe_card(dev);
     if (i != 0) {
diff -puN drivers/net/pcmcia/nmclan_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/nmclan_cs.c
--- 25/drivers/net/pcmcia/nmclan_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.121619624 -0800
+++ 25-akpm/drivers/net/pcmcia/nmclan_cs.c	2004-12-03 18:44:47.138617040 -0800
@@ -775,6 +775,7 @@ static void nmclan_config(dev_link_t *li
 
   link->dev = &lp->node;
   link->state &= ~DEV_CONFIG_PENDING;
+  SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
   i = register_netdev(dev);
   if (i != 0) {
diff -puN drivers/net/pcmcia/pcnet_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/pcnet_cs.c
--- 25/drivers/net/pcmcia/pcnet_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.122619472 -0800
+++ 25-akpm/drivers/net/pcmcia/pcnet_cs.c	2004-12-03 18:44:47.140616736 -0800
@@ -722,6 +722,7 @@ static void pcnet_config(dev_link_t *lin
 
     link->dev = &info->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
     dev->poll_controller = ei_poll;
diff -puN drivers/net/pcmcia/smc91c92_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/smc91c92_cs.c
--- 25/drivers/net/pcmcia/smc91c92_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.124619168 -0800
+++ 25-akpm/drivers/net/pcmcia/smc91c92_cs.c	2004-12-03 18:44:47.142616432 -0800
@@ -1024,6 +1024,7 @@ static void smc91c92_config(dev_link_t *
 
     link->dev = &smc->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
     if (register_netdev(dev) != 0) {
 	printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n");
diff -puN drivers/net/pcmcia/xirc2ps_cs.c~pcmcia-set_netdev-for-network-devices drivers/net/pcmcia/xirc2ps_cs.c
--- 25/drivers/net/pcmcia/xirc2ps_cs.c~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.126618864 -0800
+++ 25-akpm/drivers/net/pcmcia/xirc2ps_cs.c	2004-12-03 18:44:47.143616280 -0800
@@ -1121,6 +1121,7 @@ xirc2ps_config(dev_link_t * link)
 
     link->dev = &local->node;
     link->state &= ~DEV_CONFIG_PENDING;
+    SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 
     if ((err=register_netdev(dev))) {
 	printk(KNOT_XIRC "register_netdev() failed\n");
diff -puN include/pcmcia/ds.h~pcmcia-set_netdev-for-network-devices include/pcmcia/ds.h
--- 25/include/pcmcia/ds.h~pcmcia-set_netdev-for-network-devices	2004-12-03 18:44:47.127618712 -0800
+++ 25-akpm/include/pcmcia/ds.h	2004-12-03 18:44:47.144616128 -0800
@@ -173,6 +173,7 @@ struct pcmcia_device {
 #define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
 
 #define handle_to_pdev(handle) container_of(handle, struct pcmcia_device, client);
+#define handle_to_dev(handle) ((container_of(handle, struct pcmcia_device, client))->dev)
 
 /* error reporting */
 void cs_error(client_handle_t handle, int func, int ret);
_
