aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c589_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/3c589_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/3c589_cs.c')
-rw-r--r--drivers/net/pcmcia/3c589_cs.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 7e8036f2e19e..4faf1fa08254 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -105,7 +105,7 @@ enum RxFilter {
105#define TX_TIMEOUT ((400*HZ)/1000) 105#define TX_TIMEOUT ((400*HZ)/1000)
106 106
107struct el3_private { 107struct el3_private {
108 dev_link_t link; 108 struct pcmcia_device *p_dev;
109 dev_node_t node; 109 dev_node_t node;
110 struct net_device_stats stats; 110 struct net_device_stats stats;
111 /* For transceiver monitoring */ 111 /* For transceiver monitoring */
@@ -173,8 +173,8 @@ static void tc589_detach(struct pcmcia_device *p_dev);
173static int tc589_attach(struct pcmcia_device *p_dev) 173static int tc589_attach(struct pcmcia_device *p_dev)
174{ 174{
175 struct el3_private *lp; 175 struct el3_private *lp;
176 dev_link_t *link;
177 struct net_device *dev; 176 struct net_device *dev;
177 dev_link_t *link = dev_to_instance(p_dev);
178 178
179 DEBUG(0, "3c589_attach()\n"); 179 DEBUG(0, "3c589_attach()\n");
180 180
@@ -183,8 +183,8 @@ static int tc589_attach(struct pcmcia_device *p_dev)
183 if (!dev) 183 if (!dev)
184 return -ENOMEM; 184 return -ENOMEM;
185 lp = netdev_priv(dev); 185 lp = netdev_priv(dev);
186 link = &lp->link;
187 link->priv = dev; 186 link->priv = dev;
187 lp->p_dev = p_dev;
188 188
189 spin_lock_init(&lp->lock); 189 spin_lock_init(&lp->lock);
190 link->io.NumPorts1 = 16; 190 link->io.NumPorts1 = 16;
@@ -212,9 +212,6 @@ static int tc589_attach(struct pcmcia_device *p_dev)
212#endif 212#endif
213 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 213 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
214 214
215 link->handle = p_dev;
216 p_dev->instance = link;
217
218 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 215 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
219 tc589_config(link); 216 tc589_config(link);
220 217
@@ -237,7 +234,7 @@ static void tc589_detach(struct pcmcia_device *p_dev)
237 234
238 DEBUG(0, "3c589_detach(0x%p)\n", link); 235 DEBUG(0, "3c589_detach(0x%p)\n", link);
239 236
240 if (link->dev) 237 if (link->dev_node)
241 unregister_netdev(dev); 238 unregister_netdev(dev);
242 239
243 if (link->state & DEV_CONFIG) 240 if (link->state & DEV_CONFIG)
@@ -345,13 +342,13 @@ static void tc589_config(dev_link_t *link)
345 else 342 else
346 printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); 343 printk(KERN_ERR "3c589_cs: invalid if_port requested\n");
347 344
348 link->dev = &lp->node; 345 link->dev_node = &lp->node;
349 link->state &= ~DEV_CONFIG_PENDING; 346 link->state &= ~DEV_CONFIG_PENDING;
350 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 347 SET_NETDEV_DEV(dev, &handle_to_dev(handle));
351 348
352 if (register_netdev(dev) != 0) { 349 if (register_netdev(dev) != 0) {
353 printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); 350 printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
354 link->dev = NULL; 351 link->dev_node = NULL;
355 goto failed; 352 goto failed;
356 } 353 }
357 354
@@ -572,7 +569,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
572static int el3_open(struct net_device *dev) 569static int el3_open(struct net_device *dev)
573{ 570{
574 struct el3_private *lp = netdev_priv(dev); 571 struct el3_private *lp = netdev_priv(dev);
575 dev_link_t *link = &lp->link; 572 dev_link_t *link = lp->p_dev;
576 573
577 if (!DEV_OK(link)) 574 if (!DEV_OK(link))
578 return -ENODEV; 575 return -ENODEV;
@@ -833,7 +830,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
833{ 830{
834 struct el3_private *lp = netdev_priv(dev); 831 struct el3_private *lp = netdev_priv(dev);
835 unsigned long flags; 832 unsigned long flags;
836 dev_link_t *link = &lp->link; 833 dev_link_t *link = lp->p_dev;
837 834
838 if (DEV_OK(link)) { 835 if (DEV_OK(link)) {
839 spin_lock_irqsave(&lp->lock, flags); 836 spin_lock_irqsave(&lp->lock, flags);
@@ -935,7 +932,7 @@ static int el3_rx(struct net_device *dev)
935static void set_multicast_list(struct net_device *dev) 932static void set_multicast_list(struct net_device *dev)
936{ 933{
937 struct el3_private *lp = netdev_priv(dev); 934 struct el3_private *lp = netdev_priv(dev);
938 dev_link_t *link = &lp->link; 935 dev_link_t *link = lp->p_dev;
939 kio_addr_t ioaddr = dev->base_addr; 936 kio_addr_t ioaddr = dev->base_addr;
940 u16 opts = SetRxFilter | RxStation | RxBroadcast; 937 u16 opts = SetRxFilter | RxStation | RxBroadcast;
941 938
@@ -950,7 +947,7 @@ static void set_multicast_list(struct net_device *dev)
950static int el3_close(struct net_device *dev) 947static int el3_close(struct net_device *dev)
951{ 948{
952 struct el3_private *lp = netdev_priv(dev); 949 struct el3_private *lp = netdev_priv(dev);
953 dev_link_t *link = &lp->link; 950 dev_link_t *link = lp->p_dev;
954 kio_addr_t ioaddr = dev->base_addr; 951 kio_addr_t ioaddr = dev->base_addr;
955 952
956 DEBUG(1, "%s: shutting down ethercard.\n", dev->name); 953 DEBUG(1, "%s: shutting down ethercard.\n", dev->name);