aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c574_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/net/pcmcia/3c574_cs.c
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia/3c574_cs.c')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 179c9b7ad044..b65758d3c6c5 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -204,7 +204,7 @@ enum Window4 { /* Window 4: Xcvr/media bits. */
204#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */ 204#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */
205 205
206struct el3_private { 206struct el3_private {
207 dev_link_t link; 207 struct pcmcia_device *p_dev;
208 dev_node_t node; 208 dev_node_t node;
209 struct net_device_stats stats; 209 struct net_device_stats stats;
210 u16 advertising, partner; /* NWay media advertisement */ 210 u16 advertising, partner; /* NWay media advertisement */
@@ -259,8 +259,8 @@ static void tc574_detach(struct pcmcia_device *p_dev);
259static int tc574_attach(struct pcmcia_device *p_dev) 259static int tc574_attach(struct pcmcia_device *p_dev)
260{ 260{
261 struct el3_private *lp; 261 struct el3_private *lp;
262 dev_link_t *link;
263 struct net_device *dev; 262 struct net_device *dev;
263 dev_link_t *link = dev_to_instance(p_dev);
264 264
265 DEBUG(0, "3c574_attach()\n"); 265 DEBUG(0, "3c574_attach()\n");
266 266
@@ -269,8 +269,8 @@ static int tc574_attach(struct pcmcia_device *p_dev)
269 if (!dev) 269 if (!dev)
270 return -ENOMEM; 270 return -ENOMEM;
271 lp = netdev_priv(dev); 271 lp = netdev_priv(dev);
272 link = &lp->link;
273 link->priv = dev; 272 link->priv = dev;
273 lp->p_dev = p_dev;
274 274
275 spin_lock_init(&lp->window_lock); 275 spin_lock_init(&lp->window_lock);
276 link->io.NumPorts1 = 32; 276 link->io.NumPorts1 = 32;
@@ -297,9 +297,6 @@ static int tc574_attach(struct pcmcia_device *p_dev)
297 dev->watchdog_timeo = TX_TIMEOUT; 297 dev->watchdog_timeo = TX_TIMEOUT;
298#endif 298#endif
299 299
300 link->handle = p_dev;
301 p_dev->instance = link;
302
303 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 300 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
304 tc574_config(link); 301 tc574_config(link);
305 302
@@ -322,7 +319,7 @@ static void tc574_detach(struct pcmcia_device *p_dev)
322 319
323 DEBUG(0, "3c574_detach(0x%p)\n", link); 320 DEBUG(0, "3c574_detach(0x%p)\n", link);
324 321
325 if (link->dev) 322 if (link->dev_node)
326 unregister_netdev(dev); 323 unregister_netdev(dev);
327 324
328 if (link->state & DEV_CONFIG) 325 if (link->state & DEV_CONFIG)
@@ -473,12 +470,12 @@ static void tc574_config(dev_link_t *link)
473 } 470 }
474 471
475 link->state &= ~DEV_CONFIG_PENDING; 472 link->state &= ~DEV_CONFIG_PENDING;
476 link->dev = &lp->node; 473 link->dev_node = &lp->node;
477 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 474 SET_NETDEV_DEV(dev, &handle_to_dev(handle));
478 475
479 if (register_netdev(dev) != 0) { 476 if (register_netdev(dev) != 0) {
480 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); 477 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
481 link->dev = NULL; 478 link->dev_node = NULL;
482 goto failed; 479 goto failed;
483 } 480 }
484 481
@@ -742,7 +739,7 @@ static void tc574_reset(struct net_device *dev)
742static int el3_open(struct net_device *dev) 739static int el3_open(struct net_device *dev)
743{ 740{
744 struct el3_private *lp = netdev_priv(dev); 741 struct el3_private *lp = netdev_priv(dev);
745 dev_link_t *link = &lp->link; 742 dev_link_t *link = lp->p_dev;
746 743
747 if (!DEV_OK(link)) 744 if (!DEV_OK(link))
748 return -ENODEV; 745 return -ENODEV;
@@ -1188,7 +1185,7 @@ static int el3_close(struct net_device *dev)
1188{ 1185{
1189 kio_addr_t ioaddr = dev->base_addr; 1186 kio_addr_t ioaddr = dev->base_addr;
1190 struct el3_private *lp = netdev_priv(dev); 1187 struct el3_private *lp = netdev_priv(dev);
1191 dev_link_t *link = &lp->link; 1188 dev_link_t *link = lp->p_dev;
1192 1189
1193 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 1190 DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
1194 1191