aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/net/pcmcia
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c19
-rw-r--r--drivers/net/pcmcia/3c589_cs.c23
-rw-r--r--drivers/net/pcmcia/axnet_cs.c19
-rw-r--r--drivers/net/pcmcia/com20020_cs.c39
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c19
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c17
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c21
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c21
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c19
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c19
10 files changed, 90 insertions, 126 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 179c9b7ad044..b65758d3c6c5 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -204,7 +204,7 @@ enum Window4 { /* Window 4: Xcvr/media bits. */
204#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */ 204#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */
205 205
206struct el3_private { 206struct el3_private {
207 dev_link_t link; 207 struct pcmcia_device *p_dev;
208 dev_node_t node; 208 dev_node_t node;
209 struct net_device_stats stats; 209 struct net_device_stats stats;
210 u16 advertising, partner; /* NWay media advertisement */ 210 u16 advertising, partner; /* NWay media advertisement */
@@ -259,8 +259,8 @@ static void tc574_detach(struct pcmcia_device *p_dev);
259static int tc574_attach(struct pcmcia_device *p_dev) 259static int tc574_attach(struct pcmcia_device *p_dev)
260{ 260{
261 struct el3_private *lp; 261 struct el3_private *lp;
262 dev_link_t *link;
263 struct net_device *dev; 262 struct net_device *dev;
263 dev_link_t *link = dev_to_instance(p_dev);
264 264
265 DEBUG(0, "3c574_attach()\n"); 265 DEBUG(0, "3c574_attach()\n");
266 266
@@ -269,8 +269,8 @@ static int tc574_attach(struct pcmcia_device *p_dev)
269 if (!dev) 269 if (!dev)
270 return -ENOMEM; 270 return -ENOMEM;
271 lp = netdev_priv(dev); 271 lp = netdev_priv(dev);
272 link = &lp->link;
273 link->priv = dev; 272 link->priv = dev;
273 lp->p_dev = p_dev;
274 274
275 spin_lock_init(&lp->window_lock); 275 spin_lock_init(&lp->window_lock);
276 link->io.NumPorts1 = 32; 276 link->io.NumPorts1 = 32;
@@ -297,9 +297,6 @@ static int tc574_attach(struct pcmcia_device *p_dev)
297 dev->watchdog_timeo = TX_TIMEOUT; 297 dev->watchdog_timeo = TX_TIMEOUT;
298#endif 298#endif
299 299
300 link->handle = p_dev;
301 p_dev->instance = link;
302
303 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 300 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
304 tc574_config(link); 301 tc574_config(link);
305 302
@@ -322,7 +319,7 @@ static void tc574_detach(struct pcmcia_device *p_dev)
322 319
323 DEBUG(0, "3c574_detach(0x%p)\n", link); 320 DEBUG(0, "3c574_detach(0x%p)\n", link);
324 321
325 if (link->dev) 322 if (link->dev_node)
326 unregister_netdev(dev); 323 unregister_netdev(dev);
327 324
328 if (link->state & DEV_CONFIG) 325 if (link->state & DEV_CONFIG)
@@ -473,12 +470,12 @@ static void tc574_config(dev_link_t *link)
473 } 470 }
474 471
475 link->state &= ~DEV_CONFIG_PENDING; 472 link->state &= ~DEV_CONFIG_PENDING;
476 link->dev = &lp->node; 473 link->dev_node = &lp->node;
477 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 474 SET_NETDEV_DEV(dev, &handle_to_dev(handle));
478 475
479 if (register_netdev(dev) != 0) { 476 if (register_netdev(dev) != 0) {
480 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); 477 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
481 link->dev = NULL; 478 link->dev_node = NULL;
482 goto failed; 479 goto failed;
483 } 480 }
484 481
@@ -742,7 +739,7 @@ static void tc574_reset(struct net_device *dev)
742static int el3_open(struct net_device *dev) 739static int el3_open(struct net_device *dev)
743{ 740{
744 struct el3_private *lp = netdev_priv(dev); 741 struct el3_private *lp = netdev_priv(dev);
745 dev_link_t *link = &lp->link; 742 dev_link_t *link = lp->p_dev;
746 743
747 if (!DEV_OK(link)) 744 if (!DEV_OK(link))
748 return -ENODEV; 745 return -ENODEV;
@@ -1188,7 +1185,7 @@ static int el3_close(struct net_device *dev)
1188{ 1185{
1189 kio_addr_t ioaddr = dev->base_addr; 1186 kio_addr_t ioaddr = dev->base_addr;
1190 struct el3_private *lp = netdev_priv(dev); 1187 struct el3_private *lp = netdev_priv(dev);
1191 dev_link_t *link = &lp->link; 1188 dev_link_t *link = lp->p_dev;
1192 1189
1193 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 1190 DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
1194 1191
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 7e8036f2e19e..4faf1fa08254 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -105,7 +105,7 @@ enum RxFilter {
105#define TX_TIMEOUT ((400*HZ)/1000) 105#define TX_TIMEOUT ((400*HZ)/1000)
106 106
107struct el3_private { 107struct el3_private {
108 dev_link_t link; 108 struct pcmcia_device *p_dev;
109 dev_node_t node; 109 dev_node_t node;
110 struct net_device_stats stats; 110 struct net_device_stats stats;
111 /* For transceiver monitoring */ 111 /* For transceiver monitoring */
@@ -173,8 +173,8 @@ static void tc589_detach(struct pcmcia_device *p_dev);
173static int tc589_attach(struct pcmcia_device *p_dev) 173static int tc589_attach(struct pcmcia_device *p_dev)
174{ 174{
175 struct el3_private *lp; 175 struct el3_private *lp;
176 dev_link_t *link;
177 struct net_device *dev; 176 struct net_device *dev;
177 dev_link_t *link = dev_to_instance(p_dev);
178 178
179 DEBUG(0, "3c589_attach()\n"); 179 DEBUG(0, "3c589_attach()\n");
180 180
@@ -183,8 +183,8 @@ static int tc589_attach(struct pcmcia_device *p_dev)
183 if (!dev) 183 if (!dev)
184 return -ENOMEM; 184 return -ENOMEM;
185 lp = netdev_priv(dev); 185 lp = netdev_priv(dev);
186 link = &lp->link;
187 link->priv = dev; 186 link->priv = dev;
187 lp->p_dev = p_dev;
188 188
189 spin_lock_init(&lp->lock); 189 spin_lock_init(&lp->lock);
190 link->io.NumPorts1 = 16; 190 link->io.NumPorts1 = 16;
@@ -212,9 +212,6 @@ static int tc589_attach(struct pcmcia_device *p_dev)
212#endif 212#endif
213 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 213 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
214 214
215 link->handle = p_dev;
216 p_dev->instance = link;
217
218 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 215 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
219 tc589_config(link); 216 tc589_config(link);
220 217
@@ -237,7 +234,7 @@ static void tc589_detach(struct pcmcia_device *p_dev)
237 234
238 DEBUG(0, "3c589_detach(0x%p)\n", link); 235 DEBUG(0, "3c589_detach(0x%p)\n", link);
239 236
240 if (link->dev) 237 if (link->dev_node)
241 unregister_netdev(dev); 238 unregister_netdev(dev);
242 239
243 if (link->state & DEV_CONFIG) 240 if (link->state & DEV_CONFIG)
@@ -345,13 +342,13 @@ static void tc589_config(dev_link_t *link)
345 else 342 else
346 printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); 343 printk(KERN_ERR "3c589_cs: invalid if_port requested\n");
347 344
348 link->dev = &lp->node; 345 link->dev_node = &lp->node;
349 link->state &= ~DEV_CONFIG_PENDING; 346 link->state &= ~DEV_CONFIG_PENDING;
350 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 347 SET_NETDEV_DEV(dev, &handle_to_dev(handle));
351 348
352 if (register_netdev(dev) != 0) { 349 if (register_netdev(dev) != 0) {
353 printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); 350 printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
354 link->dev = NULL; 351 link->dev_node = NULL;
355 goto failed; 352 goto failed;
356 } 353 }
357 354
@@ -572,7 +569,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
572static int el3_open(struct net_device *dev) 569static int el3_open(struct net_device *dev)
573{ 570{
574 struct el3_private *lp = netdev_priv(dev); 571 struct el3_private *lp = netdev_priv(dev);
575 dev_link_t *link = &lp->link; 572 dev_link_t *link = lp->p_dev;
576 573
577 if (!DEV_OK(link)) 574 if (!DEV_OK(link))
578 return -ENODEV; 575 return -ENODEV;
@@ -833,7 +830,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
833{ 830{
834 struct el3_private *lp = netdev_priv(dev); 831 struct el3_private *lp = netdev_priv(dev);
835 unsigned long flags; 832 unsigned long flags;
836 dev_link_t *link = &lp->link; 833 dev_link_t *link = lp->p_dev;
837 834
838 if (DEV_OK(link)) { 835 if (DEV_OK(link)) {
839 spin_lock_irqsave(&lp->lock, flags); 836 spin_lock_irqsave(&lp->lock, flags);
@@ -935,7 +932,7 @@ static int el3_rx(struct net_device *dev)
935static void set_multicast_list(struct net_device *dev) 932static void set_multicast_list(struct net_device *dev)
936{ 933{
937 struct el3_private *lp = netdev_priv(dev); 934 struct el3_private *lp = netdev_priv(dev);
938 dev_link_t *link = &lp->link; 935 dev_link_t *link = lp->p_dev;
939 kio_addr_t ioaddr = dev->base_addr; 936 kio_addr_t ioaddr = dev->base_addr;
940 u16 opts = SetRxFilter | RxStation | RxBroadcast; 937 u16 opts = SetRxFilter | RxStation | RxBroadcast;
941 938
@@ -950,7 +947,7 @@ static void set_multicast_list(struct net_device *dev)
950static int el3_close(struct net_device *dev) 947static int el3_close(struct net_device *dev)
951{ 948{
952 struct el3_private *lp = netdev_priv(dev); 949 struct el3_private *lp = netdev_priv(dev);
953 dev_link_t *link = &lp->link; 950 dev_link_t *link = lp->p_dev;
954 kio_addr_t ioaddr = dev->base_addr; 951 kio_addr_t ioaddr = dev->base_addr;
955 952
956 DEBUG(1, "%s: shutting down ethercard.\n", dev->name); 953 DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
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
119typedef struct axnet_dev_t { 119typedef 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)
145static int axnet_attach(struct pcmcia_device *p_dev) 145static 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)
543static int axnet_open(struct net_device *dev) 540static 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)
569static int axnet_close(struct net_device *dev) 566static 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
141static int com20020_attach(struct pcmcia_device *p_dev) 141static 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
192fail_alloc_dev: 186fail_alloc_dev:
193 kfree(info); 187 kfree(info);
194fail_alloc_info: 188fail_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*/
118typedef struct local_info_t { 118typedef 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 {
231static int fmvj18x_attach(struct pcmcia_device *p_dev) 231static 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){
1125static int fjn_open(struct net_device *dev) 1122static 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)
1150static int fjn_close(struct net_device *dev) 1147static 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
115typedef struct ibmtr_dev_t { 115typedef 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 = {
141static int ibmtr_attach(struct pcmcia_device *p_dev) 141static 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
364typedef struct _mace_private { 364typedef 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
446static int nmclan_attach(struct pcmcia_device *p_dev) 446static 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
947static void mace_tx_timeout(struct net_device *dev) 944static 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 };
214static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII }; 214static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII };
215 215
216typedef struct pcnet_dev_t { 216typedef 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)
243static int pcnet_probe(struct pcmcia_device *p_dev) 243static 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)
1005static int pcnet_open(struct net_device *dev) 1002static 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)
1033static int pcnet_close(struct net_device *dev) 1030static 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
106struct smc_private { 106struct 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;
312static int smc91c92_attach(struct pcmcia_device *p_dev) 312static 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)
1272static int smc_open(struct net_device *dev) 1269static 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)
1309static int smc_close(struct net_device *dev) 1306static 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
334typedef struct local_info_t { 334typedef 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)
555static int 555static int
556xirc2ps_attach(struct pcmcia_device *p_dev) 556xirc2ps_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
1537do_open(struct net_device *dev) 1534do_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