diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-05 04:45:09 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:15:57 -0500 |
commit | fd238232cd0ff4840ae6946bb338502154096d88 (patch) | |
tree | d20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/net | |
parent | a78f4dd331a4f6a396eb5849656a4a72a70a56d7 (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')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 23 | ||||
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 39 | ||||
-rw-r--r-- | drivers/net/pcmcia/fmvj18x_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/pcmcia/ibmtr_cs.c | 17 | ||||
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 21 | ||||
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 21 | ||||
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/netwave_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 98 | ||||
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 21 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.c | 46 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 61 |
20 files changed, 198 insertions, 372 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 | ||
206 | struct el3_private { | 206 | struct 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); | |||
259 | static int tc574_attach(struct pcmcia_device *p_dev) | 259 | static 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) | |||
742 | static int el3_open(struct net_device *dev) | 739 | static 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 | ||
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 | ||
107 | struct el3_private { | 107 | struct 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); | |||
173 | static int tc589_attach(struct pcmcia_device *p_dev) | 173 | static 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) | |||
572 | static int el3_open(struct net_device *dev) | 569 | static 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) | |||
935 | static void set_multicast_list(struct net_device *dev) | 932 | static 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) | |||
950 | static int el3_close(struct net_device *dev) | 947 | static 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); |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 5ca0d5718583..58dc7c3835f4 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -117,7 +117,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id, struct pt_regs *regs); | |||
117 | /*====================================================================*/ | 117 | /*====================================================================*/ |
118 | 118 | ||
119 | typedef struct axnet_dev_t { | 119 | typedef struct axnet_dev_t { |
120 | dev_link_t link; | 120 | struct pcmcia_device *p_dev; |
121 | dev_node_t node; | 121 | dev_node_t node; |
122 | caddr_t base; | 122 | caddr_t base; |
123 | struct timer_list watchdog; | 123 | struct timer_list watchdog; |
@@ -145,8 +145,8 @@ static inline axnet_dev_t *PRIV(struct net_device *dev) | |||
145 | static int axnet_attach(struct pcmcia_device *p_dev) | 145 | static int axnet_attach(struct pcmcia_device *p_dev) |
146 | { | 146 | { |
147 | axnet_dev_t *info; | 147 | axnet_dev_t *info; |
148 | dev_link_t *link; | ||
149 | struct net_device *dev; | 148 | struct net_device *dev; |
149 | dev_link_t *link = dev_to_instance(p_dev); | ||
150 | 150 | ||
151 | DEBUG(0, "axnet_attach()\n"); | 151 | DEBUG(0, "axnet_attach()\n"); |
152 | 152 | ||
@@ -157,7 +157,7 @@ static int axnet_attach(struct pcmcia_device *p_dev) | |||
157 | return -ENOMEM; | 157 | return -ENOMEM; |
158 | 158 | ||
159 | info = PRIV(dev); | 159 | info = PRIV(dev); |
160 | link = &info->link; | 160 | info->p_dev = p_dev; |
161 | link->priv = dev; | 161 | link->priv = dev; |
162 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 162 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
163 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 163 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; |
@@ -169,9 +169,6 @@ static int axnet_attach(struct pcmcia_device *p_dev) | |||
169 | dev->do_ioctl = &axnet_ioctl; | 169 | dev->do_ioctl = &axnet_ioctl; |
170 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 170 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
171 | 171 | ||
172 | link->handle = p_dev; | ||
173 | p_dev->instance = link; | ||
174 | |||
175 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 172 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
176 | axnet_config(link); | 173 | axnet_config(link); |
177 | 174 | ||
@@ -194,7 +191,7 @@ static void axnet_detach(struct pcmcia_device *p_dev) | |||
194 | 191 | ||
195 | DEBUG(0, "axnet_detach(0x%p)\n", link); | 192 | DEBUG(0, "axnet_detach(0x%p)\n", link); |
196 | 193 | ||
197 | if (link->dev) | 194 | if (link->dev_node) |
198 | unregister_netdev(dev); | 195 | unregister_netdev(dev); |
199 | 196 | ||
200 | if (link->state & DEV_CONFIG) | 197 | if (link->state & DEV_CONFIG) |
@@ -409,13 +406,13 @@ static void axnet_config(dev_link_t *link) | |||
409 | } | 406 | } |
410 | 407 | ||
411 | info->phy_id = (i < 32) ? i : -1; | 408 | info->phy_id = (i < 32) ? i : -1; |
412 | link->dev = &info->node; | 409 | link->dev_node = &info->node; |
413 | link->state &= ~DEV_CONFIG_PENDING; | 410 | link->state &= ~DEV_CONFIG_PENDING; |
414 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 411 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
415 | 412 | ||
416 | if (register_netdev(dev) != 0) { | 413 | if (register_netdev(dev) != 0) { |
417 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); | 414 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); |
418 | link->dev = NULL; | 415 | link->dev_node = NULL; |
419 | goto failed; | 416 | goto failed; |
420 | } | 417 | } |
421 | 418 | ||
@@ -543,7 +540,7 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value) | |||
543 | static int axnet_open(struct net_device *dev) | 540 | static int axnet_open(struct net_device *dev) |
544 | { | 541 | { |
545 | axnet_dev_t *info = PRIV(dev); | 542 | axnet_dev_t *info = PRIV(dev); |
546 | dev_link_t *link = &info->link; | 543 | dev_link_t *link = info->p_dev; |
547 | 544 | ||
548 | DEBUG(2, "axnet_open('%s')\n", dev->name); | 545 | DEBUG(2, "axnet_open('%s')\n", dev->name); |
549 | 546 | ||
@@ -569,7 +566,7 @@ static int axnet_open(struct net_device *dev) | |||
569 | static int axnet_close(struct net_device *dev) | 566 | static int axnet_close(struct net_device *dev) |
570 | { | 567 | { |
571 | axnet_dev_t *info = PRIV(dev); | 568 | axnet_dev_t *info = PRIV(dev); |
572 | dev_link_t *link = &info->link; | 569 | dev_link_t *link = info->p_dev; |
573 | 570 | ||
574 | DEBUG(2, "axnet_close('%s')\n", dev->name); | 571 | DEBUG(2, "axnet_close('%s')\n", dev->name); |
575 | 572 | ||
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index e14d3d18b97d..44da01cdd26f 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -140,7 +140,6 @@ typedef struct com20020_dev_t { | |||
140 | 140 | ||
141 | static int com20020_attach(struct pcmcia_device *p_dev) | 141 | static int com20020_attach(struct pcmcia_device *p_dev) |
142 | { | 142 | { |
143 | dev_link_t *link; | ||
144 | com20020_dev_t *info; | 143 | com20020_dev_t *info; |
145 | struct net_device *dev; | 144 | struct net_device *dev; |
146 | struct arcnet_local *lp; | 145 | struct arcnet_local *lp; |
@@ -148,10 +147,6 @@ static int com20020_attach(struct pcmcia_device *p_dev) | |||
148 | DEBUG(0, "com20020_attach()\n"); | 147 | DEBUG(0, "com20020_attach()\n"); |
149 | 148 | ||
150 | /* Create new network device */ | 149 | /* Create new network device */ |
151 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | ||
152 | if (!link) | ||
153 | return -ENOMEM; | ||
154 | |||
155 | info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); | 150 | info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); |
156 | if (!info) | 151 | if (!info) |
157 | goto fail_alloc_info; | 152 | goto fail_alloc_info; |
@@ -161,7 +156,6 @@ static int com20020_attach(struct pcmcia_device *p_dev) | |||
161 | goto fail_alloc_dev; | 156 | goto fail_alloc_dev; |
162 | 157 | ||
163 | memset(info, 0, sizeof(struct com20020_dev_t)); | 158 | memset(info, 0, sizeof(struct com20020_dev_t)); |
164 | memset(link, 0, sizeof(struct dev_link_t)); | ||
165 | lp = dev->priv; | 159 | lp = dev->priv; |
166 | lp->timeout = timeout; | 160 | lp->timeout = timeout; |
167 | lp->backplane = backplane; | 161 | lp->backplane = backplane; |
@@ -172,27 +166,26 @@ static int com20020_attach(struct pcmcia_device *p_dev) | |||
172 | /* fill in our module parameters as defaults */ | 166 | /* fill in our module parameters as defaults */ |
173 | dev->dev_addr[0] = node; | 167 | dev->dev_addr[0] = node; |
174 | 168 | ||
175 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 169 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
176 | link->io.NumPorts1 = 16; | 170 | p_dev->io.NumPorts1 = 16; |
177 | link->io.IOAddrLines = 16; | 171 | p_dev->io.IOAddrLines = 16; |
178 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 172 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
179 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 173 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; |
180 | link->conf.Attributes = CONF_ENABLE_IRQ; | 174 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
181 | link->conf.IntType = INT_MEMORY_AND_IO; | 175 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
182 | link->conf.Present = PRESENT_OPTION; | 176 | p_dev->conf.Present = PRESENT_OPTION; |
183 | 177 | ||
184 | link->irq.Instance = info->dev = dev; | 178 | p_dev->irq.Instance = info->dev = dev; |
185 | link->priv = info; | 179 | p_dev->priv = info; |
186 | 180 | ||
187 | link->state |= DEV_PRESENT; | 181 | p_dev->state |= DEV_PRESENT; |
188 | com20020_config(link); | 182 | com20020_config(p_dev); |
189 | 183 | ||
190 | return 0; | 184 | return 0; |
191 | 185 | ||
192 | fail_alloc_dev: | 186 | fail_alloc_dev: |
193 | kfree(info); | 187 | kfree(info); |
194 | fail_alloc_info: | 188 | fail_alloc_info: |
195 | kfree(link); | ||
196 | return -ENOMEM; | 189 | return -ENOMEM; |
197 | } /* com20020_attach */ | 190 | } /* com20020_attach */ |
198 | 191 | ||
@@ -215,7 +208,7 @@ static void com20020_detach(struct pcmcia_device *p_dev) | |||
215 | 208 | ||
216 | DEBUG(0, "com20020_detach(0x%p)\n", link); | 209 | DEBUG(0, "com20020_detach(0x%p)\n", link); |
217 | 210 | ||
218 | if (link->dev) { | 211 | if (link->dev_node) { |
219 | DEBUG(1,"unregister...\n"); | 212 | DEBUG(1,"unregister...\n"); |
220 | 213 | ||
221 | unregister_netdev(dev); | 214 | unregister_netdev(dev); |
@@ -244,8 +237,6 @@ static void com20020_detach(struct pcmcia_device *p_dev) | |||
244 | DEBUG(1,"kfree2...\n"); | 237 | DEBUG(1,"kfree2...\n"); |
245 | kfree(info); | 238 | kfree(info); |
246 | } | 239 | } |
247 | DEBUG(1,"kfree3...\n"); | ||
248 | kfree(link); | ||
249 | 240 | ||
250 | } /* com20020_detach */ | 241 | } /* com20020_detach */ |
251 | 242 | ||
@@ -341,7 +332,7 @@ static void com20020_config(dev_link_t *link) | |||
341 | lp->card_name = "PCMCIA COM20020"; | 332 | lp->card_name = "PCMCIA COM20020"; |
342 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ | 333 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ |
343 | 334 | ||
344 | link->dev = &info->node; | 335 | link->dev_node = &info->node; |
345 | link->state &= ~DEV_CONFIG_PENDING; | 336 | link->state &= ~DEV_CONFIG_PENDING; |
346 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 337 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
347 | 338 | ||
@@ -349,7 +340,7 @@ static void com20020_config(dev_link_t *link) | |||
349 | 340 | ||
350 | if (i != 0) { | 341 | if (i != 0) { |
351 | DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); | 342 | DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); |
352 | link->dev = NULL; | 343 | link->dev_node = NULL; |
353 | goto failed; | 344 | goto failed; |
354 | } | 345 | } |
355 | 346 | ||
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 34bf963b1296..3f0ace4ed732 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -116,7 +116,7 @@ typedef enum { MBH10302, MBH10304, TDK, CONTEC, LA501, UNGERMANN, | |||
116 | driver specific data structure | 116 | driver specific data structure |
117 | */ | 117 | */ |
118 | typedef struct local_info_t { | 118 | typedef struct local_info_t { |
119 | dev_link_t link; | 119 | struct pcmcia_device *p_dev; |
120 | dev_node_t node; | 120 | dev_node_t node; |
121 | struct net_device_stats stats; | 121 | struct net_device_stats stats; |
122 | long open_time; | 122 | long open_time; |
@@ -231,8 +231,8 @@ typedef struct local_info_t { | |||
231 | static int fmvj18x_attach(struct pcmcia_device *p_dev) | 231 | static int fmvj18x_attach(struct pcmcia_device *p_dev) |
232 | { | 232 | { |
233 | local_info_t *lp; | 233 | local_info_t *lp; |
234 | dev_link_t *link; | ||
235 | struct net_device *dev; | 234 | struct net_device *dev; |
235 | dev_link_t *link = dev_to_instance(p_dev); | ||
236 | 236 | ||
237 | DEBUG(0, "fmvj18x_attach()\n"); | 237 | DEBUG(0, "fmvj18x_attach()\n"); |
238 | 238 | ||
@@ -241,8 +241,8 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev) | |||
241 | if (!dev) | 241 | if (!dev) |
242 | return -ENOMEM; | 242 | return -ENOMEM; |
243 | lp = netdev_priv(dev); | 243 | lp = netdev_priv(dev); |
244 | link = &lp->link; | ||
245 | link->priv = dev; | 244 | link->priv = dev; |
245 | lp->p_dev = p_dev; | ||
246 | 246 | ||
247 | /* The io structure describes IO port mapping */ | 247 | /* The io structure describes IO port mapping */ |
248 | link->io.NumPorts1 = 32; | 248 | link->io.NumPorts1 = 32; |
@@ -273,9 +273,6 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev) | |||
273 | #endif | 273 | #endif |
274 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 274 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
275 | 275 | ||
276 | link->handle = p_dev; | ||
277 | p_dev->instance = link; | ||
278 | |||
279 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 276 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
280 | fmvj18x_config(link); | 277 | fmvj18x_config(link); |
281 | 278 | ||
@@ -291,7 +288,7 @@ static void fmvj18x_detach(struct pcmcia_device *p_dev) | |||
291 | 288 | ||
292 | DEBUG(0, "fmvj18x_detach(0x%p)\n", link); | 289 | DEBUG(0, "fmvj18x_detach(0x%p)\n", link); |
293 | 290 | ||
294 | if (link->dev) | 291 | if (link->dev_node) |
295 | unregister_netdev(dev); | 292 | unregister_netdev(dev); |
296 | 293 | ||
297 | if (link->state & DEV_CONFIG) | 294 | if (link->state & DEV_CONFIG) |
@@ -539,13 +536,13 @@ static void fmvj18x_config(dev_link_t *link) | |||
539 | } | 536 | } |
540 | 537 | ||
541 | lp->cardtype = cardtype; | 538 | lp->cardtype = cardtype; |
542 | link->dev = &lp->node; | 539 | link->dev_node = &lp->node; |
543 | link->state &= ~DEV_CONFIG_PENDING; | 540 | link->state &= ~DEV_CONFIG_PENDING; |
544 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 541 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
545 | 542 | ||
546 | if (register_netdev(dev) != 0) { | 543 | if (register_netdev(dev) != 0) { |
547 | printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); | 544 | printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); |
548 | link->dev = NULL; | 545 | link->dev_node = NULL; |
549 | goto failed; | 546 | goto failed; |
550 | } | 547 | } |
551 | 548 | ||
@@ -1125,7 +1122,7 @@ static int fjn_config(struct net_device *dev, struct ifmap *map){ | |||
1125 | static int fjn_open(struct net_device *dev) | 1122 | static int fjn_open(struct net_device *dev) |
1126 | { | 1123 | { |
1127 | struct local_info_t *lp = netdev_priv(dev); | 1124 | struct local_info_t *lp = netdev_priv(dev); |
1128 | dev_link_t *link = &lp->link; | 1125 | dev_link_t *link = lp->p_dev; |
1129 | 1126 | ||
1130 | DEBUG(4, "fjn_open('%s').\n", dev->name); | 1127 | DEBUG(4, "fjn_open('%s').\n", dev->name); |
1131 | 1128 | ||
@@ -1150,7 +1147,7 @@ static int fjn_open(struct net_device *dev) | |||
1150 | static int fjn_close(struct net_device *dev) | 1147 | static int fjn_close(struct net_device *dev) |
1151 | { | 1148 | { |
1152 | struct local_info_t *lp = netdev_priv(dev); | 1149 | struct local_info_t *lp = netdev_priv(dev); |
1153 | dev_link_t *link = &lp->link; | 1150 | dev_link_t *link = lp->p_dev; |
1154 | kio_addr_t ioaddr = dev->base_addr; | 1151 | kio_addr_t ioaddr = dev->base_addr; |
1155 | 1152 | ||
1156 | DEBUG(4, "fjn_close('%s').\n", dev->name); | 1153 | DEBUG(4, "fjn_close('%s').\n", dev->name); |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 904c5cb04e71..f4c3dd870aca 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -113,7 +113,7 @@ static void ibmtr_detach(struct pcmcia_device *p_dev); | |||
113 | /*====================================================================*/ | 113 | /*====================================================================*/ |
114 | 114 | ||
115 | typedef struct ibmtr_dev_t { | 115 | typedef struct ibmtr_dev_t { |
116 | dev_link_t link; | 116 | struct pcmcia_device *p_dev; |
117 | struct net_device *dev; | 117 | struct net_device *dev; |
118 | dev_node_t node; | 118 | dev_node_t node; |
119 | window_handle_t sram_win_handle; | 119 | window_handle_t sram_win_handle; |
@@ -141,8 +141,8 @@ static struct ethtool_ops netdev_ethtool_ops = { | |||
141 | static int ibmtr_attach(struct pcmcia_device *p_dev) | 141 | static int ibmtr_attach(struct pcmcia_device *p_dev) |
142 | { | 142 | { |
143 | ibmtr_dev_t *info; | 143 | ibmtr_dev_t *info; |
144 | dev_link_t *link; | ||
145 | struct net_device *dev; | 144 | struct net_device *dev; |
145 | dev_link_t *link = dev_to_instance(p_dev); | ||
146 | 146 | ||
147 | DEBUG(0, "ibmtr_attach()\n"); | 147 | DEBUG(0, "ibmtr_attach()\n"); |
148 | 148 | ||
@@ -156,7 +156,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev) | |||
156 | return -ENOMEM; | 156 | return -ENOMEM; |
157 | } | 157 | } |
158 | 158 | ||
159 | link = &info->link; | 159 | info->p_dev = p_dev; |
160 | link->priv = info; | 160 | link->priv = info; |
161 | info->ti = netdev_priv(dev); | 161 | info->ti = netdev_priv(dev); |
162 | 162 | ||
@@ -171,11 +171,8 @@ static int ibmtr_attach(struct pcmcia_device *p_dev) | |||
171 | link->conf.Present = PRESENT_OPTION; | 171 | link->conf.Present = PRESENT_OPTION; |
172 | 172 | ||
173 | link->irq.Instance = info->dev = dev; | 173 | link->irq.Instance = info->dev = dev; |
174 | |||
175 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | ||
176 | 174 | ||
177 | link->handle = p_dev; | 175 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
178 | p_dev->instance = link; | ||
179 | 176 | ||
180 | link->state |= DEV_PRESENT; | 177 | link->state |= DEV_PRESENT; |
181 | ibmtr_config(link); | 178 | ibmtr_config(link); |
@@ -200,7 +197,7 @@ static void ibmtr_detach(struct pcmcia_device *p_dev) | |||
200 | 197 | ||
201 | DEBUG(0, "ibmtr_detach(0x%p)\n", link); | 198 | DEBUG(0, "ibmtr_detach(0x%p)\n", link); |
202 | 199 | ||
203 | if (link->dev) | 200 | if (link->dev_node) |
204 | unregister_netdev(dev); | 201 | unregister_netdev(dev); |
205 | 202 | ||
206 | { | 203 | { |
@@ -308,14 +305,14 @@ static void ibmtr_config(dev_link_t *link) | |||
308 | Adapters Technical Reference" SC30-3585 for this info. */ | 305 | Adapters Technical Reference" SC30-3585 for this info. */ |
309 | ibmtr_hw_setup(dev, mmiobase); | 306 | ibmtr_hw_setup(dev, mmiobase); |
310 | 307 | ||
311 | link->dev = &info->node; | 308 | link->dev_node = &info->node; |
312 | link->state &= ~DEV_CONFIG_PENDING; | 309 | link->state &= ~DEV_CONFIG_PENDING; |
313 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 310 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
314 | 311 | ||
315 | i = ibmtr_probe_card(dev); | 312 | i = ibmtr_probe_card(dev); |
316 | if (i != 0) { | 313 | if (i != 0) { |
317 | printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n"); | 314 | printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n"); |
318 | link->dev = NULL; | 315 | link->dev_node = NULL; |
319 | goto failed; | 316 | goto failed; |
320 | } | 317 | } |
321 | 318 | ||
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index c25d9451d574..0ccca12d9d6e 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -362,7 +362,7 @@ typedef struct _mace_statistics { | |||
362 | } mace_statistics; | 362 | } mace_statistics; |
363 | 363 | ||
364 | typedef struct _mace_private { | 364 | typedef struct _mace_private { |
365 | dev_link_t link; | 365 | struct pcmcia_device *p_dev; |
366 | dev_node_t node; | 366 | dev_node_t node; |
367 | struct net_device_stats linux_stats; /* Linux statistics counters */ | 367 | struct net_device_stats linux_stats; /* Linux statistics counters */ |
368 | mace_statistics mace_stats; /* MACE chip statistics counters */ | 368 | mace_statistics mace_stats; /* MACE chip statistics counters */ |
@@ -446,8 +446,8 @@ nmclan_attach | |||
446 | static int nmclan_attach(struct pcmcia_device *p_dev) | 446 | static int nmclan_attach(struct pcmcia_device *p_dev) |
447 | { | 447 | { |
448 | mace_private *lp; | 448 | mace_private *lp; |
449 | dev_link_t *link; | ||
450 | struct net_device *dev; | 449 | struct net_device *dev; |
450 | dev_link_t *link = dev_to_instance(p_dev); | ||
451 | 451 | ||
452 | DEBUG(0, "nmclan_attach()\n"); | 452 | DEBUG(0, "nmclan_attach()\n"); |
453 | DEBUG(1, "%s\n", rcsid); | 453 | DEBUG(1, "%s\n", rcsid); |
@@ -457,7 +457,7 @@ static int nmclan_attach(struct pcmcia_device *p_dev) | |||
457 | if (!dev) | 457 | if (!dev) |
458 | return -ENOMEM; | 458 | return -ENOMEM; |
459 | lp = netdev_priv(dev); | 459 | lp = netdev_priv(dev); |
460 | link = &lp->link; | 460 | lp->p_dev = p_dev; |
461 | link->priv = dev; | 461 | link->priv = dev; |
462 | 462 | ||
463 | spin_lock_init(&lp->bank_lock); | 463 | spin_lock_init(&lp->bank_lock); |
@@ -488,9 +488,6 @@ static int nmclan_attach(struct pcmcia_device *p_dev) | |||
488 | dev->watchdog_timeo = TX_TIMEOUT; | 488 | dev->watchdog_timeo = TX_TIMEOUT; |
489 | #endif | 489 | #endif |
490 | 490 | ||
491 | link->handle = p_dev; | ||
492 | p_dev->instance = link; | ||
493 | |||
494 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 491 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
495 | nmclan_config(link); | 492 | nmclan_config(link); |
496 | 493 | ||
@@ -512,7 +509,7 @@ static void nmclan_detach(struct pcmcia_device *p_dev) | |||
512 | 509 | ||
513 | DEBUG(0, "nmclan_detach(0x%p)\n", link); | 510 | DEBUG(0, "nmclan_detach(0x%p)\n", link); |
514 | 511 | ||
515 | if (link->dev) | 512 | if (link->dev_node) |
516 | unregister_netdev(dev); | 513 | unregister_netdev(dev); |
517 | 514 | ||
518 | if (link->state & DEV_CONFIG) | 515 | if (link->state & DEV_CONFIG) |
@@ -729,14 +726,14 @@ static void nmclan_config(dev_link_t *link) | |||
729 | else | 726 | else |
730 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); | 727 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); |
731 | 728 | ||
732 | link->dev = &lp->node; | 729 | link->dev_node = &lp->node; |
733 | link->state &= ~DEV_CONFIG_PENDING; | 730 | link->state &= ~DEV_CONFIG_PENDING; |
734 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 731 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
735 | 732 | ||
736 | i = register_netdev(dev); | 733 | i = register_netdev(dev); |
737 | if (i != 0) { | 734 | if (i != 0) { |
738 | printk(KERN_NOTICE "nmclan_cs: register_netdev() failed\n"); | 735 | printk(KERN_NOTICE "nmclan_cs: register_netdev() failed\n"); |
739 | link->dev = NULL; | 736 | link->dev_node = NULL; |
740 | goto failed; | 737 | goto failed; |
741 | } | 738 | } |
742 | 739 | ||
@@ -869,7 +866,7 @@ static int mace_open(struct net_device *dev) | |||
869 | { | 866 | { |
870 | kio_addr_t ioaddr = dev->base_addr; | 867 | kio_addr_t ioaddr = dev->base_addr; |
871 | mace_private *lp = netdev_priv(dev); | 868 | mace_private *lp = netdev_priv(dev); |
872 | dev_link_t *link = &lp->link; | 869 | dev_link_t *link = lp->p_dev; |
873 | 870 | ||
874 | if (!DEV_OK(link)) | 871 | if (!DEV_OK(link)) |
875 | return -ENODEV; | 872 | return -ENODEV; |
@@ -892,7 +889,7 @@ static int mace_close(struct net_device *dev) | |||
892 | { | 889 | { |
893 | kio_addr_t ioaddr = dev->base_addr; | 890 | kio_addr_t ioaddr = dev->base_addr; |
894 | mace_private *lp = netdev_priv(dev); | 891 | mace_private *lp = netdev_priv(dev); |
895 | dev_link_t *link = &lp->link; | 892 | dev_link_t *link = lp->p_dev; |
896 | 893 | ||
897 | DEBUG(2, "%s: shutting down ethercard.\n", dev->name); | 894 | DEBUG(2, "%s: shutting down ethercard.\n", dev->name); |
898 | 895 | ||
@@ -947,7 +944,7 @@ mace_start_xmit | |||
947 | static void mace_tx_timeout(struct net_device *dev) | 944 | static void mace_tx_timeout(struct net_device *dev) |
948 | { | 945 | { |
949 | mace_private *lp = netdev_priv(dev); | 946 | mace_private *lp = netdev_priv(dev); |
950 | dev_link_t *link = &lp->link; | 947 | dev_link_t *link = lp->p_dev; |
951 | 948 | ||
952 | printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); | 949 | printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); |
953 | #if RESET_ON_TIMEOUT | 950 | #if RESET_ON_TIMEOUT |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 5a7e58af0b3b..8ed6a410ea10 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -214,7 +214,7 @@ static hw_info_t dl10019_info = { 0, 0, 0, 0, IS_DL10019|HAS_MII }; | |||
214 | static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII }; | 214 | static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII }; |
215 | 215 | ||
216 | typedef struct pcnet_dev_t { | 216 | typedef struct pcnet_dev_t { |
217 | dev_link_t link; | 217 | struct pcmcia_device *p_dev; |
218 | dev_node_t node; | 218 | dev_node_t node; |
219 | u_int flags; | 219 | u_int flags; |
220 | void __iomem *base; | 220 | void __iomem *base; |
@@ -243,8 +243,8 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev) | |||
243 | static int pcnet_probe(struct pcmcia_device *p_dev) | 243 | static int pcnet_probe(struct pcmcia_device *p_dev) |
244 | { | 244 | { |
245 | pcnet_dev_t *info; | 245 | pcnet_dev_t *info; |
246 | dev_link_t *link; | ||
247 | struct net_device *dev; | 246 | struct net_device *dev; |
247 | dev_link_t *link = dev_to_instance(p_dev); | ||
248 | 248 | ||
249 | DEBUG(0, "pcnet_attach()\n"); | 249 | DEBUG(0, "pcnet_attach()\n"); |
250 | 250 | ||
@@ -252,7 +252,7 @@ static int pcnet_probe(struct pcmcia_device *p_dev) | |||
252 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); | 252 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); |
253 | if (!dev) return -ENOMEM; | 253 | if (!dev) return -ENOMEM; |
254 | info = PRIV(dev); | 254 | info = PRIV(dev); |
255 | link = &info->link; | 255 | info->p_dev = p_dev; |
256 | link->priv = dev; | 256 | link->priv = dev; |
257 | 257 | ||
258 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 258 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -265,9 +265,6 @@ static int pcnet_probe(struct pcmcia_device *p_dev) | |||
265 | dev->stop = &pcnet_close; | 265 | dev->stop = &pcnet_close; |
266 | dev->set_config = &set_config; | 266 | dev->set_config = &set_config; |
267 | 267 | ||
268 | link->handle = p_dev; | ||
269 | p_dev->instance = link; | ||
270 | |||
271 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 268 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
272 | pcnet_config(link); | 269 | pcnet_config(link); |
273 | 270 | ||
@@ -290,7 +287,7 @@ static void pcnet_detach(struct pcmcia_device *p_dev) | |||
290 | 287 | ||
291 | DEBUG(0, "pcnet_detach(0x%p)\n", link); | 288 | DEBUG(0, "pcnet_detach(0x%p)\n", link); |
292 | 289 | ||
293 | if (link->dev) | 290 | if (link->dev_node) |
294 | unregister_netdev(dev); | 291 | unregister_netdev(dev); |
295 | 292 | ||
296 | if (link->state & DEV_CONFIG) | 293 | if (link->state & DEV_CONFIG) |
@@ -674,7 +671,7 @@ static void pcnet_config(dev_link_t *link) | |||
674 | info->eth_phy = 0; | 671 | info->eth_phy = 0; |
675 | } | 672 | } |
676 | 673 | ||
677 | link->dev = &info->node; | 674 | link->dev_node = &info->node; |
678 | link->state &= ~DEV_CONFIG_PENDING; | 675 | link->state &= ~DEV_CONFIG_PENDING; |
679 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 676 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
680 | 677 | ||
@@ -684,7 +681,7 @@ static void pcnet_config(dev_link_t *link) | |||
684 | 681 | ||
685 | if (register_netdev(dev) != 0) { | 682 | if (register_netdev(dev) != 0) { |
686 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); | 683 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); |
687 | link->dev = NULL; | 684 | link->dev_node = NULL; |
688 | goto failed; | 685 | goto failed; |
689 | } | 686 | } |
690 | 687 | ||
@@ -1005,8 +1002,8 @@ static void mii_phy_probe(struct net_device *dev) | |||
1005 | static int pcnet_open(struct net_device *dev) | 1002 | static int pcnet_open(struct net_device *dev) |
1006 | { | 1003 | { |
1007 | pcnet_dev_t *info = PRIV(dev); | 1004 | pcnet_dev_t *info = PRIV(dev); |
1008 | dev_link_t *link = &info->link; | 1005 | dev_link_t *link = info->p_dev; |
1009 | 1006 | ||
1010 | DEBUG(2, "pcnet_open('%s')\n", dev->name); | 1007 | DEBUG(2, "pcnet_open('%s')\n", dev->name); |
1011 | 1008 | ||
1012 | if (!DEV_OK(link)) | 1009 | if (!DEV_OK(link)) |
@@ -1033,7 +1030,7 @@ static int pcnet_open(struct net_device *dev) | |||
1033 | static int pcnet_close(struct net_device *dev) | 1030 | static int pcnet_close(struct net_device *dev) |
1034 | { | 1031 | { |
1035 | pcnet_dev_t *info = PRIV(dev); | 1032 | pcnet_dev_t *info = PRIV(dev); |
1036 | dev_link_t *link = &info->link; | 1033 | dev_link_t *link = info->p_dev; |
1037 | 1034 | ||
1038 | DEBUG(2, "pcnet_close('%s')\n", dev->name); | 1035 | DEBUG(2, "pcnet_close('%s')\n", dev->name); |
1039 | 1036 | ||
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index b46b7e148390..a18b02a9a687 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -104,7 +104,7 @@ static const char *version = | |||
104 | #define MEMORY_WAIT_TIME 8 | 104 | #define MEMORY_WAIT_TIME 8 |
105 | 105 | ||
106 | struct smc_private { | 106 | struct smc_private { |
107 | dev_link_t link; | 107 | struct pcmcia_device *p_dev; |
108 | spinlock_t lock; | 108 | spinlock_t lock; |
109 | u_short manfid; | 109 | u_short manfid; |
110 | u_short cardid; | 110 | u_short cardid; |
@@ -312,8 +312,8 @@ static struct ethtool_ops ethtool_ops; | |||
312 | static int smc91c92_attach(struct pcmcia_device *p_dev) | 312 | static int smc91c92_attach(struct pcmcia_device *p_dev) |
313 | { | 313 | { |
314 | struct smc_private *smc; | 314 | struct smc_private *smc; |
315 | dev_link_t *link; | ||
316 | struct net_device *dev; | 315 | struct net_device *dev; |
316 | dev_link_t *link = dev_to_instance(p_dev); | ||
317 | 317 | ||
318 | DEBUG(0, "smc91c92_attach()\n"); | 318 | DEBUG(0, "smc91c92_attach()\n"); |
319 | 319 | ||
@@ -322,7 +322,7 @@ static int smc91c92_attach(struct pcmcia_device *p_dev) | |||
322 | if (!dev) | 322 | if (!dev) |
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | smc = netdev_priv(dev); | 324 | smc = netdev_priv(dev); |
325 | link = &smc->link; | 325 | smc->p_dev = p_dev; |
326 | link->priv = dev; | 326 | link->priv = dev; |
327 | 327 | ||
328 | spin_lock_init(&smc->lock); | 328 | spin_lock_init(&smc->lock); |
@@ -357,9 +357,6 @@ static int smc91c92_attach(struct pcmcia_device *p_dev) | |||
357 | smc->mii_if.phy_id_mask = 0x1f; | 357 | smc->mii_if.phy_id_mask = 0x1f; |
358 | smc->mii_if.reg_num_mask = 0x1f; | 358 | smc->mii_if.reg_num_mask = 0x1f; |
359 | 359 | ||
360 | link->handle = p_dev; | ||
361 | p_dev->instance = link; | ||
362 | |||
363 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 360 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
364 | smc91c92_config(link); | 361 | smc91c92_config(link); |
365 | 362 | ||
@@ -382,7 +379,7 @@ static void smc91c92_detach(struct pcmcia_device *p_dev) | |||
382 | 379 | ||
383 | DEBUG(0, "smc91c92_detach(0x%p)\n", link); | 380 | DEBUG(0, "smc91c92_detach(0x%p)\n", link); |
384 | 381 | ||
385 | if (link->dev) | 382 | if (link->dev_node) |
386 | unregister_netdev(dev); | 383 | unregister_netdev(dev); |
387 | 384 | ||
388 | if (link->state & DEV_CONFIG) | 385 | if (link->state & DEV_CONFIG) |
@@ -1120,13 +1117,13 @@ static void smc91c92_config(dev_link_t *link) | |||
1120 | SMC_SELECT_BANK(0); | 1117 | SMC_SELECT_BANK(0); |
1121 | } | 1118 | } |
1122 | 1119 | ||
1123 | link->dev = &smc->node; | 1120 | link->dev_node = &smc->node; |
1124 | link->state &= ~DEV_CONFIG_PENDING; | 1121 | link->state &= ~DEV_CONFIG_PENDING; |
1125 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 1122 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
1126 | 1123 | ||
1127 | if (register_netdev(dev) != 0) { | 1124 | if (register_netdev(dev) != 0) { |
1128 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); | 1125 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); |
1129 | link->dev = NULL; | 1126 | link->dev_node = NULL; |
1130 | goto config_undo; | 1127 | goto config_undo; |
1131 | } | 1128 | } |
1132 | 1129 | ||
@@ -1272,7 +1269,7 @@ static void smc_dump(struct net_device *dev) | |||
1272 | static int smc_open(struct net_device *dev) | 1269 | static int smc_open(struct net_device *dev) |
1273 | { | 1270 | { |
1274 | struct smc_private *smc = netdev_priv(dev); | 1271 | struct smc_private *smc = netdev_priv(dev); |
1275 | dev_link_t *link = &smc->link; | 1272 | dev_link_t *link = smc->p_dev; |
1276 | 1273 | ||
1277 | #ifdef PCMCIA_DEBUG | 1274 | #ifdef PCMCIA_DEBUG |
1278 | DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n", | 1275 | DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n", |
@@ -1309,7 +1306,7 @@ static int smc_open(struct net_device *dev) | |||
1309 | static int smc_close(struct net_device *dev) | 1306 | static int smc_close(struct net_device *dev) |
1310 | { | 1307 | { |
1311 | struct smc_private *smc = netdev_priv(dev); | 1308 | struct smc_private *smc = netdev_priv(dev); |
1312 | dev_link_t *link = &smc->link; | 1309 | dev_link_t *link = smc->p_dev; |
1313 | kio_addr_t ioaddr = dev->base_addr; | 1310 | kio_addr_t ioaddr = dev->base_addr; |
1314 | 1311 | ||
1315 | DEBUG(0, "%s: smc_close(), status %4.4x.\n", | 1312 | DEBUG(0, "%s: smc_close(), status %4.4x.\n", |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index f5fa86d046d4..94a1e644abdc 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -332,7 +332,7 @@ static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
332 | */ | 332 | */ |
333 | 333 | ||
334 | typedef struct local_info_t { | 334 | typedef struct local_info_t { |
335 | dev_link_t link; | 335 | struct pcmcia_device *p_dev; |
336 | dev_node_t node; | 336 | dev_node_t node; |
337 | struct net_device_stats stats; | 337 | struct net_device_stats stats; |
338 | int card_type; | 338 | int card_type; |
@@ -555,9 +555,9 @@ mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg, unsigned data, int len) | |||
555 | static int | 555 | static int |
556 | xirc2ps_attach(struct pcmcia_device *p_dev) | 556 | xirc2ps_attach(struct pcmcia_device *p_dev) |
557 | { | 557 | { |
558 | dev_link_t *link; | ||
559 | struct net_device *dev; | 558 | struct net_device *dev; |
560 | local_info_t *local; | 559 | local_info_t *local; |
560 | dev_link_t *link = dev_to_instance(p_dev); | ||
561 | 561 | ||
562 | DEBUG(0, "attach()\n"); | 562 | DEBUG(0, "attach()\n"); |
563 | 563 | ||
@@ -566,7 +566,7 @@ xirc2ps_attach(struct pcmcia_device *p_dev) | |||
566 | if (!dev) | 566 | if (!dev) |
567 | return -ENOMEM; | 567 | return -ENOMEM; |
568 | local = netdev_priv(dev); | 568 | local = netdev_priv(dev); |
569 | link = &local->link; | 569 | local->p_dev = p_dev; |
570 | link->priv = dev; | 570 | link->priv = dev; |
571 | 571 | ||
572 | /* General socket configuration */ | 572 | /* General socket configuration */ |
@@ -592,9 +592,6 @@ xirc2ps_attach(struct pcmcia_device *p_dev) | |||
592 | dev->watchdog_timeo = TX_TIMEOUT; | 592 | dev->watchdog_timeo = TX_TIMEOUT; |
593 | #endif | 593 | #endif |
594 | 594 | ||
595 | link->handle = p_dev; | ||
596 | p_dev->instance = link; | ||
597 | |||
598 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 595 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
599 | xirc2ps_config(link); | 596 | xirc2ps_config(link); |
600 | 597 | ||
@@ -616,7 +613,7 @@ xirc2ps_detach(struct pcmcia_device *p_dev) | |||
616 | 613 | ||
617 | DEBUG(0, "detach(0x%p)\n", link); | 614 | DEBUG(0, "detach(0x%p)\n", link); |
618 | 615 | ||
619 | if (link->dev) | 616 | if (link->dev_node) |
620 | unregister_netdev(dev); | 617 | unregister_netdev(dev); |
621 | 618 | ||
622 | if (link->state & DEV_CONFIG) | 619 | if (link->state & DEV_CONFIG) |
@@ -1049,13 +1046,13 @@ xirc2ps_config(dev_link_t * link) | |||
1049 | if (local->dingo) | 1046 | if (local->dingo) |
1050 | do_reset(dev, 1); /* a kludge to make the cem56 work */ | 1047 | do_reset(dev, 1); /* a kludge to make the cem56 work */ |
1051 | 1048 | ||
1052 | link->dev = &local->node; | 1049 | link->dev_node = &local->node; |
1053 | link->state &= ~DEV_CONFIG_PENDING; | 1050 | link->state &= ~DEV_CONFIG_PENDING; |
1054 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 1051 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
1055 | 1052 | ||
1056 | if ((err=register_netdev(dev))) { | 1053 | if ((err=register_netdev(dev))) { |
1057 | printk(KNOT_XIRC "register_netdev() failed\n"); | 1054 | printk(KNOT_XIRC "register_netdev() failed\n"); |
1058 | link->dev = NULL; | 1055 | link->dev_node = NULL; |
1059 | goto config_error; | 1056 | goto config_error; |
1060 | } | 1057 | } |
1061 | 1058 | ||
@@ -1537,7 +1534,7 @@ static int | |||
1537 | do_open(struct net_device *dev) | 1534 | do_open(struct net_device *dev) |
1538 | { | 1535 | { |
1539 | local_info_t *lp = netdev_priv(dev); | 1536 | local_info_t *lp = netdev_priv(dev); |
1540 | dev_link_t *link = &lp->link; | 1537 | dev_link_t *link = lp->p_dev; |
1541 | 1538 | ||
1542 | DEBUG(0, "do_open(%p)\n", dev); | 1539 | DEBUG(0, "do_open(%p)\n", dev); |
1543 | 1540 | ||
@@ -1867,7 +1864,7 @@ do_stop(struct net_device *dev) | |||
1867 | { | 1864 | { |
1868 | kio_addr_t ioaddr = dev->base_addr; | 1865 | kio_addr_t ioaddr = dev->base_addr; |
1869 | local_info_t *lp = netdev_priv(dev); | 1866 | local_info_t *lp = netdev_priv(dev); |
1870 | dev_link_t *link = &lp->link; | 1867 | dev_link_t *link = lp->p_dev; |
1871 | 1868 | ||
1872 | DEBUG(0, "do_stop(%p)\n", dev); | 1869 | DEBUG(0, "do_stop(%p)\n", dev); |
1873 | 1870 | ||
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 2216c04a02af..836c71ff7762 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -143,22 +143,14 @@ typedef struct local_info_t { | |||
143 | 143 | ||
144 | static int airo_attach(struct pcmcia_device *p_dev) | 144 | static int airo_attach(struct pcmcia_device *p_dev) |
145 | { | 145 | { |
146 | dev_link_t *link; | ||
147 | local_info_t *local; | 146 | local_info_t *local; |
148 | 147 | ||
149 | DEBUG(0, "airo_attach()\n"); | 148 | DEBUG(0, "airo_attach()\n"); |
150 | 149 | ||
151 | /* Initialize the dev_link_t structure */ | ||
152 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); | ||
153 | if (!link) { | ||
154 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | ||
155 | return -ENOMEM; | ||
156 | } | ||
157 | |||
158 | /* Interrupt setup */ | 150 | /* Interrupt setup */ |
159 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 151 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
160 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 152 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; |
161 | link->irq.Handler = NULL; | 153 | p_dev->irq.Handler = NULL; |
162 | 154 | ||
163 | /* | 155 | /* |
164 | General socket configuration defaults can go here. In this | 156 | General socket configuration defaults can go here. In this |
@@ -167,23 +159,19 @@ static int airo_attach(struct pcmcia_device *p_dev) | |||
167 | and attributes of IO windows) are fixed by the nature of the | 159 | and attributes of IO windows) are fixed by the nature of the |
168 | device, and can be hard-wired here. | 160 | device, and can be hard-wired here. |
169 | */ | 161 | */ |
170 | link->conf.Attributes = 0; | 162 | p_dev->conf.Attributes = 0; |
171 | link->conf.IntType = INT_MEMORY_AND_IO; | 163 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
172 | 164 | ||
173 | /* Allocate space for private device-specific data */ | 165 | /* Allocate space for private device-specific data */ |
174 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 166 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
175 | if (!local) { | 167 | if (!local) { |
176 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 168 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
177 | kfree (link); | ||
178 | return -ENOMEM; | 169 | return -ENOMEM; |
179 | } | 170 | } |
180 | link->priv = local; | 171 | p_dev->priv = local; |
181 | |||
182 | link->handle = p_dev; | ||
183 | p_dev->instance = link; | ||
184 | 172 | ||
185 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 173 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
186 | airo_config(link); | 174 | airo_config(p_dev); |
187 | 175 | ||
188 | return 0; | 176 | return 0; |
189 | } /* airo_attach */ | 177 | } /* airo_attach */ |
@@ -212,7 +200,6 @@ static void airo_detach(struct pcmcia_device *p_dev) | |||
212 | ((local_info_t*)link->priv)->eth_dev = NULL; | 200 | ((local_info_t*)link->priv)->eth_dev = NULL; |
213 | 201 | ||
214 | kfree(link->priv); | 202 | kfree(link->priv); |
215 | kfree(link); | ||
216 | } /* airo_detach */ | 203 | } /* airo_detach */ |
217 | 204 | ||
218 | /*====================================================================== | 205 | /*====================================================================== |
@@ -378,11 +365,11 @@ static void airo_config(dev_link_t *link) | |||
378 | 365 | ||
379 | /* | 366 | /* |
380 | At this point, the dev_node_t structure(s) need to be | 367 | At this point, the dev_node_t structure(s) need to be |
381 | initialized and arranged in a linked list at link->dev. | 368 | initialized and arranged in a linked list at link->dev_node. |
382 | */ | 369 | */ |
383 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 370 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
384 | dev->node.major = dev->node.minor = 0; | 371 | dev->node.major = dev->node.minor = 0; |
385 | link->dev = &dev->node; | 372 | link->dev_node = &dev->node; |
386 | 373 | ||
387 | /* Finally, report what we've done */ | 374 | /* Finally, report what we've done */ |
388 | printk(KERN_INFO "%s: index 0x%02x: ", | 375 | printk(KERN_INFO "%s: index 0x%02x: ", |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 53fdaa22226d..522bbed47a05 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -154,22 +154,14 @@ typedef struct local_info_t { | |||
154 | 154 | ||
155 | static int atmel_attach(struct pcmcia_device *p_dev) | 155 | static int atmel_attach(struct pcmcia_device *p_dev) |
156 | { | 156 | { |
157 | dev_link_t *link; | ||
158 | local_info_t *local; | 157 | local_info_t *local; |
159 | 158 | ||
160 | DEBUG(0, "atmel_attach()\n"); | 159 | DEBUG(0, "atmel_attach()\n"); |
161 | 160 | ||
162 | /* Initialize the dev_link_t structure */ | ||
163 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); | ||
164 | if (!link) { | ||
165 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | ||
166 | return -ENOMEM; | ||
167 | } | ||
168 | |||
169 | /* Interrupt setup */ | 161 | /* Interrupt setup */ |
170 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 162 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
171 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 163 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; |
172 | link->irq.Handler = NULL; | 164 | p_dev->irq.Handler = NULL; |
173 | 165 | ||
174 | /* | 166 | /* |
175 | General socket configuration defaults can go here. In this | 167 | General socket configuration defaults can go here. In this |
@@ -178,23 +170,19 @@ static int atmel_attach(struct pcmcia_device *p_dev) | |||
178 | and attributes of IO windows) are fixed by the nature of the | 170 | and attributes of IO windows) are fixed by the nature of the |
179 | device, and can be hard-wired here. | 171 | device, and can be hard-wired here. |
180 | */ | 172 | */ |
181 | link->conf.Attributes = 0; | 173 | p_dev->conf.Attributes = 0; |
182 | link->conf.IntType = INT_MEMORY_AND_IO; | 174 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
183 | 175 | ||
184 | /* Allocate space for private device-specific data */ | 176 | /* Allocate space for private device-specific data */ |
185 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 177 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
186 | if (!local) { | 178 | if (!local) { |
187 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); | 179 | printk(KERN_ERR "atmel_cs: no memory for new device\n"); |
188 | kfree (link); | ||
189 | return -ENOMEM; | 180 | return -ENOMEM; |
190 | } | 181 | } |
191 | link->priv = local; | 182 | p_dev->priv = local; |
192 | |||
193 | link->handle = p_dev; | ||
194 | p_dev->instance = link; | ||
195 | 183 | ||
196 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 184 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
197 | atmel_config(link); | 185 | atmel_config(p_dev); |
198 | 186 | ||
199 | return 0; | 187 | return 0; |
200 | } /* atmel_attach */ | 188 | } /* atmel_attach */ |
@@ -218,7 +206,6 @@ static void atmel_detach(struct pcmcia_device *p_dev) | |||
218 | atmel_release(link); | 206 | atmel_release(link); |
219 | 207 | ||
220 | kfree(link->priv); | 208 | kfree(link->priv); |
221 | kfree(link); | ||
222 | } | 209 | } |
223 | 210 | ||
224 | /*====================================================================== | 211 | /*====================================================================== |
@@ -387,11 +374,11 @@ static void atmel_config(dev_link_t *link) | |||
387 | 374 | ||
388 | /* | 375 | /* |
389 | At this point, the dev_node_t structure(s) need to be | 376 | At this point, the dev_node_t structure(s) need to be |
390 | initialized and arranged in a linked list at link->dev. | 377 | initialized and arranged in a linked list at link->dev_node. |
391 | */ | 378 | */ |
392 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 379 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
393 | dev->node.major = dev->node.minor = 0; | 380 | dev->node.major = dev->node.minor = 0; |
394 | link->dev = &dev->node; | 381 | link->dev_node = &dev->node; |
395 | 382 | ||
396 | link->state &= ~DEV_CONFIG_PENDING; | 383 | link->state &= ~DEV_CONFIG_PENDING; |
397 | return; | 384 | return; |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 69024bfb5bba..e3095a88745c 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -503,22 +503,11 @@ static struct prism2_helper_functions prism2_pccard_funcs = | |||
503 | * initialize dev_link structure, but do not configure the card yet */ | 503 | * initialize dev_link structure, but do not configure the card yet */ |
504 | static int prism2_attach(struct pcmcia_device *p_dev) | 504 | static int prism2_attach(struct pcmcia_device *p_dev) |
505 | { | 505 | { |
506 | dev_link_t *link; | ||
507 | |||
508 | link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); | ||
509 | if (link == NULL) | ||
510 | return -ENOMEM; | ||
511 | |||
512 | memset(link, 0, sizeof(dev_link_t)); | ||
513 | |||
514 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); | 506 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); |
515 | link->conf.IntType = INT_MEMORY_AND_IO; | 507 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
516 | |||
517 | link->handle = p_dev; | ||
518 | p_dev->instance = link; | ||
519 | 508 | ||
520 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 509 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
521 | if (prism2_config(link)) | 510 | if (prism2_config(p_dev)) |
522 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); | 511 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); |
523 | 512 | ||
524 | return 0; | 513 | return 0; |
@@ -546,7 +535,6 @@ static void prism2_detach(struct pcmcia_device *p_dev) | |||
546 | prism2_free_local_data(dev); | 535 | prism2_free_local_data(dev); |
547 | kfree(hw_priv); | 536 | kfree(hw_priv); |
548 | } | 537 | } |
549 | kfree(link); | ||
550 | } | 538 | } |
551 | 539 | ||
552 | 540 | ||
@@ -713,7 +701,7 @@ static int prism2_config(dev_link_t *link) | |||
713 | local->hw_priv = hw_priv; | 701 | local->hw_priv = hw_priv; |
714 | hw_priv->link = link; | 702 | hw_priv->link = link; |
715 | strcpy(hw_priv->node.dev_name, dev->name); | 703 | strcpy(hw_priv->node.dev_name, dev->name); |
716 | link->dev = &hw_priv->node; | 704 | link->dev_node = &hw_priv->node; |
717 | 705 | ||
718 | /* | 706 | /* |
719 | * Allocate an interrupt line. Note that this does not assign a | 707 | * Allocate an interrupt line. Note that this does not assign a |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 23d6b3376e6e..68dfe68ffecf 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -268,7 +268,7 @@ struct site_survey { | |||
268 | }; | 268 | }; |
269 | 269 | ||
270 | typedef struct netwave_private { | 270 | typedef struct netwave_private { |
271 | dev_link_t link; | 271 | struct pcmcia_device *p_dev; |
272 | spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ | 272 | spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ |
273 | dev_node_t node; | 273 | dev_node_t node; |
274 | u_char __iomem *ramBase; | 274 | u_char __iomem *ramBase; |
@@ -378,9 +378,9 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev) | |||
378 | */ | 378 | */ |
379 | static int netwave_attach(struct pcmcia_device *p_dev) | 379 | static int netwave_attach(struct pcmcia_device *p_dev) |
380 | { | 380 | { |
381 | dev_link_t *link; | ||
382 | struct net_device *dev; | 381 | struct net_device *dev; |
383 | netwave_private *priv; | 382 | netwave_private *priv; |
383 | dev_link_t *link = dev_to_instance(p_dev); | ||
384 | 384 | ||
385 | DEBUG(0, "netwave_attach()\n"); | 385 | DEBUG(0, "netwave_attach()\n"); |
386 | 386 | ||
@@ -389,7 +389,7 @@ static int netwave_attach(struct pcmcia_device *p_dev) | |||
389 | if (!dev) | 389 | if (!dev) |
390 | return -ENOMEM; | 390 | return -ENOMEM; |
391 | priv = netdev_priv(dev); | 391 | priv = netdev_priv(dev); |
392 | link = &priv->link; | 392 | priv->p_dev = p_dev; |
393 | link->priv = dev; | 393 | link->priv = dev; |
394 | 394 | ||
395 | /* The io structure describes IO port mapping */ | 395 | /* The io structure describes IO port mapping */ |
@@ -429,9 +429,6 @@ static int netwave_attach(struct pcmcia_device *p_dev) | |||
429 | dev->stop = &netwave_close; | 429 | dev->stop = &netwave_close; |
430 | link->irq.Instance = dev; | 430 | link->irq.Instance = dev; |
431 | 431 | ||
432 | link->handle = p_dev; | ||
433 | p_dev->instance = link; | ||
434 | |||
435 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 432 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
436 | netwave_pcmcia_config( link); | 433 | netwave_pcmcia_config( link); |
437 | 434 | ||
@@ -456,7 +453,7 @@ static void netwave_detach(struct pcmcia_device *p_dev) | |||
456 | if (link->state & DEV_CONFIG) | 453 | if (link->state & DEV_CONFIG) |
457 | netwave_release(link); | 454 | netwave_release(link); |
458 | 455 | ||
459 | if (link->dev) | 456 | if (link->dev_node) |
460 | unregister_netdev(dev); | 457 | unregister_netdev(dev); |
461 | 458 | ||
462 | free_netdev(dev); | 459 | free_netdev(dev); |
@@ -830,7 +827,7 @@ static void netwave_pcmcia_config(dev_link_t *link) { | |||
830 | } | 827 | } |
831 | 828 | ||
832 | strcpy(priv->node.dev_name, dev->name); | 829 | strcpy(priv->node.dev_name, dev->name); |
833 | link->dev = &priv->node; | 830 | link->dev_node = &priv->node; |
834 | link->state &= ~DEV_CONFIG_PENDING; | 831 | link->state &= ~DEV_CONFIG_PENDING; |
835 | 832 | ||
836 | /* Reset card before reading physical address */ | 833 | /* Reset card before reading physical address */ |
@@ -1103,7 +1100,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id, struct pt_regs *regs | |||
1103 | u_char __iomem *ramBase; | 1100 | u_char __iomem *ramBase; |
1104 | struct net_device *dev = (struct net_device *)dev_id; | 1101 | struct net_device *dev = (struct net_device *)dev_id; |
1105 | struct netwave_private *priv = netdev_priv(dev); | 1102 | struct netwave_private *priv = netdev_priv(dev); |
1106 | dev_link_t *link = &priv->link; | 1103 | dev_link_t *link = priv->p_dev; |
1107 | int i; | 1104 | int i; |
1108 | 1105 | ||
1109 | if (!netif_device_present(dev)) | 1106 | if (!netif_device_present(dev)) |
@@ -1357,7 +1354,7 @@ static int netwave_rx(struct net_device *dev) | |||
1357 | 1354 | ||
1358 | static int netwave_open(struct net_device *dev) { | 1355 | static int netwave_open(struct net_device *dev) { |
1359 | netwave_private *priv = netdev_priv(dev); | 1356 | netwave_private *priv = netdev_priv(dev); |
1360 | dev_link_t *link = &priv->link; | 1357 | dev_link_t *link = priv->p_dev; |
1361 | 1358 | ||
1362 | DEBUG(1, "netwave_open: starting.\n"); | 1359 | DEBUG(1, "netwave_open: starting.\n"); |
1363 | 1360 | ||
@@ -1374,7 +1371,7 @@ static int netwave_open(struct net_device *dev) { | |||
1374 | 1371 | ||
1375 | static int netwave_close(struct net_device *dev) { | 1372 | static int netwave_close(struct net_device *dev) { |
1376 | netwave_private *priv = netdev_priv(dev); | 1373 | netwave_private *priv = netdev_priv(dev); |
1377 | dev_link_t *link = &priv->link; | 1374 | dev_link_t *link = priv->p_dev; |
1378 | 1375 | ||
1379 | DEBUG(1, "netwave_close: finishing.\n"); | 1376 | DEBUG(1, "netwave_close: finishing.\n"); |
1380 | 1377 | ||
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 75981d88a1e2..f10d97bc45f0 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -49,7 +49,7 @@ MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket | |||
49 | /* PCMCIA specific device information (goes in the card field of | 49 | /* PCMCIA specific device information (goes in the card field of |
50 | * struct orinoco_private */ | 50 | * struct orinoco_private */ |
51 | struct orinoco_pccard { | 51 | struct orinoco_pccard { |
52 | dev_link_t link; | 52 | struct pcmcia_device *p_dev; |
53 | dev_node_t node; | 53 | dev_node_t node; |
54 | 54 | ||
55 | /* Used to handle hard reset */ | 55 | /* Used to handle hard reset */ |
@@ -75,7 +75,7 @@ static int | |||
75 | orinoco_cs_hard_reset(struct orinoco_private *priv) | 75 | orinoco_cs_hard_reset(struct orinoco_private *priv) |
76 | { | 76 | { |
77 | struct orinoco_pccard *card = priv->card; | 77 | struct orinoco_pccard *card = priv->card; |
78 | dev_link_t *link = &card->link; | 78 | dev_link_t *link = card->p_dev; |
79 | int err; | 79 | int err; |
80 | 80 | ||
81 | /* We need atomic ops here, because we're not holding the lock */ | 81 | /* We need atomic ops here, because we're not holding the lock */ |
@@ -109,7 +109,7 @@ orinoco_cs_attach(struct pcmcia_device *p_dev) | |||
109 | struct net_device *dev; | 109 | struct net_device *dev; |
110 | struct orinoco_private *priv; | 110 | struct orinoco_private *priv; |
111 | struct orinoco_pccard *card; | 111 | struct orinoco_pccard *card; |
112 | dev_link_t *link; | 112 | dev_link_t *link = dev_to_instance(p_dev); |
113 | 113 | ||
114 | dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); | 114 | dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); |
115 | if (! dev) | 115 | if (! dev) |
@@ -118,7 +118,7 @@ orinoco_cs_attach(struct pcmcia_device *p_dev) | |||
118 | card = priv->card; | 118 | card = priv->card; |
119 | 119 | ||
120 | /* Link both structures together */ | 120 | /* Link both structures together */ |
121 | link = &card->link; | 121 | card->p_dev = p_dev; |
122 | link->priv = dev; | 122 | link->priv = dev; |
123 | 123 | ||
124 | /* Interrupt setup */ | 124 | /* Interrupt setup */ |
@@ -135,12 +135,6 @@ orinoco_cs_attach(struct pcmcia_device *p_dev) | |||
135 | link->conf.Attributes = 0; | 135 | link->conf.Attributes = 0; |
136 | link->conf.IntType = INT_MEMORY_AND_IO; | 136 | link->conf.IntType = INT_MEMORY_AND_IO; |
137 | 137 | ||
138 | /* Register with Card Services */ | ||
139 | link->next = NULL; | ||
140 | |||
141 | link->handle = p_dev; | ||
142 | p_dev->instance = link; | ||
143 | |||
144 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 138 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
145 | orinoco_cs_config(link); | 139 | orinoco_cs_config(link); |
146 | 140 | ||
@@ -161,8 +155,8 @@ static void orinoco_cs_detach(struct pcmcia_device *p_dev) | |||
161 | if (link->state & DEV_CONFIG) | 155 | if (link->state & DEV_CONFIG) |
162 | orinoco_cs_release(link); | 156 | orinoco_cs_release(link); |
163 | 157 | ||
164 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); | 158 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); |
165 | if (link->dev) { | 159 | if (link->dev_node) { |
166 | DEBUG(0, PFX "About to unregister net device %p\n", | 160 | DEBUG(0, PFX "About to unregister net device %p\n", |
167 | dev); | 161 | dev); |
168 | unregister_netdev(dev); | 162 | unregister_netdev(dev); |
@@ -364,9 +358,9 @@ orinoco_cs_config(dev_link_t *link) | |||
364 | } | 358 | } |
365 | 359 | ||
366 | /* At this point, the dev_node_t structure(s) needs to be | 360 | /* At this point, the dev_node_t structure(s) needs to be |
367 | * initialized and arranged in a linked list at link->dev. */ | 361 | * initialized and arranged in a linked list at link->dev_node. */ |
368 | strcpy(card->node.dev_name, dev->name); | 362 | strcpy(card->node.dev_name, dev->name); |
369 | link->dev = &card->node; /* link->dev being non-NULL is also | 363 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also |
370 | used to indicate that the | 364 | used to indicate that the |
371 | net_device has been registered */ | 365 | net_device has been registered */ |
372 | link->state &= ~DEV_CONFIG_PENDING; | 366 | link->state &= ~DEV_CONFIG_PENDING; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 7d95587d09db..60297460debd 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -190,12 +190,6 @@ static int bc; | |||
190 | static char *phy_addr = NULL; | 190 | static char *phy_addr = NULL; |
191 | 191 | ||
192 | 192 | ||
193 | /* A linked list of "instances" of the ray device. Each actual | ||
194 | PCMCIA card corresponds to one device instance, and is described | ||
195 | by one dev_link_t structure (defined in ds.h). | ||
196 | */ | ||
197 | static dev_link_t *dev_list = NULL; | ||
198 | |||
199 | /* A dev_link_t structure has fields for most things that are needed | 193 | /* A dev_link_t structure has fields for most things that are needed |
200 | to keep track of a socket, but there will usually be some device | 194 | to keep track of a socket, but there will usually be some device |
201 | specific information that also needs to be kept track of. The | 195 | specific information that also needs to be kept track of. The |
@@ -204,6 +198,9 @@ static dev_link_t *dev_list = NULL; | |||
204 | */ | 198 | */ |
205 | static unsigned int ray_mem_speed = 500; | 199 | static unsigned int ray_mem_speed = 500; |
206 | 200 | ||
201 | /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ | ||
202 | static struct pcmcia_device *this_device = NULL; | ||
203 | |||
207 | MODULE_AUTHOR("Corey Thomas <corey@world.std.com>"); | 204 | MODULE_AUTHOR("Corey Thomas <corey@world.std.com>"); |
208 | MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver"); | 205 | MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver"); |
209 | MODULE_LICENSE("GPL"); | 206 | MODULE_LICENSE("GPL"); |
@@ -308,53 +305,44 @@ static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey@world. | |||
308 | =============================================================================*/ | 305 | =============================================================================*/ |
309 | static int ray_attach(struct pcmcia_device *p_dev) | 306 | static int ray_attach(struct pcmcia_device *p_dev) |
310 | { | 307 | { |
311 | dev_link_t *link; | ||
312 | ray_dev_t *local; | 308 | ray_dev_t *local; |
313 | struct net_device *dev; | 309 | struct net_device *dev; |
314 | |||
315 | DEBUG(1, "ray_attach()\n"); | ||
316 | |||
317 | /* Initialize the dev_link_t structure */ | ||
318 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | ||
319 | 310 | ||
320 | if (!link) | 311 | DEBUG(1, "ray_attach()\n"); |
321 | return -ENOMEM; | ||
322 | 312 | ||
323 | /* Allocate space for private device-specific data */ | 313 | /* Allocate space for private device-specific data */ |
324 | dev = alloc_etherdev(sizeof(ray_dev_t)); | 314 | dev = alloc_etherdev(sizeof(ray_dev_t)); |
325 | |||
326 | if (!dev) | 315 | if (!dev) |
327 | goto fail_alloc_dev; | 316 | goto fail_alloc_dev; |
328 | 317 | ||
329 | local = dev->priv; | 318 | local = dev->priv; |
330 | 319 | local->finder = p_dev; | |
331 | memset(link, 0, sizeof(struct dev_link_t)); | ||
332 | 320 | ||
333 | /* The io structure describes IO port mapping. None used here */ | 321 | /* The io structure describes IO port mapping. None used here */ |
334 | link->io.NumPorts1 = 0; | 322 | p_dev->io.NumPorts1 = 0; |
335 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 323 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
336 | link->io.IOAddrLines = 5; | 324 | p_dev->io.IOAddrLines = 5; |
337 | 325 | ||
338 | /* Interrupt setup. For PCMCIA, driver takes what's given */ | 326 | /* Interrupt setup. For PCMCIA, driver takes what's given */ |
339 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 327 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; |
340 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 328 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; |
341 | link->irq.Handler = &ray_interrupt; | 329 | p_dev->irq.Handler = &ray_interrupt; |
342 | 330 | ||
343 | /* General socket configuration */ | 331 | /* General socket configuration */ |
344 | link->conf.Attributes = CONF_ENABLE_IRQ; | 332 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
345 | link->conf.IntType = INT_MEMORY_AND_IO; | 333 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
346 | link->conf.ConfigIndex = 1; | 334 | p_dev->conf.ConfigIndex = 1; |
347 | link->conf.Present = PRESENT_OPTION; | 335 | p_dev->conf.Present = PRESENT_OPTION; |
348 | 336 | ||
349 | link->priv = dev; | 337 | p_dev->priv = dev; |
350 | link->irq.Instance = dev; | 338 | p_dev->irq.Instance = dev; |
351 | 339 | ||
352 | local->finder = link; | 340 | local->finder = p_dev; |
353 | local->card_status = CARD_INSERTED; | 341 | local->card_status = CARD_INSERTED; |
354 | local->authentication_state = UNAUTHENTICATED; | 342 | local->authentication_state = UNAUTHENTICATED; |
355 | local->num_multi = 0; | 343 | local->num_multi = 0; |
356 | DEBUG(2,"ray_attach link = %p, dev = %p, local = %p, intr = %p\n", | 344 | DEBUG(2,"ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", |
357 | link,dev,local,&ray_interrupt); | 345 | p_dev,dev,local,&ray_interrupt); |
358 | 346 | ||
359 | /* Raylink entries in the device structure */ | 347 | /* Raylink entries in the device structure */ |
360 | dev->hard_start_xmit = &ray_dev_start_xmit; | 348 | dev->hard_start_xmit = &ray_dev_start_xmit; |
@@ -378,16 +366,13 @@ static int ray_attach(struct pcmcia_device *p_dev) | |||
378 | 366 | ||
379 | init_timer(&local->timer); | 367 | init_timer(&local->timer); |
380 | 368 | ||
381 | link->handle = p_dev; | 369 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
382 | p_dev->instance = link; | 370 | this_device = p_dev; |
383 | 371 | ray_config(p_dev); | |
384 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
385 | ray_config(link); | ||
386 | 372 | ||
387 | return 0; | 373 | return 0; |
388 | 374 | ||
389 | fail_alloc_dev: | 375 | fail_alloc_dev: |
390 | kfree(link); | ||
391 | return -ENOMEM; | 376 | return -ENOMEM; |
392 | } /* ray_attach */ | 377 | } /* ray_attach */ |
393 | /*============================================================================= | 378 | /*============================================================================= |
@@ -399,18 +384,12 @@ fail_alloc_dev: | |||
399 | static void ray_detach(struct pcmcia_device *p_dev) | 384 | static void ray_detach(struct pcmcia_device *p_dev) |
400 | { | 385 | { |
401 | dev_link_t *link = dev_to_instance(p_dev); | 386 | dev_link_t *link = dev_to_instance(p_dev); |
402 | dev_link_t **linkp; | ||
403 | struct net_device *dev; | 387 | struct net_device *dev; |
404 | ray_dev_t *local; | 388 | ray_dev_t *local; |
405 | 389 | ||
406 | DEBUG(1, "ray_detach(0x%p)\n", link); | 390 | DEBUG(1, "ray_detach(0x%p)\n", link); |
407 | |||
408 | /* Locate device structure */ | ||
409 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) | ||
410 | if (*linkp == link) break; | ||
411 | if (*linkp == NULL) | ||
412 | return; | ||
413 | 391 | ||
392 | this_device = NULL; | ||
414 | dev = link->priv; | 393 | dev = link->priv; |
415 | 394 | ||
416 | if (link->state & DEV_CONFIG) { | 395 | if (link->state & DEV_CONFIG) { |
@@ -420,13 +399,10 @@ static void ray_detach(struct pcmcia_device *p_dev) | |||
420 | del_timer(&local->timer); | 399 | del_timer(&local->timer); |
421 | } | 400 | } |
422 | 401 | ||
423 | /* Unlink device structure, free pieces */ | ||
424 | *linkp = link->next; | ||
425 | if (link->priv) { | 402 | if (link->priv) { |
426 | if (link->dev) unregister_netdev(dev); | 403 | if (link->dev_node) unregister_netdev(dev); |
427 | free_netdev(dev); | 404 | free_netdev(dev); |
428 | } | 405 | } |
429 | kfree(link); | ||
430 | DEBUG(2,"ray_cs ray_detach ending\n"); | 406 | DEBUG(2,"ray_cs ray_detach ending\n"); |
431 | } /* ray_detach */ | 407 | } /* ray_detach */ |
432 | /*============================================================================= | 408 | /*============================================================================= |
@@ -537,7 +513,7 @@ static void ray_config(dev_link_t *link) | |||
537 | } | 513 | } |
538 | 514 | ||
539 | strcpy(local->node.dev_name, dev->name); | 515 | strcpy(local->node.dev_name, dev->name); |
540 | link->dev = &local->node; | 516 | link->dev_node = &local->node; |
541 | 517 | ||
542 | link->state &= ~DEV_CONFIG_PENDING; | 518 | link->state &= ~DEV_CONFIG_PENDING; |
543 | printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ", | 519 | printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ", |
@@ -1640,18 +1616,14 @@ static const struct iw_handler_def ray_handler_def = | |||
1640 | /*===========================================================================*/ | 1616 | /*===========================================================================*/ |
1641 | static int ray_open(struct net_device *dev) | 1617 | static int ray_open(struct net_device *dev) |
1642 | { | 1618 | { |
1643 | dev_link_t *link; | ||
1644 | ray_dev_t *local = (ray_dev_t *)dev->priv; | 1619 | ray_dev_t *local = (ray_dev_t *)dev->priv; |
1620 | dev_link_t *link; | ||
1621 | link = local->finder; | ||
1645 | 1622 | ||
1646 | DEBUG(1, "ray_open('%s')\n", dev->name); | 1623 | DEBUG(1, "ray_open('%s')\n", dev->name); |
1647 | 1624 | ||
1648 | for (link = dev_list; link; link = link->next) | 1625 | if (link->open == 0) |
1649 | if (link->priv == dev) break; | 1626 | local->num_multi = 0; |
1650 | if (!DEV_OK(link)) { | ||
1651 | return -ENODEV; | ||
1652 | } | ||
1653 | |||
1654 | if (link->open == 0) local->num_multi = 0; | ||
1655 | link->open++; | 1627 | link->open++; |
1656 | 1628 | ||
1657 | /* If the card is not started, time to start it ! - Jean II */ | 1629 | /* If the card is not started, time to start it ! - Jean II */ |
@@ -1678,15 +1650,12 @@ static int ray_open(struct net_device *dev) | |||
1678 | /*===========================================================================*/ | 1650 | /*===========================================================================*/ |
1679 | static int ray_dev_close(struct net_device *dev) | 1651 | static int ray_dev_close(struct net_device *dev) |
1680 | { | 1652 | { |
1653 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
1681 | dev_link_t *link; | 1654 | dev_link_t *link; |
1655 | link = local->finder; | ||
1682 | 1656 | ||
1683 | DEBUG(1, "ray_dev_close('%s')\n", dev->name); | 1657 | DEBUG(1, "ray_dev_close('%s')\n", dev->name); |
1684 | 1658 | ||
1685 | for (link = dev_list; link; link = link->next) | ||
1686 | if (link->priv == dev) break; | ||
1687 | if (link == NULL) | ||
1688 | return -ENODEV; | ||
1689 | |||
1690 | link->open--; | 1659 | link->open--; |
1691 | netif_stop_queue(dev); | 1660 | netif_stop_queue(dev); |
1692 | 1661 | ||
@@ -2679,7 +2648,7 @@ static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len) | |||
2679 | struct freq_hop_element *pfh; | 2648 | struct freq_hop_element *pfh; |
2680 | UCHAR c[33]; | 2649 | UCHAR c[33]; |
2681 | 2650 | ||
2682 | link = dev_list; | 2651 | link = this_device; |
2683 | if (!link) | 2652 | if (!link) |
2684 | return 0; | 2653 | return 0; |
2685 | dev = (struct net_device *)link->priv; | 2654 | dev = (struct net_device *)link->priv; |
@@ -2923,7 +2892,6 @@ static void __exit exit_ray_cs(void) | |||
2923 | #endif | 2892 | #endif |
2924 | 2893 | ||
2925 | pcmcia_unregister_driver(&ray_driver); | 2894 | pcmcia_unregister_driver(&ray_driver); |
2926 | BUG_ON(dev_list != NULL); | ||
2927 | } /* exit_ray_cs */ | 2895 | } /* exit_ray_cs */ |
2928 | 2896 | ||
2929 | module_init(init_ray_cs); | 2897 | module_init(init_ray_cs); |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 7a4a80b01f9c..be36679c8c95 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -63,7 +63,7 @@ MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket | |||
63 | /* PCMCIA specific device information (goes in the card field of | 63 | /* PCMCIA specific device information (goes in the card field of |
64 | * struct orinoco_private */ | 64 | * struct orinoco_private */ |
65 | struct orinoco_pccard { | 65 | struct orinoco_pccard { |
66 | dev_link_t link; | 66 | struct pcmcia_device *p_dev; |
67 | dev_node_t node; | 67 | dev_node_t node; |
68 | }; | 68 | }; |
69 | 69 | ||
@@ -554,12 +554,12 @@ static int | |||
554 | spectrum_cs_hard_reset(struct orinoco_private *priv) | 554 | spectrum_cs_hard_reset(struct orinoco_private *priv) |
555 | { | 555 | { |
556 | struct orinoco_pccard *card = priv->card; | 556 | struct orinoco_pccard *card = priv->card; |
557 | dev_link_t *link = &card->link; | 557 | dev_link_t *link = card->p_dev; |
558 | int err; | 558 | int err; |
559 | 559 | ||
560 | if (!hermes_present(&priv->hw)) { | 560 | if (!hermes_present(&priv->hw)) { |
561 | /* The firmware needs to be reloaded */ | 561 | /* The firmware needs to be reloaded */ |
562 | if (spectrum_dl_firmware(&priv->hw, &card->link) != 0) { | 562 | if (spectrum_dl_firmware(&priv->hw, link) != 0) { |
563 | printk(KERN_ERR PFX "Firmware download failed\n"); | 563 | printk(KERN_ERR PFX "Firmware download failed\n"); |
564 | err = -ENODEV; | 564 | err = -ENODEV; |
565 | } | 565 | } |
@@ -589,7 +589,7 @@ spectrum_cs_attach(struct pcmcia_device *p_dev) | |||
589 | struct net_device *dev; | 589 | struct net_device *dev; |
590 | struct orinoco_private *priv; | 590 | struct orinoco_private *priv; |
591 | struct orinoco_pccard *card; | 591 | struct orinoco_pccard *card; |
592 | dev_link_t *link; | 592 | dev_link_t *link = dev_to_instance(p_dev); |
593 | 593 | ||
594 | dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); | 594 | dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); |
595 | if (! dev) | 595 | if (! dev) |
@@ -598,7 +598,7 @@ spectrum_cs_attach(struct pcmcia_device *p_dev) | |||
598 | card = priv->card; | 598 | card = priv->card; |
599 | 599 | ||
600 | /* Link both structures together */ | 600 | /* Link both structures together */ |
601 | link = &card->link; | 601 | card->p_dev = p_dev; |
602 | link->priv = dev; | 602 | link->priv = dev; |
603 | 603 | ||
604 | /* Interrupt setup */ | 604 | /* Interrupt setup */ |
@@ -615,9 +615,6 @@ spectrum_cs_attach(struct pcmcia_device *p_dev) | |||
615 | link->conf.Attributes = 0; | 615 | link->conf.Attributes = 0; |
616 | link->conf.IntType = INT_MEMORY_AND_IO; | 616 | link->conf.IntType = INT_MEMORY_AND_IO; |
617 | 617 | ||
618 | link->handle = p_dev; | ||
619 | p_dev->instance = link; | ||
620 | |||
621 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 618 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
622 | spectrum_cs_config(link); | 619 | spectrum_cs_config(link); |
623 | 620 | ||
@@ -638,8 +635,8 @@ static void spectrum_cs_detach(struct pcmcia_device *p_dev) | |||
638 | if (link->state & DEV_CONFIG) | 635 | if (link->state & DEV_CONFIG) |
639 | spectrum_cs_release(link); | 636 | spectrum_cs_release(link); |
640 | 637 | ||
641 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); | 638 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); |
642 | if (link->dev) { | 639 | if (link->dev_node) { |
643 | DEBUG(0, PFX "About to unregister net device %p\n", | 640 | DEBUG(0, PFX "About to unregister net device %p\n", |
644 | dev); | 641 | dev); |
645 | unregister_netdev(dev); | 642 | unregister_netdev(dev); |
@@ -842,9 +839,9 @@ spectrum_cs_config(dev_link_t *link) | |||
842 | } | 839 | } |
843 | 840 | ||
844 | /* At this point, the dev_node_t structure(s) needs to be | 841 | /* At this point, the dev_node_t structure(s) needs to be |
845 | * initialized and arranged in a linked list at link->dev. */ | 842 | * initialized and arranged in a linked list at link->dev_node. */ |
846 | strcpy(card->node.dev_name, dev->name); | 843 | strcpy(card->node.dev_name, dev->name); |
847 | link->dev = &card->node; /* link->dev being non-NULL is also | 844 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also |
848 | used to indicate that the | 845 | used to indicate that the |
849 | net_device has been registered */ | 846 | net_device has been registered */ |
850 | link->state &= ~DEV_CONFIG_PENDING; | 847 | link->state &= ~DEV_CONFIG_PENDING; |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index daa17dc34320..baa1011e70e0 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -4081,7 +4081,7 @@ wv_pcmcia_config(dev_link_t * link) | |||
4081 | } | 4081 | } |
4082 | 4082 | ||
4083 | strcpy(((net_local *) netdev_priv(dev))->node.dev_name, dev->name); | 4083 | strcpy(((net_local *) netdev_priv(dev))->node.dev_name, dev->name); |
4084 | link->dev = &((net_local *) netdev_priv(dev))->node; | 4084 | link->dev_node = &((net_local *) netdev_priv(dev))->node; |
4085 | 4085 | ||
4086 | #ifdef DEBUG_CONFIG_TRACE | 4086 | #ifdef DEBUG_CONFIG_TRACE |
4087 | printk(KERN_DEBUG "<-wv_pcmcia_config()\n"); | 4087 | printk(KERN_DEBUG "<-wv_pcmcia_config()\n"); |
@@ -4583,7 +4583,6 @@ wavelan_close(struct net_device * dev) | |||
4583 | static int | 4583 | static int |
4584 | wavelan_attach(struct pcmcia_device *p_dev) | 4584 | wavelan_attach(struct pcmcia_device *p_dev) |
4585 | { | 4585 | { |
4586 | dev_link_t * link; /* Info for cardmgr */ | ||
4587 | struct net_device * dev; /* Interface generic data */ | 4586 | struct net_device * dev; /* Interface generic data */ |
4588 | net_local * lp; /* Interface specific data */ | 4587 | net_local * lp; /* Interface specific data */ |
4589 | 4588 | ||
@@ -4591,34 +4590,26 @@ wavelan_attach(struct pcmcia_device *p_dev) | |||
4591 | printk(KERN_DEBUG "-> wavelan_attach()\n"); | 4590 | printk(KERN_DEBUG "-> wavelan_attach()\n"); |
4592 | #endif | 4591 | #endif |
4593 | 4592 | ||
4594 | /* Initialize the dev_link_t structure */ | ||
4595 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); | ||
4596 | if (!link) return -ENOMEM; | ||
4597 | |||
4598 | /* The io structure describes IO port mapping */ | 4593 | /* The io structure describes IO port mapping */ |
4599 | link->io.NumPorts1 = 8; | 4594 | p_dev->io.NumPorts1 = 8; |
4600 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 4595 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
4601 | link->io.IOAddrLines = 3; | 4596 | p_dev->io.IOAddrLines = 3; |
4602 | 4597 | ||
4603 | /* Interrupt setup */ | 4598 | /* Interrupt setup */ |
4604 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 4599 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; |
4605 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 4600 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; |
4606 | link->irq.Handler = wavelan_interrupt; | 4601 | p_dev->irq.Handler = wavelan_interrupt; |
4607 | 4602 | ||
4608 | /* General socket configuration */ | 4603 | /* General socket configuration */ |
4609 | link->conf.Attributes = CONF_ENABLE_IRQ; | 4604 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
4610 | link->conf.IntType = INT_MEMORY_AND_IO; | 4605 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
4611 | |||
4612 | /* Chain drivers */ | ||
4613 | link->next = NULL; | ||
4614 | 4606 | ||
4615 | /* Allocate the generic data structure */ | 4607 | /* Allocate the generic data structure */ |
4616 | dev = alloc_etherdev(sizeof(net_local)); | 4608 | dev = alloc_etherdev(sizeof(net_local)); |
4617 | if (!dev) { | 4609 | if (!dev) |
4618 | kfree(link); | ||
4619 | return -ENOMEM; | 4610 | return -ENOMEM; |
4620 | } | 4611 | |
4621 | link->priv = link->irq.Instance = dev; | 4612 | p_dev->priv = p_dev->irq.Instance = dev; |
4622 | 4613 | ||
4623 | lp = netdev_priv(dev); | 4614 | lp = netdev_priv(dev); |
4624 | 4615 | ||
@@ -4635,7 +4626,6 @@ wavelan_attach(struct pcmcia_device *p_dev) | |||
4635 | spin_lock_init(&lp->spinlock); | 4626 | spin_lock_init(&lp->spinlock); |
4636 | 4627 | ||
4637 | /* back links */ | 4628 | /* back links */ |
4638 | lp->link = link; | ||
4639 | lp->dev = dev; | 4629 | lp->dev = dev; |
4640 | 4630 | ||
4641 | /* wavelan NET3 callbacks */ | 4631 | /* wavelan NET3 callbacks */ |
@@ -4661,11 +4651,8 @@ wavelan_attach(struct pcmcia_device *p_dev) | |||
4661 | /* Other specific data */ | 4651 | /* Other specific data */ |
4662 | dev->mtu = WAVELAN_MTU; | 4652 | dev->mtu = WAVELAN_MTU; |
4663 | 4653 | ||
4664 | link->handle = p_dev; | 4654 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
4665 | p_dev->instance = link; | 4655 | if(wv_pcmcia_config(p_dev) && |
4666 | |||
4667 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
4668 | if(wv_pcmcia_config(link) && | ||
4669 | wv_hw_config(dev)) | 4656 | wv_hw_config(dev)) |
4670 | wv_init_info(dev); | 4657 | wv_init_info(dev); |
4671 | else | 4658 | else |
@@ -4713,14 +4700,13 @@ wavelan_detach(struct pcmcia_device *p_dev) | |||
4713 | 4700 | ||
4714 | /* Remove ourselves from the kernel list of ethernet devices */ | 4701 | /* Remove ourselves from the kernel list of ethernet devices */ |
4715 | /* Warning : can't be called from interrupt, timer or wavelan_close() */ | 4702 | /* Warning : can't be called from interrupt, timer or wavelan_close() */ |
4716 | if (link->dev) | 4703 | if (link->dev_node) |
4717 | unregister_netdev(dev); | 4704 | unregister_netdev(dev); |
4718 | link->dev = NULL; | 4705 | link->dev_node = NULL; |
4719 | ((net_local *)netdev_priv(dev))->link = NULL; | 4706 | ((net_local *)netdev_priv(dev))->link = NULL; |
4720 | ((net_local *)netdev_priv(dev))->dev = NULL; | 4707 | ((net_local *)netdev_priv(dev))->dev = NULL; |
4721 | free_netdev(dev); | 4708 | free_netdev(dev); |
4722 | } | 4709 | } |
4723 | kfree(link); | ||
4724 | 4710 | ||
4725 | #ifdef DEBUG_CALLBACK_TRACE | 4711 | #ifdef DEBUG_CALLBACK_TRACE |
4726 | printk(KERN_DEBUG "<- wavelan_detach()\n"); | 4712 | printk(KERN_DEBUG "<- wavelan_detach()\n"); |
diff --git a/drivers/net/wireless/wl3501.h b/drivers/net/wireless/wl3501.h index 4303c50c2ab6..65ceb088f700 100644 --- a/drivers/net/wireless/wl3501.h +++ b/drivers/net/wireless/wl3501.h | |||
@@ -611,5 +611,6 @@ struct wl3501_card { | |||
611 | struct iw_spy_data spy_data; | 611 | struct iw_spy_data spy_data; |
612 | struct iw_public_data wireless_data; | 612 | struct iw_public_data wireless_data; |
613 | struct dev_node_t node; | 613 | struct dev_node_t node; |
614 | struct pcmcia_device *p_dev; | ||
614 | }; | 615 | }; |
615 | #endif | 616 | #endif |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 393b5cb7a52c..4b054f54e9d5 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -226,17 +226,6 @@ static void iw_copy_mgmt_info_element(struct iw_mgmt_info_element *to, | |||
226 | iw_set_mgmt_info_element(from->id, to, from->data, from->len); | 226 | iw_set_mgmt_info_element(from->id, to, from->data, from->len); |
227 | } | 227 | } |
228 | 228 | ||
229 | /* | ||
230 | * A linked list of "instances" of the wl24 device. Each actual PCMCIA card | ||
231 | * corresponds to one device instance, and is described by one dev_link_t | ||
232 | * structure (defined in ds.h). | ||
233 | * | ||
234 | * You may not want to use a linked list for this -- for example, the memory | ||
235 | * card driver uses an array of dev_link_t pointers, where minor device numbers | ||
236 | * are used to derive the corresponding array index. | ||
237 | */ | ||
238 | static dev_link_t *wl3501_dev_list; | ||
239 | |||
240 | static inline void wl3501_switch_page(struct wl3501_card *this, u8 page) | 229 | static inline void wl3501_switch_page(struct wl3501_card *this, u8 page) |
241 | { | 230 | { |
242 | wl3501_outb(page, this->base_addr + WL3501_NIC_BSS); | 231 | wl3501_outb(page, this->base_addr + WL3501_NIC_BSS); |
@@ -1282,14 +1271,9 @@ static int wl3501_close(struct net_device *dev) | |||
1282 | int rc = -ENODEV; | 1271 | int rc = -ENODEV; |
1283 | unsigned long flags; | 1272 | unsigned long flags; |
1284 | dev_link_t *link; | 1273 | dev_link_t *link; |
1274 | link = this->p_dev; | ||
1285 | 1275 | ||
1286 | spin_lock_irqsave(&this->lock, flags); | 1276 | spin_lock_irqsave(&this->lock, flags); |
1287 | /* Check if the device is in wl3501_dev_list */ | ||
1288 | for (link = wl3501_dev_list; link; link = link->next) | ||
1289 | if (link->priv == dev) | ||
1290 | break; | ||
1291 | if (!link) | ||
1292 | goto out; | ||
1293 | link->open--; | 1277 | link->open--; |
1294 | 1278 | ||
1295 | /* Stop wl3501_hard_start_xmit() from now on */ | 1279 | /* Stop wl3501_hard_start_xmit() from now on */ |
@@ -1301,7 +1285,6 @@ static int wl3501_close(struct net_device *dev) | |||
1301 | 1285 | ||
1302 | rc = 0; | 1286 | rc = 0; |
1303 | printk(KERN_INFO "%s: WL3501 closed\n", dev->name); | 1287 | printk(KERN_INFO "%s: WL3501 closed\n", dev->name); |
1304 | out: | ||
1305 | spin_unlock_irqrestore(&this->lock, flags); | 1288 | spin_unlock_irqrestore(&this->lock, flags); |
1306 | return rc; | 1289 | return rc; |
1307 | } | 1290 | } |
@@ -1401,12 +1384,9 @@ static int wl3501_open(struct net_device *dev) | |||
1401 | struct wl3501_card *this = dev->priv; | 1384 | struct wl3501_card *this = dev->priv; |
1402 | unsigned long flags; | 1385 | unsigned long flags; |
1403 | dev_link_t *link; | 1386 | dev_link_t *link; |
1387 | link = this->p_dev; | ||
1404 | 1388 | ||
1405 | spin_lock_irqsave(&this->lock, flags); | 1389 | spin_lock_irqsave(&this->lock, flags); |
1406 | /* Check if the device is in wl3501_dev_list */ | ||
1407 | for (link = wl3501_dev_list; link; link = link->next) | ||
1408 | if (link->priv == dev) | ||
1409 | break; | ||
1410 | if (!DEV_OK(link)) | 1390 | if (!DEV_OK(link)) |
1411 | goto out; | 1391 | goto out; |
1412 | netif_device_attach(dev); | 1392 | netif_device_attach(dev); |
@@ -1500,16 +1480,8 @@ static struct ethtool_ops ops = { | |||
1500 | static void wl3501_detach(struct pcmcia_device *p_dev) | 1480 | static void wl3501_detach(struct pcmcia_device *p_dev) |
1501 | { | 1481 | { |
1502 | dev_link_t *link = dev_to_instance(p_dev); | 1482 | dev_link_t *link = dev_to_instance(p_dev); |
1503 | dev_link_t **linkp; | ||
1504 | struct net_device *dev = link->priv; | 1483 | struct net_device *dev = link->priv; |
1505 | 1484 | ||
1506 | /* Locate device structure */ | ||
1507 | for (linkp = &wl3501_dev_list; *linkp; linkp = &(*linkp)->next) | ||
1508 | if (*linkp == link) | ||
1509 | break; | ||
1510 | if (!*linkp) | ||
1511 | goto out; | ||
1512 | |||
1513 | /* If the device is currently configured and active, we won't actually | 1485 | /* If the device is currently configured and active, we won't actually |
1514 | * delete it yet. Instead, it is marked so that when the release() | 1486 | * delete it yet. Instead, it is marked so that when the release() |
1515 | * function is called, that will trigger a proper detach(). */ | 1487 | * function is called, that will trigger a proper detach(). */ |
@@ -1522,13 +1494,9 @@ static void wl3501_detach(struct pcmcia_device *p_dev) | |||
1522 | wl3501_release(link); | 1494 | wl3501_release(link); |
1523 | } | 1495 | } |
1524 | 1496 | ||
1525 | /* Unlink device structure, free pieces */ | ||
1526 | *linkp = link->next; | ||
1527 | |||
1528 | if (link->priv) | 1497 | if (link->priv) |
1529 | free_netdev(link->priv); | 1498 | free_netdev(link->priv); |
1530 | kfree(link); | 1499 | |
1531 | out: | ||
1532 | return; | 1500 | return; |
1533 | } | 1501 | } |
1534 | 1502 | ||
@@ -1955,14 +1923,9 @@ static const struct iw_handler_def wl3501_handler_def = { | |||
1955 | */ | 1923 | */ |
1956 | static int wl3501_attach(struct pcmcia_device *p_dev) | 1924 | static int wl3501_attach(struct pcmcia_device *p_dev) |
1957 | { | 1925 | { |
1958 | dev_link_t *link; | ||
1959 | struct net_device *dev; | 1926 | struct net_device *dev; |
1960 | struct wl3501_card *this; | 1927 | struct wl3501_card *this; |
1961 | 1928 | dev_link_t *link = dev_to_instance(p_dev); | |
1962 | /* Initialize the dev_link_t structure */ | ||
1963 | link = kzalloc(sizeof(*link), GFP_KERNEL); | ||
1964 | if (!link) | ||
1965 | return -ENOMEM; | ||
1966 | 1929 | ||
1967 | /* The io structure describes IO port mapping */ | 1930 | /* The io structure describes IO port mapping */ |
1968 | link->io.NumPorts1 = 16; | 1931 | link->io.NumPorts1 = 16; |
@@ -1991,22 +1954,18 @@ static int wl3501_attach(struct pcmcia_device *p_dev) | |||
1991 | dev->get_stats = wl3501_get_stats; | 1954 | dev->get_stats = wl3501_get_stats; |
1992 | this = dev->priv; | 1955 | this = dev->priv; |
1993 | this->wireless_data.spy_data = &this->spy_data; | 1956 | this->wireless_data.spy_data = &this->spy_data; |
1957 | this->p_dev = p_dev; | ||
1994 | dev->wireless_data = &this->wireless_data; | 1958 | dev->wireless_data = &this->wireless_data; |
1995 | dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; | 1959 | dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; |
1996 | SET_ETHTOOL_OPS(dev, &ops); | 1960 | SET_ETHTOOL_OPS(dev, &ops); |
1997 | netif_stop_queue(dev); | 1961 | netif_stop_queue(dev); |
1998 | link->priv = link->irq.Instance = dev; | 1962 | link->priv = link->irq.Instance = dev; |
1999 | 1963 | ||
2000 | link->handle = p_dev; | ||
2001 | p_dev->instance = link; | ||
2002 | |||
2003 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1964 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
2004 | wl3501_config(link); | 1965 | wl3501_config(p_dev); |
2005 | 1966 | ||
2006 | return 0; | 1967 | return 0; |
2007 | out_link: | 1968 | out_link: |
2008 | kfree(link); | ||
2009 | link = NULL; | ||
2010 | return -ENOMEM; | 1969 | return -ENOMEM; |
2011 | } | 1970 | } |
2012 | 1971 | ||
@@ -2087,9 +2046,9 @@ static void wl3501_config(dev_link_t *link) | |||
2087 | this = dev->priv; | 2046 | this = dev->priv; |
2088 | /* | 2047 | /* |
2089 | * At this point, the dev_node_t structure(s) should be initialized and | 2048 | * At this point, the dev_node_t structure(s) should be initialized and |
2090 | * arranged in a linked list at link->dev. | 2049 | * arranged in a linked list at link->dev_node. |
2091 | */ | 2050 | */ |
2092 | link->dev = &this->node; | 2051 | link->dev_node = &this->node; |
2093 | link->state &= ~DEV_CONFIG_PENDING; | 2052 | link->state &= ~DEV_CONFIG_PENDING; |
2094 | 2053 | ||
2095 | this->base_addr = dev->base_addr; | 2054 | this->base_addr = dev->base_addr; |
@@ -2148,7 +2107,7 @@ static void wl3501_release(dev_link_t *link) | |||
2148 | struct net_device *dev = link->priv; | 2107 | struct net_device *dev = link->priv; |
2149 | 2108 | ||
2150 | /* Unlink the device chain */ | 2109 | /* Unlink the device chain */ |
2151 | if (link->dev) | 2110 | if (link->dev_node) |
2152 | unregister_netdev(dev); | 2111 | unregister_netdev(dev); |
2153 | 2112 | ||
2154 | pcmcia_disable_device(link->handle); | 2113 | pcmcia_disable_device(link->handle); |
@@ -2206,9 +2165,7 @@ static int __init wl3501_init_module(void) | |||
2206 | 2165 | ||
2207 | static void __exit wl3501_exit_module(void) | 2166 | static void __exit wl3501_exit_module(void) |
2208 | { | 2167 | { |
2209 | dprintk(0, ": unloading"); | ||
2210 | pcmcia_unregister_driver(&wl3501_driver); | 2168 | pcmcia_unregister_driver(&wl3501_driver); |
2211 | BUG_ON(wl3501_dev_list != NULL); | ||
2212 | } | 2169 | } |
2213 | 2170 | ||
2214 | module_init(wl3501_init_module); | 2171 | module_init(wl3501_init_module); |