[PCMCIA][1/3] driver model integration for PCMCIA network drivers

Dominik Brodowski linux at dominikbrodowski.de
Fri Oct 22 15:52:51 EDT 2004


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 at dominikbrodowski.de>

diff -ruN linux-original/drivers/net/pcmcia/3c574_cs.c linux/drivers/net/pcmcia/3c574_cs.c
--- linux-original/drivers/net/pcmcia/3c574_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/3c574_cs.c	2004-10-22 21:11:10.410131672 +0200
@@ -519,6 +519,7 @@
 
 	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 -ruN linux-original/drivers/net/pcmcia/3c589_cs.c linux/drivers/net/pcmcia/3c589_cs.c
--- linux-original/drivers/net/pcmcia/3c589_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/3c589_cs.c	2004-10-22 21:11:10.415130912 +0200
@@ -391,6 +391,7 @@
     
     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 -ruN linux-original/drivers/net/pcmcia/axnet_cs.c linux/drivers/net/pcmcia/axnet_cs.c
--- linux-original/drivers/net/pcmcia/axnet_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/axnet_cs.c	2004-10-22 21:11:10.421130000 +0200
@@ -458,6 +458,7 @@
     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 -ruN linux-original/drivers/net/pcmcia/com20020_cs.c linux/drivers/net/pcmcia/com20020_cs.c
--- linux-original/drivers/net/pcmcia/com20020_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/com20020_cs.c	2004-10-22 21:11:10.422129848 +0200
@@ -394,6 +394,7 @@
 
     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 -ruN linux-original/drivers/net/pcmcia/fmvj18x_cs.c linux/drivers/net/pcmcia/fmvj18x_cs.c
--- linux-original/drivers/net/pcmcia/fmvj18x_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/fmvj18x_cs.c	2004-10-22 21:11:10.423129696 +0200
@@ -591,6 +591,7 @@
     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 -ruN linux-original/drivers/net/pcmcia/ibmtr_cs.c linux/drivers/net/pcmcia/ibmtr_cs.c
--- linux-original/drivers/net/pcmcia/ibmtr_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/ibmtr_cs.c	2004-10-22 21:11:10.440127112 +0200
@@ -366,6 +366,7 @@
 
     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 -ruN linux-original/drivers/net/pcmcia/nmclan_cs.c linux/drivers/net/pcmcia/nmclan_cs.c
--- linux-original/drivers/net/pcmcia/nmclan_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/nmclan_cs.c	2004-10-22 21:11:10.443126656 +0200
@@ -775,6 +775,7 @@
 
   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 -ruN linux-original/drivers/net/pcmcia/pcnet_cs.c linux/drivers/net/pcmcia/pcnet_cs.c
--- linux-original/drivers/net/pcmcia/pcnet_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/pcnet_cs.c	2004-10-22 21:11:10.470122552 +0200
@@ -722,6 +722,7 @@
 
     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 -ruN linux-original/drivers/net/pcmcia/smc91c92_cs.c linux/drivers/net/pcmcia/smc91c92_cs.c
--- linux-original/drivers/net/pcmcia/smc91c92_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/smc91c92_cs.c	2004-10-22 21:11:10.477121488 +0200
@@ -1024,6 +1024,7 @@
 
     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 -ruN linux-original/drivers/net/pcmcia/xirc2ps_cs.c linux/drivers/net/pcmcia/xirc2ps_cs.c
--- linux-original/drivers/net/pcmcia/xirc2ps_cs.c	2004-10-22 16:35:42.000000000 +0200
+++ linux/drivers/net/pcmcia/xirc2ps_cs.c	2004-10-22 21:11:10.482120728 +0200
@@ -1121,6 +1121,7 @@
 
     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 -ruN linux-original/include/pcmcia/ds.h linux/include/pcmcia/ds.h
--- linux-original/include/pcmcia/ds.h	2004-10-22 16:38:43.000000000 +0200
+++ linux/include/pcmcia/ds.h	2004-10-22 21:01:16.000000000 +0200
@@ -173,6 +173,7 @@
 #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);



More information about the linux-pcmcia mailing list