aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c57
-rw-r--r--drivers/net/pcmcia/3c589_cs.c59
-rw-r--r--drivers/net/pcmcia/axnet_cs.c63
-rw-r--r--drivers/net/pcmcia/com20020_cs.c39
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c97
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c49
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c61
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c91
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c114
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c108
10 files changed, 342 insertions, 396 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index b65758d3c6c5..f4e293bd04dc 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -225,8 +225,8 @@ static char mii_preamble_required = 0;
225 225
226/* Index of functions. */ 226/* Index of functions. */
227 227
228static void tc574_config(dev_link_t *link); 228static void tc574_config(struct pcmcia_device *link);
229static void tc574_release(dev_link_t *link); 229static void tc574_release(struct pcmcia_device *link);
230 230
231static void mdio_sync(kio_addr_t ioaddr, int bits); 231static void mdio_sync(kio_addr_t ioaddr, int bits);
232static int mdio_read(kio_addr_t ioaddr, int phy_id, int location); 232static int mdio_read(kio_addr_t ioaddr, int phy_id, int location);
@@ -256,11 +256,10 @@ static void tc574_detach(struct pcmcia_device *p_dev);
256 with Card Services. 256 with Card Services.
257*/ 257*/
258 258
259static int tc574_attach(struct pcmcia_device *p_dev) 259static int tc574_attach(struct pcmcia_device *link)
260{ 260{
261 struct el3_private *lp; 261 struct el3_private *lp;
262 struct net_device *dev; 262 struct net_device *dev;
263 dev_link_t *link = dev_to_instance(p_dev);
264 263
265 DEBUG(0, "3c574_attach()\n"); 264 DEBUG(0, "3c574_attach()\n");
266 265
@@ -270,7 +269,7 @@ static int tc574_attach(struct pcmcia_device *p_dev)
270 return -ENOMEM; 269 return -ENOMEM;
271 lp = netdev_priv(dev); 270 lp = netdev_priv(dev);
272 link->priv = dev; 271 link->priv = dev;
273 lp->p_dev = p_dev; 272 lp->p_dev = link;
274 273
275 spin_lock_init(&lp->window_lock); 274 spin_lock_init(&lp->window_lock);
276 link->io.NumPorts1 = 32; 275 link->io.NumPorts1 = 32;
@@ -312,9 +311,8 @@ static int tc574_attach(struct pcmcia_device *p_dev)
312 311
313*/ 312*/
314 313
315static void tc574_detach(struct pcmcia_device *p_dev) 314static void tc574_detach(struct pcmcia_device *link)
316{ 315{
317 dev_link_t *link = dev_to_instance(p_dev);
318 struct net_device *dev = link->priv; 316 struct net_device *dev = link->priv;
319 317
320 DEBUG(0, "3c574_detach(0x%p)\n", link); 318 DEBUG(0, "3c574_detach(0x%p)\n", link);
@@ -339,9 +337,8 @@ static void tc574_detach(struct pcmcia_device *p_dev)
339 337
340static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 338static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
341 339
342static void tc574_config(dev_link_t *link) 340static void tc574_config(struct pcmcia_device *link)
343{ 341{
344 client_handle_t handle = link->handle;
345 struct net_device *dev = link->priv; 342 struct net_device *dev = link->priv;
346 struct el3_private *lp = netdev_priv(dev); 343 struct el3_private *lp = netdev_priv(dev);
347 tuple_t tuple; 344 tuple_t tuple;
@@ -359,12 +356,12 @@ static void tc574_config(dev_link_t *link)
359 356
360 tuple.Attributes = 0; 357 tuple.Attributes = 0;
361 tuple.DesiredTuple = CISTPL_CONFIG; 358 tuple.DesiredTuple = CISTPL_CONFIG;
362 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 359 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
363 tuple.TupleData = (cisdata_t *)buf; 360 tuple.TupleData = (cisdata_t *)buf;
364 tuple.TupleDataMax = 64; 361 tuple.TupleDataMax = 64;
365 tuple.TupleOffset = 0; 362 tuple.TupleOffset = 0;
366 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 363 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
367 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 364 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
368 link->conf.ConfigBase = parse.config.base; 365 link->conf.ConfigBase = parse.config.base;
369 link->conf.Present = parse.config.rmask[0]; 366 link->conf.Present = parse.config.rmask[0];
370 367
@@ -374,15 +371,15 @@ static void tc574_config(dev_link_t *link)
374 link->io.IOAddrLines = 16; 371 link->io.IOAddrLines = 16;
375 for (i = j = 0; j < 0x400; j += 0x20) { 372 for (i = j = 0; j < 0x400; j += 0x20) {
376 link->io.BasePort1 = j ^ 0x300; 373 link->io.BasePort1 = j ^ 0x300;
377 i = pcmcia_request_io(link->handle, &link->io); 374 i = pcmcia_request_io(link, &link->io);
378 if (i == CS_SUCCESS) break; 375 if (i == CS_SUCCESS) break;
379 } 376 }
380 if (i != CS_SUCCESS) { 377 if (i != CS_SUCCESS) {
381 cs_error(link->handle, RequestIO, i); 378 cs_error(link, RequestIO, i);
382 goto failed; 379 goto failed;
383 } 380 }
384 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 381 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
385 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 382 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
386 383
387 dev->irq = link->irq.AssignedIRQ; 384 dev->irq = link->irq.AssignedIRQ;
388 dev->base_addr = link->io.BasePort1; 385 dev->base_addr = link->io.BasePort1;
@@ -393,8 +390,8 @@ static void tc574_config(dev_link_t *link)
393 the hardware address. The future products may include a modem chip 390 the hardware address. The future products may include a modem chip
394 and put the address in the CIS. */ 391 and put the address in the CIS. */
395 tuple.DesiredTuple = 0x88; 392 tuple.DesiredTuple = 0x88;
396 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) { 393 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
397 pcmcia_get_tuple_data(handle, &tuple); 394 pcmcia_get_tuple_data(link, &tuple);
398 for (i = 0; i < 3; i++) 395 for (i = 0; i < 3; i++)
399 phys_addr[i] = htons(buf[i]); 396 phys_addr[i] = htons(buf[i]);
400 } else { 397 } else {
@@ -408,9 +405,9 @@ static void tc574_config(dev_link_t *link)
408 } 405 }
409 } 406 }
410 tuple.DesiredTuple = CISTPL_VERS_1; 407 tuple.DesiredTuple = CISTPL_VERS_1;
411 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS && 408 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS &&
412 pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS && 409 pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS &&
413 pcmcia_parse_tuple(handle, &tuple, &parse) == CS_SUCCESS) { 410 pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) {
414 cardname = parse.version_1.str + parse.version_1.ofs[1]; 411 cardname = parse.version_1.str + parse.version_1.ofs[1];
415 } else 412 } else
416 cardname = "3Com 3c574"; 413 cardname = "3Com 3c574";
@@ -471,7 +468,7 @@ static void tc574_config(dev_link_t *link)
471 468
472 link->state &= ~DEV_CONFIG_PENDING; 469 link->state &= ~DEV_CONFIG_PENDING;
473 link->dev_node = &lp->node; 470 link->dev_node = &lp->node;
474 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 471 SET_NETDEV_DEV(dev, &handle_to_dev(link));
475 472
476 if (register_netdev(dev) != 0) { 473 if (register_netdev(dev) != 0) {
477 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); 474 printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
@@ -492,7 +489,7 @@ static void tc574_config(dev_link_t *link)
492 return; 489 return;
493 490
494cs_failed: 491cs_failed:
495 cs_error(link->handle, last_fn, last_ret); 492 cs_error(link, last_fn, last_ret);
496failed: 493failed:
497 tc574_release(link); 494 tc574_release(link);
498 return; 495 return;
@@ -505,14 +502,13 @@ failed:
505 still open, this will be postponed until it is closed. 502 still open, this will be postponed until it is closed.
506*/ 503*/
507 504
508static void tc574_release(dev_link_t *link) 505static void tc574_release(struct pcmcia_device *link)
509{ 506{
510 pcmcia_disable_device(link->handle); 507 pcmcia_disable_device(link);
511} 508}
512 509
513static int tc574_suspend(struct pcmcia_device *p_dev) 510static int tc574_suspend(struct pcmcia_device *link)
514{ 511{
515 dev_link_t *link = dev_to_instance(p_dev);
516 struct net_device *dev = link->priv; 512 struct net_device *dev = link->priv;
517 513
518 if ((link->state & DEV_CONFIG) && (link->open)) 514 if ((link->state & DEV_CONFIG) && (link->open))
@@ -521,9 +517,8 @@ static int tc574_suspend(struct pcmcia_device *p_dev)
521 return 0; 517 return 0;
522} 518}
523 519
524static int tc574_resume(struct pcmcia_device *p_dev) 520static int tc574_resume(struct pcmcia_device *link)
525{ 521{
526 dev_link_t *link = dev_to_instance(p_dev);
527 struct net_device *dev = link->priv; 522 struct net_device *dev = link->priv;
528 523
529 if ((link->state & DEV_CONFIG) && (link->open)) { 524 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -739,7 +734,7 @@ static void tc574_reset(struct net_device *dev)
739static int el3_open(struct net_device *dev) 734static int el3_open(struct net_device *dev)
740{ 735{
741 struct el3_private *lp = netdev_priv(dev); 736 struct el3_private *lp = netdev_priv(dev);
742 dev_link_t *link = lp->p_dev; 737 struct pcmcia_device *link = lp->p_dev;
743 738
744 if (!DEV_OK(link)) 739 if (!DEV_OK(link))
745 return -ENODEV; 740 return -ENODEV;
@@ -1185,7 +1180,7 @@ static int el3_close(struct net_device *dev)
1185{ 1180{
1186 kio_addr_t ioaddr = dev->base_addr; 1181 kio_addr_t ioaddr = dev->base_addr;
1187 struct el3_private *lp = netdev_priv(dev); 1182 struct el3_private *lp = netdev_priv(dev);
1188 dev_link_t *link = lp->p_dev; 1183 struct pcmcia_device *link = lp->p_dev;
1189 1184
1190 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 1185 DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
1191 1186
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 4faf1fa08254..565063d49334 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -142,8 +142,8 @@ DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
142 142
143/*====================================================================*/ 143/*====================================================================*/
144 144
145static void tc589_config(dev_link_t *link); 145static void tc589_config(struct pcmcia_device *link);
146static void tc589_release(dev_link_t *link); 146static void tc589_release(struct pcmcia_device *link);
147 147
148static u16 read_eeprom(kio_addr_t ioaddr, int index); 148static u16 read_eeprom(kio_addr_t ioaddr, int index);
149static void tc589_reset(struct net_device *dev); 149static void tc589_reset(struct net_device *dev);
@@ -170,11 +170,10 @@ static void tc589_detach(struct pcmcia_device *p_dev);
170 170
171======================================================================*/ 171======================================================================*/
172 172
173static int tc589_attach(struct pcmcia_device *p_dev) 173static int tc589_attach(struct pcmcia_device *link)
174{ 174{
175 struct el3_private *lp; 175 struct el3_private *lp;
176 struct net_device *dev; 176 struct net_device *dev;
177 dev_link_t *link = dev_to_instance(p_dev);
178 177
179 DEBUG(0, "3c589_attach()\n"); 178 DEBUG(0, "3c589_attach()\n");
180 179
@@ -184,7 +183,7 @@ static int tc589_attach(struct pcmcia_device *p_dev)
184 return -ENOMEM; 183 return -ENOMEM;
185 lp = netdev_priv(dev); 184 lp = netdev_priv(dev);
186 link->priv = dev; 185 link->priv = dev;
187 lp->p_dev = p_dev; 186 lp->p_dev = link;
188 187
189 spin_lock_init(&lp->lock); 188 spin_lock_init(&lp->lock);
190 link->io.NumPorts1 = 16; 189 link->io.NumPorts1 = 16;
@@ -227,9 +226,8 @@ static int tc589_attach(struct pcmcia_device *p_dev)
227 226
228======================================================================*/ 227======================================================================*/
229 228
230static void tc589_detach(struct pcmcia_device *p_dev) 229static void tc589_detach(struct pcmcia_device *link)
231{ 230{
232 dev_link_t *link = dev_to_instance(p_dev);
233 struct net_device *dev = link->priv; 231 struct net_device *dev = link->priv;
234 232
235 DEBUG(0, "3c589_detach(0x%p)\n", link); 233 DEBUG(0, "3c589_detach(0x%p)\n", link);
@@ -254,9 +252,8 @@ static void tc589_detach(struct pcmcia_device *p_dev)
254#define CS_CHECK(fn, ret) \ 252#define CS_CHECK(fn, ret) \
255do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 253do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
256 254
257static void tc589_config(dev_link_t *link) 255static void tc589_config(struct pcmcia_device *link)
258{ 256{
259 client_handle_t handle = link->handle;
260 struct net_device *dev = link->priv; 257 struct net_device *dev = link->priv;
261 struct el3_private *lp = netdev_priv(dev); 258 struct el3_private *lp = netdev_priv(dev);
262 tuple_t tuple; 259 tuple_t tuple;
@@ -271,20 +268,20 @@ static void tc589_config(dev_link_t *link)
271 phys_addr = (u16 *)dev->dev_addr; 268 phys_addr = (u16 *)dev->dev_addr;
272 tuple.Attributes = 0; 269 tuple.Attributes = 0;
273 tuple.DesiredTuple = CISTPL_CONFIG; 270 tuple.DesiredTuple = CISTPL_CONFIG;
274 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 271 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
275 tuple.TupleData = (cisdata_t *)buf; 272 tuple.TupleData = (cisdata_t *)buf;
276 tuple.TupleDataMax = sizeof(buf); 273 tuple.TupleDataMax = sizeof(buf);
277 tuple.TupleOffset = 0; 274 tuple.TupleOffset = 0;
278 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 275 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
279 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 276 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
280 link->conf.ConfigBase = parse.config.base; 277 link->conf.ConfigBase = parse.config.base;
281 link->conf.Present = parse.config.rmask[0]; 278 link->conf.Present = parse.config.rmask[0];
282 279
283 /* Is this a 3c562? */ 280 /* Is this a 3c562? */
284 tuple.DesiredTuple = CISTPL_MANFID; 281 tuple.DesiredTuple = CISTPL_MANFID;
285 tuple.Attributes = TUPLE_RETURN_COMMON; 282 tuple.Attributes = TUPLE_RETURN_COMMON;
286 if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && 283 if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
287 (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) { 284 (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) {
288 if (le16_to_cpu(buf[0]) != MANFID_3COM) 285 if (le16_to_cpu(buf[0]) != MANFID_3COM)
289 printk(KERN_INFO "3c589_cs: hmmm, is this really a " 286 printk(KERN_INFO "3c589_cs: hmmm, is this really a "
290 "3Com card??\n"); 287 "3Com card??\n");
@@ -299,15 +296,15 @@ static void tc589_config(dev_link_t *link)
299 for (i = j = 0; j < 0x400; j += 0x10) { 296 for (i = j = 0; j < 0x400; j += 0x10) {
300 if (multi && (j & 0x80)) continue; 297 if (multi && (j & 0x80)) continue;
301 link->io.BasePort1 = j ^ 0x300; 298 link->io.BasePort1 = j ^ 0x300;
302 i = pcmcia_request_io(link->handle, &link->io); 299 i = pcmcia_request_io(link, &link->io);
303 if (i == CS_SUCCESS) break; 300 if (i == CS_SUCCESS) break;
304 } 301 }
305 if (i != CS_SUCCESS) { 302 if (i != CS_SUCCESS) {
306 cs_error(link->handle, RequestIO, i); 303 cs_error(link, RequestIO, i);
307 goto failed; 304 goto failed;
308 } 305 }
309 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 306 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
310 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 307 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
311 308
312 dev->irq = link->irq.AssignedIRQ; 309 dev->irq = link->irq.AssignedIRQ;
313 dev->base_addr = link->io.BasePort1; 310 dev->base_addr = link->io.BasePort1;
@@ -317,8 +314,8 @@ static void tc589_config(dev_link_t *link)
317 /* The 3c589 has an extra EEPROM for configuration info, including 314 /* The 3c589 has an extra EEPROM for configuration info, including
318 the hardware address. The 3c562 puts the address in the CIS. */ 315 the hardware address. The 3c562 puts the address in the CIS. */
319 tuple.DesiredTuple = 0x88; 316 tuple.DesiredTuple = 0x88;
320 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) { 317 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
321 pcmcia_get_tuple_data(handle, &tuple); 318 pcmcia_get_tuple_data(link, &tuple);
322 for (i = 0; i < 3; i++) 319 for (i = 0; i < 3; i++)
323 phys_addr[i] = htons(buf[i]); 320 phys_addr[i] = htons(buf[i]);
324 } else { 321 } else {
@@ -344,7 +341,7 @@ static void tc589_config(dev_link_t *link)
344 341
345 link->dev_node = &lp->node; 342 link->dev_node = &lp->node;
346 link->state &= ~DEV_CONFIG_PENDING; 343 link->state &= ~DEV_CONFIG_PENDING;
347 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 344 SET_NETDEV_DEV(dev, &handle_to_dev(link));
348 345
349 if (register_netdev(dev) != 0) { 346 if (register_netdev(dev) != 0) {
350 printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); 347 printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
@@ -365,7 +362,7 @@ static void tc589_config(dev_link_t *link)
365 return; 362 return;
366 363
367cs_failed: 364cs_failed:
368 cs_error(link->handle, last_fn, last_ret); 365 cs_error(link, last_fn, last_ret);
369failed: 366failed:
370 tc589_release(link); 367 tc589_release(link);
371 return; 368 return;
@@ -380,14 +377,13 @@ failed:
380 377
381======================================================================*/ 378======================================================================*/
382 379
383static void tc589_release(dev_link_t *link) 380static void tc589_release(struct pcmcia_device *link)
384{ 381{
385 pcmcia_disable_device(link->handle); 382 pcmcia_disable_device(link);
386} 383}
387 384
388static int tc589_suspend(struct pcmcia_device *p_dev) 385static int tc589_suspend(struct pcmcia_device *link)
389{ 386{
390 dev_link_t *link = dev_to_instance(p_dev);
391 struct net_device *dev = link->priv; 387 struct net_device *dev = link->priv;
392 388
393 if ((link->state & DEV_CONFIG) && (link->open)) 389 if ((link->state & DEV_CONFIG) && (link->open))
@@ -396,9 +392,8 @@ static int tc589_suspend(struct pcmcia_device *p_dev)
396 return 0; 392 return 0;
397} 393}
398 394
399static int tc589_resume(struct pcmcia_device *p_dev) 395static int tc589_resume(struct pcmcia_device *link)
400{ 396{
401 dev_link_t *link = dev_to_instance(p_dev);
402 struct net_device *dev = link->priv; 397 struct net_device *dev = link->priv;
403 398
404 if ((link->state & DEV_CONFIG) && (link->open)) { 399 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -569,7 +564,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
569static int el3_open(struct net_device *dev) 564static int el3_open(struct net_device *dev)
570{ 565{
571 struct el3_private *lp = netdev_priv(dev); 566 struct el3_private *lp = netdev_priv(dev);
572 dev_link_t *link = lp->p_dev; 567 struct pcmcia_device *link = lp->p_dev;
573 568
574 if (!DEV_OK(link)) 569 if (!DEV_OK(link))
575 return -ENODEV; 570 return -ENODEV;
@@ -830,7 +825,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
830{ 825{
831 struct el3_private *lp = netdev_priv(dev); 826 struct el3_private *lp = netdev_priv(dev);
832 unsigned long flags; 827 unsigned long flags;
833 dev_link_t *link = lp->p_dev; 828 struct pcmcia_device *link = lp->p_dev;
834 829
835 if (DEV_OK(link)) { 830 if (DEV_OK(link)) {
836 spin_lock_irqsave(&lp->lock, flags); 831 spin_lock_irqsave(&lp->lock, flags);
@@ -932,7 +927,7 @@ static int el3_rx(struct net_device *dev)
932static void set_multicast_list(struct net_device *dev) 927static void set_multicast_list(struct net_device *dev)
933{ 928{
934 struct el3_private *lp = netdev_priv(dev); 929 struct el3_private *lp = netdev_priv(dev);
935 dev_link_t *link = lp->p_dev; 930 struct pcmcia_device *link = lp->p_dev;
936 kio_addr_t ioaddr = dev->base_addr; 931 kio_addr_t ioaddr = dev->base_addr;
937 u16 opts = SetRxFilter | RxStation | RxBroadcast; 932 u16 opts = SetRxFilter | RxStation | RxBroadcast;
938 933
@@ -947,7 +942,7 @@ static void set_multicast_list(struct net_device *dev)
947static int el3_close(struct net_device *dev) 942static int el3_close(struct net_device *dev)
948{ 943{
949 struct el3_private *lp = netdev_priv(dev); 944 struct el3_private *lp = netdev_priv(dev);
950 dev_link_t *link = lp->p_dev; 945 struct pcmcia_device *link = lp->p_dev;
951 kio_addr_t ioaddr = dev->base_addr; 946 kio_addr_t ioaddr = dev->base_addr;
952 947
953 DEBUG(1, "%s: shutting down ethercard.\n", dev->name); 948 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 58dc7c3835f4..88f180e98e81 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -86,8 +86,8 @@ static char *version =
86 86
87/*====================================================================*/ 87/*====================================================================*/
88 88
89static void axnet_config(dev_link_t *link); 89static void axnet_config(struct pcmcia_device *link);
90static void axnet_release(dev_link_t *link); 90static void axnet_release(struct pcmcia_device *link);
91static int axnet_open(struct net_device *dev); 91static int axnet_open(struct net_device *dev);
92static int axnet_close(struct net_device *dev); 92static int axnet_close(struct net_device *dev);
93static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 93static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -142,11 +142,10 @@ static inline axnet_dev_t *PRIV(struct net_device *dev)
142 142
143======================================================================*/ 143======================================================================*/
144 144
145static int axnet_attach(struct pcmcia_device *p_dev) 145static int axnet_attach(struct pcmcia_device *link)
146{ 146{
147 axnet_dev_t *info; 147 axnet_dev_t *info;
148 struct net_device *dev; 148 struct net_device *dev;
149 dev_link_t *link = dev_to_instance(p_dev);
150 149
151 DEBUG(0, "axnet_attach()\n"); 150 DEBUG(0, "axnet_attach()\n");
152 151
@@ -157,7 +156,7 @@ static int axnet_attach(struct pcmcia_device *p_dev)
157 return -ENOMEM; 156 return -ENOMEM;
158 157
159 info = PRIV(dev); 158 info = PRIV(dev);
160 info->p_dev = p_dev; 159 info->p_dev = link;
161 link->priv = dev; 160 link->priv = dev;
162 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 161 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
163 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 162 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
@@ -184,9 +183,8 @@ static int axnet_attach(struct pcmcia_device *p_dev)
184 183
185======================================================================*/ 184======================================================================*/
186 185
187static void axnet_detach(struct pcmcia_device *p_dev) 186static void axnet_detach(struct pcmcia_device *link)
188{ 187{
189 dev_link_t *link = dev_to_instance(p_dev);
190 struct net_device *dev = link->priv; 188 struct net_device *dev = link->priv;
191 189
192 DEBUG(0, "axnet_detach(0x%p)\n", link); 190 DEBUG(0, "axnet_detach(0x%p)\n", link);
@@ -206,7 +204,7 @@ static void axnet_detach(struct pcmcia_device *p_dev)
206 204
207======================================================================*/ 205======================================================================*/
208 206
209static int get_prom(dev_link_t *link) 207static int get_prom(struct pcmcia_device *link)
210{ 208{
211 struct net_device *dev = link->priv; 209 struct net_device *dev = link->priv;
212 kio_addr_t ioaddr = dev->base_addr; 210 kio_addr_t ioaddr = dev->base_addr;
@@ -260,7 +258,7 @@ static int get_prom(dev_link_t *link)
260#define CS_CHECK(fn, ret) \ 258#define CS_CHECK(fn, ret) \
261do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 259do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
262 260
263static int try_io_port(dev_link_t *link) 261static int try_io_port(struct pcmcia_device *link)
264{ 262{
265 int j, ret; 263 int j, ret;
266 if (link->io.NumPorts1 == 32) { 264 if (link->io.NumPorts1 == 32) {
@@ -281,18 +279,17 @@ static int try_io_port(dev_link_t *link)
281 for (j = 0; j < 0x400; j += 0x20) { 279 for (j = 0; j < 0x400; j += 0x20) {
282 link->io.BasePort1 = j ^ 0x300; 280 link->io.BasePort1 = j ^ 0x300;
283 link->io.BasePort2 = (j ^ 0x300) + 0x10; 281 link->io.BasePort2 = (j ^ 0x300) + 0x10;
284 ret = pcmcia_request_io(link->handle, &link->io); 282 ret = pcmcia_request_io(link, &link->io);
285 if (ret == CS_SUCCESS) return ret; 283 if (ret == CS_SUCCESS) return ret;
286 } 284 }
287 return ret; 285 return ret;
288 } else { 286 } else {
289 return pcmcia_request_io(link->handle, &link->io); 287 return pcmcia_request_io(link, &link->io);
290 } 288 }
291} 289}
292 290
293static void axnet_config(dev_link_t *link) 291static void axnet_config(struct pcmcia_device *link)
294{ 292{
295 client_handle_t handle = link->handle;
296 struct net_device *dev = link->priv; 293 struct net_device *dev = link->priv;
297 axnet_dev_t *info = PRIV(dev); 294 axnet_dev_t *info = PRIV(dev);
298 tuple_t tuple; 295 tuple_t tuple;
@@ -307,9 +304,9 @@ static void axnet_config(dev_link_t *link)
307 tuple.TupleDataMax = sizeof(buf); 304 tuple.TupleDataMax = sizeof(buf);
308 tuple.TupleOffset = 0; 305 tuple.TupleOffset = 0;
309 tuple.DesiredTuple = CISTPL_CONFIG; 306 tuple.DesiredTuple = CISTPL_CONFIG;
310 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 307 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
311 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 308 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
312 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 309 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
313 link->conf.ConfigBase = parse.config.base; 310 link->conf.ConfigBase = parse.config.base;
314 /* don't trust the CIS on this; Linksys got it wrong */ 311 /* don't trust the CIS on this; Linksys got it wrong */
315 link->conf.Present = 0x63; 312 link->conf.Present = 0x63;
@@ -319,13 +316,13 @@ static void axnet_config(dev_link_t *link)
319 316
320 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 317 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
321 tuple.Attributes = 0; 318 tuple.Attributes = 0;
322 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 319 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
323 while (last_ret == CS_SUCCESS) { 320 while (last_ret == CS_SUCCESS) {
324 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 321 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
325 cistpl_io_t *io = &(parse.cftable_entry.io); 322 cistpl_io_t *io = &(parse.cftable_entry.io);
326 323
327 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 324 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
328 pcmcia_parse_tuple(handle, &tuple, &parse) != 0 || 325 pcmcia_parse_tuple(link, &tuple, &parse) != 0 ||
329 cfg->index == 0 || cfg->io.nwin == 0) 326 cfg->index == 0 || cfg->io.nwin == 0)
330 goto next_entry; 327 goto next_entry;
331 328
@@ -347,21 +344,21 @@ static void axnet_config(dev_link_t *link)
347 if (last_ret == CS_SUCCESS) break; 344 if (last_ret == CS_SUCCESS) break;
348 } 345 }
349 next_entry: 346 next_entry:
350 last_ret = pcmcia_get_next_tuple(handle, &tuple); 347 last_ret = pcmcia_get_next_tuple(link, &tuple);
351 } 348 }
352 if (last_ret != CS_SUCCESS) { 349 if (last_ret != CS_SUCCESS) {
353 cs_error(handle, RequestIO, last_ret); 350 cs_error(link, RequestIO, last_ret);
354 goto failed; 351 goto failed;
355 } 352 }
356 353
357 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 354 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
358 355
359 if (link->io.NumPorts2 == 8) { 356 if (link->io.NumPorts2 == 8) {
360 link->conf.Attributes |= CONF_ENABLE_SPKR; 357 link->conf.Attributes |= CONF_ENABLE_SPKR;
361 link->conf.Status = CCSR_AUDIO_ENA; 358 link->conf.Status = CCSR_AUDIO_ENA;
362 } 359 }
363 360
364 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 361 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
365 dev->irq = link->irq.AssignedIRQ; 362 dev->irq = link->irq.AssignedIRQ;
366 dev->base_addr = link->io.BasePort1; 363 dev->base_addr = link->io.BasePort1;
367 364
@@ -398,7 +395,7 @@ static void axnet_config(dev_link_t *link)
398 Bit 2 of CCSR is active low. */ 395 Bit 2 of CCSR is active low. */
399 if (i == 32) { 396 if (i == 32) {
400 conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; 397 conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 };
401 pcmcia_access_configuration_register(link->handle, &reg); 398 pcmcia_access_configuration_register(link, &reg);
402 for (i = 0; i < 32; i++) { 399 for (i = 0; i < 32; i++) {
403 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); 400 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
404 if ((j != 0) && (j != 0xffff)) break; 401 if ((j != 0) && (j != 0xffff)) break;
@@ -408,7 +405,7 @@ static void axnet_config(dev_link_t *link)
408 info->phy_id = (i < 32) ? i : -1; 405 info->phy_id = (i < 32) ? i : -1;
409 link->dev_node = &info->node; 406 link->dev_node = &info->node;
410 link->state &= ~DEV_CONFIG_PENDING; 407 link->state &= ~DEV_CONFIG_PENDING;
411 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 408 SET_NETDEV_DEV(dev, &handle_to_dev(link));
412 409
413 if (register_netdev(dev) != 0) { 410 if (register_netdev(dev) != 0) {
414 printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); 411 printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
@@ -431,7 +428,7 @@ static void axnet_config(dev_link_t *link)
431 return; 428 return;
432 429
433cs_failed: 430cs_failed:
434 cs_error(link->handle, last_fn, last_ret); 431 cs_error(link, last_fn, last_ret);
435failed: 432failed:
436 axnet_release(link); 433 axnet_release(link);
437 link->state &= ~DEV_CONFIG_PENDING; 434 link->state &= ~DEV_CONFIG_PENDING;
@@ -446,14 +443,13 @@ failed:
446 443
447======================================================================*/ 444======================================================================*/
448 445
449static void axnet_release(dev_link_t *link) 446static void axnet_release(struct pcmcia_device *link)
450{ 447{
451 pcmcia_disable_device(link->handle); 448 pcmcia_disable_device(link);
452} 449}
453 450
454static int axnet_suspend(struct pcmcia_device *p_dev) 451static int axnet_suspend(struct pcmcia_device *link)
455{ 452{
456 dev_link_t *link = dev_to_instance(p_dev);
457 struct net_device *dev = link->priv; 453 struct net_device *dev = link->priv;
458 454
459 if ((link->state & DEV_CONFIG) && (link->open)) 455 if ((link->state & DEV_CONFIG) && (link->open))
@@ -462,9 +458,8 @@ static int axnet_suspend(struct pcmcia_device *p_dev)
462 return 0; 458 return 0;
463} 459}
464 460
465static int axnet_resume(struct pcmcia_device *p_dev) 461static int axnet_resume(struct pcmcia_device *link)
466{ 462{
467 dev_link_t *link = dev_to_instance(p_dev);
468 struct net_device *dev = link->priv; 463 struct net_device *dev = link->priv;
469 464
470 if ((link->state & DEV_CONFIG) && (link->open)) { 465 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -540,7 +535,7 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value)
540static int axnet_open(struct net_device *dev) 535static int axnet_open(struct net_device *dev)
541{ 536{
542 axnet_dev_t *info = PRIV(dev); 537 axnet_dev_t *info = PRIV(dev);
543 dev_link_t *link = info->p_dev; 538 struct pcmcia_device *link = info->p_dev;
544 539
545 DEBUG(2, "axnet_open('%s')\n", dev->name); 540 DEBUG(2, "axnet_open('%s')\n", dev->name);
546 541
@@ -566,7 +561,7 @@ static int axnet_open(struct net_device *dev)
566static int axnet_close(struct net_device *dev) 561static int axnet_close(struct net_device *dev)
567{ 562{
568 axnet_dev_t *info = PRIV(dev); 563 axnet_dev_t *info = PRIV(dev);
569 dev_link_t *link = info->p_dev; 564 struct pcmcia_device *link = info->p_dev;
570 565
571 DEBUG(2, "axnet_close('%s')\n", dev->name); 566 DEBUG(2, "axnet_close('%s')\n", dev->name);
572 567
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 44da01cdd26f..a9bcfb4ba15e 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -118,8 +118,8 @@ MODULE_LICENSE("GPL");
118 118
119/*====================================================================*/ 119/*====================================================================*/
120 120
121static void com20020_config(dev_link_t *link); 121static void com20020_config(struct pcmcia_device *link);
122static void com20020_release(dev_link_t *link); 122static void com20020_release(struct pcmcia_device *link);
123 123
124static void com20020_detach(struct pcmcia_device *p_dev); 124static void com20020_detach(struct pcmcia_device *p_dev);
125 125
@@ -198,9 +198,8 @@ fail_alloc_info:
198 198
199======================================================================*/ 199======================================================================*/
200 200
201static void com20020_detach(struct pcmcia_device *p_dev) 201static void com20020_detach(struct pcmcia_device *link)
202{ 202{
203 dev_link_t *link = dev_to_instance(p_dev);
204 struct com20020_dev_t *info = link->priv; 203 struct com20020_dev_t *info = link->priv;
205 struct net_device *dev = info->dev; 204 struct net_device *dev = info->dev;
206 205
@@ -251,10 +250,9 @@ static void com20020_detach(struct pcmcia_device *p_dev)
251#define CS_CHECK(fn, ret) \ 250#define CS_CHECK(fn, ret) \
252do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 251do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
253 252
254static void com20020_config(dev_link_t *link) 253static void com20020_config(struct pcmcia_device *link)
255{ 254{
256 struct arcnet_local *lp; 255 struct arcnet_local *lp;
257 client_handle_t handle;
258 tuple_t tuple; 256 tuple_t tuple;
259 cisparse_t parse; 257 cisparse_t parse;
260 com20020_dev_t *info; 258 com20020_dev_t *info;
@@ -263,7 +261,6 @@ static void com20020_config(dev_link_t *link)
263 u_char buf[64]; 261 u_char buf[64];
264 int ioaddr; 262 int ioaddr;
265 263
266 handle = link->handle;
267 info = link->priv; 264 info = link->priv;
268 dev = info->dev; 265 dev = info->dev;
269 266
@@ -276,9 +273,9 @@ static void com20020_config(dev_link_t *link)
276 tuple.TupleDataMax = 64; 273 tuple.TupleDataMax = 64;
277 tuple.TupleOffset = 0; 274 tuple.TupleOffset = 0;
278 tuple.DesiredTuple = CISTPL_CONFIG; 275 tuple.DesiredTuple = CISTPL_CONFIG;
279 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 276 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
280 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 277 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
281 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 278 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
282 link->conf.ConfigBase = parse.config.base; 279 link->conf.ConfigBase = parse.config.base;
283 280
284 /* Configure card */ 281 /* Configure card */
@@ -291,13 +288,13 @@ static void com20020_config(dev_link_t *link)
291 for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) 288 for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10)
292 { 289 {
293 link->io.BasePort1 = ioaddr; 290 link->io.BasePort1 = ioaddr;
294 i = pcmcia_request_io(link->handle, &link->io); 291 i = pcmcia_request_io(link, &link->io);
295 if (i == CS_SUCCESS) 292 if (i == CS_SUCCESS)
296 break; 293 break;
297 } 294 }
298 } 295 }
299 else 296 else
300 i = pcmcia_request_io(link->handle, &link->io); 297 i = pcmcia_request_io(link, &link->io);
301 298
302 if (i != CS_SUCCESS) 299 if (i != CS_SUCCESS)
303 { 300 {
@@ -311,7 +308,7 @@ static void com20020_config(dev_link_t *link)
311 DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n", 308 DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n",
312 link->irq.AssignedIRQ, 309 link->irq.AssignedIRQ,
313 link->irq.IRQInfo1, link->irq.IRQInfo2); 310 link->irq.IRQInfo1, link->irq.IRQInfo2);
314 i = pcmcia_request_irq(link->handle, &link->irq); 311 i = pcmcia_request_irq(link, &link->irq);
315 if (i != CS_SUCCESS) 312 if (i != CS_SUCCESS)
316 { 313 {
317 DEBUG(1,"arcnet: requestIRQ failed totally!\n"); 314 DEBUG(1,"arcnet: requestIRQ failed totally!\n");
@@ -320,7 +317,7 @@ static void com20020_config(dev_link_t *link)
320 317
321 dev->irq = link->irq.AssignedIRQ; 318 dev->irq = link->irq.AssignedIRQ;
322 319
323 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 320 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
324 321
325 if (com20020_check(dev)) 322 if (com20020_check(dev))
326 { 323 {
@@ -334,7 +331,7 @@ static void com20020_config(dev_link_t *link)
334 331
335 link->dev_node = &info->node; 332 link->dev_node = &info->node;
336 link->state &= ~DEV_CONFIG_PENDING; 333 link->state &= ~DEV_CONFIG_PENDING;
337 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 334 SET_NETDEV_DEV(dev, &handle_to_dev(link));
338 335
339 i = com20020_found(dev, 0); /* calls register_netdev */ 336 i = com20020_found(dev, 0); /* calls register_netdev */
340 337
@@ -351,7 +348,7 @@ static void com20020_config(dev_link_t *link)
351 return; 348 return;
352 349
353cs_failed: 350cs_failed:
354 cs_error(link->handle, last_fn, last_ret); 351 cs_error(link, last_fn, last_ret);
355failed: 352failed:
356 DEBUG(1,"com20020_config failed...\n"); 353 DEBUG(1,"com20020_config failed...\n");
357 com20020_release(link); 354 com20020_release(link);
@@ -365,15 +362,14 @@ failed:
365 362
366======================================================================*/ 363======================================================================*/
367 364
368static void com20020_release(dev_link_t *link) 365static void com20020_release(struct pcmcia_device *link)
369{ 366{
370 DEBUG(0, "com20020_release(0x%p)\n", link); 367 DEBUG(0, "com20020_release(0x%p)\n", link);
371 pcmcia_disable_device(link->handle); 368 pcmcia_disable_device(link);
372} 369}
373 370
374static int com20020_suspend(struct pcmcia_device *p_dev) 371static int com20020_suspend(struct pcmcia_device *link)
375{ 372{
376 dev_link_t *link = dev_to_instance(p_dev);
377 com20020_dev_t *info = link->priv; 373 com20020_dev_t *info = link->priv;
378 struct net_device *dev = info->dev; 374 struct net_device *dev = info->dev;
379 375
@@ -383,9 +379,8 @@ static int com20020_suspend(struct pcmcia_device *p_dev)
383 return 0; 379 return 0;
384} 380}
385 381
386static int com20020_resume(struct pcmcia_device *p_dev) 382static int com20020_resume(struct pcmcia_device *link)
387{ 383{
388 dev_link_t *link = dev_to_instance(p_dev);
389 com20020_dev_t *info = link->priv; 384 com20020_dev_t *info = link->priv;
390 struct net_device *dev = info->dev; 385 struct net_device *dev = info->dev;
391 386
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 3f0ace4ed732..ad3e490bb016 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -84,10 +84,10 @@ static char *version = DRV_NAME ".c " DRV_VERSION " 2002/03/23";
84/* 84/*
85 PCMCIA event handlers 85 PCMCIA event handlers
86 */ 86 */
87static void fmvj18x_config(dev_link_t *link); 87static void fmvj18x_config(struct pcmcia_device *link);
88static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id); 88static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id);
89static int fmvj18x_setup_mfc(dev_link_t *link); 89static int fmvj18x_setup_mfc(struct pcmcia_device *link);
90static void fmvj18x_release(dev_link_t *link); 90static void fmvj18x_release(struct pcmcia_device *link);
91static void fmvj18x_detach(struct pcmcia_device *p_dev); 91static void fmvj18x_detach(struct pcmcia_device *p_dev);
92 92
93/* 93/*
@@ -228,11 +228,10 @@ typedef struct local_info_t {
228#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */ 228#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
229#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */ 229#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */
230 230
231static int fmvj18x_attach(struct pcmcia_device *p_dev) 231static int fmvj18x_attach(struct pcmcia_device *link)
232{ 232{
233 local_info_t *lp; 233 local_info_t *lp;
234 struct net_device *dev; 234 struct net_device *dev;
235 dev_link_t *link = dev_to_instance(p_dev);
236 235
237 DEBUG(0, "fmvj18x_attach()\n"); 236 DEBUG(0, "fmvj18x_attach()\n");
238 237
@@ -242,7 +241,7 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
242 return -ENOMEM; 241 return -ENOMEM;
243 lp = netdev_priv(dev); 242 lp = netdev_priv(dev);
244 link->priv = dev; 243 link->priv = dev;
245 lp->p_dev = p_dev; 244 lp->p_dev = link;
246 245
247 /* The io structure describes IO port mapping */ 246 /* The io structure describes IO port mapping */
248 link->io.NumPorts1 = 32; 247 link->io.NumPorts1 = 32;
@@ -281,9 +280,8 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
281 280
282/*====================================================================*/ 281/*====================================================================*/
283 282
284static void fmvj18x_detach(struct pcmcia_device *p_dev) 283static void fmvj18x_detach(struct pcmcia_device *link)
285{ 284{
286 dev_link_t *link = dev_to_instance(p_dev);
287 struct net_device *dev = link->priv; 285 struct net_device *dev = link->priv;
288 286
289 DEBUG(0, "fmvj18x_detach(0x%p)\n", link); 287 DEBUG(0, "fmvj18x_detach(0x%p)\n", link);
@@ -302,7 +300,7 @@ static void fmvj18x_detach(struct pcmcia_device *p_dev)
302#define CS_CHECK(fn, ret) \ 300#define CS_CHECK(fn, ret) \
303do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 301do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
304 302
305static int mfc_try_io_port(dev_link_t *link) 303static int mfc_try_io_port(struct pcmcia_device *link)
306{ 304{
307 int i, ret; 305 int i, ret;
308 static const kio_addr_t serial_base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 306 static const kio_addr_t serial_base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
@@ -314,13 +312,13 @@ static int mfc_try_io_port(dev_link_t *link)
314 link->io.NumPorts2 = 0; 312 link->io.NumPorts2 = 0;
315 printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); 313 printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n");
316 } 314 }
317 ret = pcmcia_request_io(link->handle, &link->io); 315 ret = pcmcia_request_io(link, &link->io);
318 if (ret == CS_SUCCESS) return ret; 316 if (ret == CS_SUCCESS) return ret;
319 } 317 }
320 return ret; 318 return ret;
321} 319}
322 320
323static int ungermann_try_io_port(dev_link_t *link) 321static int ungermann_try_io_port(struct pcmcia_device *link)
324{ 322{
325 int ret; 323 int ret;
326 kio_addr_t ioaddr; 324 kio_addr_t ioaddr;
@@ -330,7 +328,7 @@ static int ungermann_try_io_port(dev_link_t *link)
330 */ 328 */
331 for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { 329 for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) {
332 link->io.BasePort1 = ioaddr; 330 link->io.BasePort1 = ioaddr;
333 ret = pcmcia_request_io(link->handle, &link->io); 331 ret = pcmcia_request_io(link, &link->io);
334 if (ret == CS_SUCCESS) { 332 if (ret == CS_SUCCESS) {
335 /* calculate ConfigIndex value */ 333 /* calculate ConfigIndex value */
336 link->conf.ConfigIndex = 334 link->conf.ConfigIndex =
@@ -341,9 +339,8 @@ static int ungermann_try_io_port(dev_link_t *link)
341 return ret; /* RequestIO failed */ 339 return ret; /* RequestIO failed */
342} 340}
343 341
344static void fmvj18x_config(dev_link_t *link) 342static void fmvj18x_config(struct pcmcia_device *link)
345{ 343{
346 client_handle_t handle = link->handle;
347 struct net_device *dev = link->priv; 344 struct net_device *dev = link->priv;
348 local_info_t *lp = netdev_priv(dev); 345 local_info_t *lp = netdev_priv(dev);
349 tuple_t tuple; 346 tuple_t tuple;
@@ -362,12 +359,12 @@ static void fmvj18x_config(dev_link_t *link)
362 registers. 359 registers.
363 */ 360 */
364 tuple.DesiredTuple = CISTPL_CONFIG; 361 tuple.DesiredTuple = CISTPL_CONFIG;
365 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 362 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
366 tuple.TupleData = (u_char *)buf; 363 tuple.TupleData = (u_char *)buf;
367 tuple.TupleDataMax = 64; 364 tuple.TupleDataMax = 64;
368 tuple.TupleOffset = 0; 365 tuple.TupleOffset = 0;
369 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 366 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
370 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 367 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
371 368
372 /* Configure card */ 369 /* Configure card */
373 link->state |= DEV_CONFIG; 370 link->state |= DEV_CONFIG;
@@ -377,16 +374,16 @@ static void fmvj18x_config(dev_link_t *link)
377 374
378 tuple.DesiredTuple = CISTPL_FUNCE; 375 tuple.DesiredTuple = CISTPL_FUNCE;
379 tuple.TupleOffset = 0; 376 tuple.TupleOffset = 0;
380 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) { 377 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
381 /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ 378 /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */
382 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 379 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
383 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 380 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
384 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 381 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
385 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 382 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
386 link->conf.ConfigIndex = parse.cftable_entry.index; 383 link->conf.ConfigIndex = parse.cftable_entry.index;
387 tuple.DesiredTuple = CISTPL_MANFID; 384 tuple.DesiredTuple = CISTPL_MANFID;
388 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) 385 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
389 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 386 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
390 else 387 else
391 buf[0] = 0xffff; 388 buf[0] = 0xffff;
392 switch (le16_to_cpu(buf[0])) { 389 switch (le16_to_cpu(buf[0])) {
@@ -420,8 +417,8 @@ static void fmvj18x_config(dev_link_t *link)
420 } else { 417 } else {
421 /* old type card */ 418 /* old type card */
422 tuple.DesiredTuple = CISTPL_MANFID; 419 tuple.DesiredTuple = CISTPL_MANFID;
423 if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) 420 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
424 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 421 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
425 else 422 else
426 buf[0] = 0xffff; 423 buf[0] = 0xffff;
427 switch (le16_to_cpu(buf[0])) { 424 switch (le16_to_cpu(buf[0])) {
@@ -452,10 +449,10 @@ static void fmvj18x_config(dev_link_t *link)
452 ret = ungermann_try_io_port(link); 449 ret = ungermann_try_io_port(link);
453 if (ret != CS_SUCCESS) goto cs_failed; 450 if (ret != CS_SUCCESS) goto cs_failed;
454 } else { 451 } else {
455 CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); 452 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
456 } 453 }
457 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 454 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
458 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 455 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
459 dev->irq = link->irq.AssignedIRQ; 456 dev->irq = link->irq.AssignedIRQ;
460 dev->base_addr = link->io.BasePort1; 457 dev->base_addr = link->io.BasePort1;
461 458
@@ -484,17 +481,17 @@ static void fmvj18x_config(dev_link_t *link)
484 case CONTEC: 481 case CONTEC:
485 tuple.DesiredTuple = CISTPL_FUNCE; 482 tuple.DesiredTuple = CISTPL_FUNCE;
486 tuple.TupleOffset = 0; 483 tuple.TupleOffset = 0;
487 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 484 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
488 tuple.TupleOffset = 0; 485 tuple.TupleOffset = 0;
489 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 486 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
490 if (cardtype == MBH10304) { 487 if (cardtype == MBH10304) {
491 /* MBH10304's CIS_FUNCE is corrupted */ 488 /* MBH10304's CIS_FUNCE is corrupted */
492 node_id = &(tuple.TupleData[5]); 489 node_id = &(tuple.TupleData[5]);
493 card_name = "FMV-J182"; 490 card_name = "FMV-J182";
494 } else { 491 } else {
495 while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) { 492 while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) {
496 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 493 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
497 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 494 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
498 } 495 }
499 node_id = &(tuple.TupleData[2]); 496 node_id = &(tuple.TupleData[2]);
500 if( cardtype == TDK ) { 497 if( cardtype == TDK ) {
@@ -538,7 +535,7 @@ static void fmvj18x_config(dev_link_t *link)
538 lp->cardtype = cardtype; 535 lp->cardtype = cardtype;
539 link->dev_node = &lp->node; 536 link->dev_node = &lp->node;
540 link->state &= ~DEV_CONFIG_PENDING; 537 link->state &= ~DEV_CONFIG_PENDING;
541 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 538 SET_NETDEV_DEV(dev, &handle_to_dev(link));
542 539
543 if (register_netdev(dev) != 0) { 540 if (register_netdev(dev) != 0) {
544 printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); 541 printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n");
@@ -559,7 +556,7 @@ static void fmvj18x_config(dev_link_t *link)
559 556
560cs_failed: 557cs_failed:
561 /* All Card Services errors end up here */ 558 /* All Card Services errors end up here */
562 cs_error(link->handle, last_fn, last_ret); 559 cs_error(link, last_fn, last_ret);
563failed: 560failed:
564 fmvj18x_release(link); 561 fmvj18x_release(link);
565 link->state &= ~DEV_CONFIG_PENDING; 562 link->state &= ~DEV_CONFIG_PENDING;
@@ -567,7 +564,7 @@ failed:
567} /* fmvj18x_config */ 564} /* fmvj18x_config */
568/*====================================================================*/ 565/*====================================================================*/
569 566
570static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id) 567static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
571{ 568{
572 win_req_t req; 569 win_req_t req;
573 memreq_t mem; 570 memreq_t mem;
@@ -578,9 +575,9 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
578 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 575 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
579 req.Base = 0; req.Size = 0; 576 req.Base = 0; req.Size = 0;
580 req.AccessSpeed = 0; 577 req.AccessSpeed = 0;
581 i = pcmcia_request_window(&link->handle, &req, &link->win); 578 i = pcmcia_request_window(&link, &req, &link->win);
582 if (i != CS_SUCCESS) { 579 if (i != CS_SUCCESS) {
583 cs_error(link->handle, RequestWindow, i); 580 cs_error(link, RequestWindow, i);
584 return -1; 581 return -1;
585 } 582 }
586 583
@@ -614,13 +611,13 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
614 iounmap(base); 611 iounmap(base);
615 j = pcmcia_release_window(link->win); 612 j = pcmcia_release_window(link->win);
616 if (j != CS_SUCCESS) 613 if (j != CS_SUCCESS)
617 cs_error(link->handle, ReleaseWindow, j); 614 cs_error(link, ReleaseWindow, j);
618 return (i != 0x200) ? 0 : -1; 615 return (i != 0x200) ? 0 : -1;
619 616
620} /* fmvj18x_get_hwinfo */ 617} /* fmvj18x_get_hwinfo */
621/*====================================================================*/ 618/*====================================================================*/
622 619
623static int fmvj18x_setup_mfc(dev_link_t *link) 620static int fmvj18x_setup_mfc(struct pcmcia_device *link)
624{ 621{
625 win_req_t req; 622 win_req_t req;
626 memreq_t mem; 623 memreq_t mem;
@@ -633,9 +630,9 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
633 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 630 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
634 req.Base = 0; req.Size = 0; 631 req.Base = 0; req.Size = 0;
635 req.AccessSpeed = 0; 632 req.AccessSpeed = 0;
636 i = pcmcia_request_window(&link->handle, &req, &link->win); 633 i = pcmcia_request_window(&link, &req, &link->win);
637 if (i != CS_SUCCESS) { 634 if (i != CS_SUCCESS) {
638 cs_error(link->handle, RequestWindow, i); 635 cs_error(link, RequestWindow, i);
639 return -1; 636 return -1;
640 } 637 }
641 638
@@ -657,21 +654,20 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
657 iounmap(base); 654 iounmap(base);
658 j = pcmcia_release_window(link->win); 655 j = pcmcia_release_window(link->win);
659 if (j != CS_SUCCESS) 656 if (j != CS_SUCCESS)
660 cs_error(link->handle, ReleaseWindow, j); 657 cs_error(link, ReleaseWindow, j);
661 return 0; 658 return 0;
662 659
663} 660}
664/*====================================================================*/ 661/*====================================================================*/
665 662
666static void fmvj18x_release(dev_link_t *link) 663static void fmvj18x_release(struct pcmcia_device *link)
667{ 664{
668 DEBUG(0, "fmvj18x_release(0x%p)\n", link); 665 DEBUG(0, "fmvj18x_release(0x%p)\n", link);
669 pcmcia_disable_device(link->handle); 666 pcmcia_disable_device(link);
670} 667}
671 668
672static int fmvj18x_suspend(struct pcmcia_device *p_dev) 669static int fmvj18x_suspend(struct pcmcia_device *link)
673{ 670{
674 dev_link_t *link = dev_to_instance(p_dev);
675 struct net_device *dev = link->priv; 671 struct net_device *dev = link->priv;
676 672
677 if ((link->state & DEV_CONFIG) && (link->open)) 673 if ((link->state & DEV_CONFIG) && (link->open))
@@ -680,9 +676,8 @@ static int fmvj18x_suspend(struct pcmcia_device *p_dev)
680 return 0; 676 return 0;
681} 677}
682 678
683static int fmvj18x_resume(struct pcmcia_device *p_dev) 679static int fmvj18x_resume(struct pcmcia_device *link)
684{ 680{
685 dev_link_t *link = dev_to_instance(p_dev);
686 struct net_device *dev = link->priv; 681 struct net_device *dev = link->priv;
687 682
688 if ((link->state & DEV_CONFIG) && (link->open)) { 683 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -1122,7 +1117,7 @@ static int fjn_config(struct net_device *dev, struct ifmap *map){
1122static int fjn_open(struct net_device *dev) 1117static int fjn_open(struct net_device *dev)
1123{ 1118{
1124 struct local_info_t *lp = netdev_priv(dev); 1119 struct local_info_t *lp = netdev_priv(dev);
1125 dev_link_t *link = lp->p_dev; 1120 struct pcmcia_device *link = lp->p_dev;
1126 1121
1127 DEBUG(4, "fjn_open('%s').\n", dev->name); 1122 DEBUG(4, "fjn_open('%s').\n", dev->name);
1128 1123
@@ -1147,7 +1142,7 @@ static int fjn_open(struct net_device *dev)
1147static int fjn_close(struct net_device *dev) 1142static int fjn_close(struct net_device *dev)
1148{ 1143{
1149 struct local_info_t *lp = netdev_priv(dev); 1144 struct local_info_t *lp = netdev_priv(dev);
1150 dev_link_t *link = lp->p_dev; 1145 struct pcmcia_device *link = lp->p_dev;
1151 kio_addr_t ioaddr = dev->base_addr; 1146 kio_addr_t ioaddr = dev->base_addr;
1152 1147
1153 DEBUG(4, "fjn_close('%s').\n", dev->name); 1148 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 f4c3dd870aca..1b8b44dc4c50 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -105,9 +105,9 @@ MODULE_LICENSE("GPL");
105 105
106/*====================================================================*/ 106/*====================================================================*/
107 107
108static void ibmtr_config(dev_link_t *link); 108static void ibmtr_config(struct pcmcia_device *link);
109static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase); 109static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase);
110static void ibmtr_release(dev_link_t *link); 110static void ibmtr_release(struct pcmcia_device *link);
111static void ibmtr_detach(struct pcmcia_device *p_dev); 111static void ibmtr_detach(struct pcmcia_device *p_dev);
112 112
113/*====================================================================*/ 113/*====================================================================*/
@@ -138,12 +138,11 @@ static struct ethtool_ops netdev_ethtool_ops = {
138 138
139======================================================================*/ 139======================================================================*/
140 140
141static int ibmtr_attach(struct pcmcia_device *p_dev) 141static int ibmtr_attach(struct pcmcia_device *link)
142{ 142{
143 ibmtr_dev_t *info; 143 ibmtr_dev_t *info;
144 struct net_device *dev; 144 struct net_device *dev;
145 dev_link_t *link = dev_to_instance(p_dev); 145
146
147 DEBUG(0, "ibmtr_attach()\n"); 146 DEBUG(0, "ibmtr_attach()\n");
148 147
149 /* Create new token-ring device */ 148 /* Create new token-ring device */
@@ -156,7 +155,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
156 return -ENOMEM; 155 return -ENOMEM;
157 } 156 }
158 157
159 info->p_dev = p_dev; 158 info->p_dev = link;
160 link->priv = info; 159 link->priv = info;
161 info->ti = netdev_priv(dev); 160 info->ti = netdev_priv(dev);
162 161
@@ -189,9 +188,8 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
189 188
190======================================================================*/ 189======================================================================*/
191 190
192static void ibmtr_detach(struct pcmcia_device *p_dev) 191static void ibmtr_detach(struct pcmcia_device *link)
193{ 192{
194 dev_link_t *link = dev_to_instance(p_dev);
195 struct ibmtr_dev_t *info = link->priv; 193 struct ibmtr_dev_t *info = link->priv;
196 struct net_device *dev = info->dev; 194 struct net_device *dev = info->dev;
197 195
@@ -222,9 +220,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
222#define CS_CHECK(fn, ret) \ 220#define CS_CHECK(fn, ret) \
223do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
224 222
225static void ibmtr_config(dev_link_t *link) 223static void ibmtr_config(struct pcmcia_device *link)
226{ 224{
227 client_handle_t handle = link->handle;
228 ibmtr_dev_t *info = link->priv; 225 ibmtr_dev_t *info = link->priv;
229 struct net_device *dev = info->dev; 226 struct net_device *dev = info->dev;
230 struct tok_info *ti = netdev_priv(dev); 227 struct tok_info *ti = netdev_priv(dev);
@@ -242,9 +239,9 @@ static void ibmtr_config(dev_link_t *link)
242 tuple.TupleDataMax = 64; 239 tuple.TupleDataMax = 64;
243 tuple.TupleOffset = 0; 240 tuple.TupleOffset = 0;
244 tuple.DesiredTuple = CISTPL_CONFIG; 241 tuple.DesiredTuple = CISTPL_CONFIG;
245 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 242 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
246 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 243 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
247 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 244 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
248 link->conf.ConfigBase = parse.config.base; 245 link->conf.ConfigBase = parse.config.base;
249 246
250 /* Configure card */ 247 /* Configure card */
@@ -256,15 +253,15 @@ static void ibmtr_config(dev_link_t *link)
256 253
257 /* Try PRIMARY card at 0xA20-0xA23 */ 254 /* Try PRIMARY card at 0xA20-0xA23 */
258 link->io.BasePort1 = 0xA20; 255 link->io.BasePort1 = 0xA20;
259 i = pcmcia_request_io(link->handle, &link->io); 256 i = pcmcia_request_io(link, &link->io);
260 if (i != CS_SUCCESS) { 257 if (i != CS_SUCCESS) {
261 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ 258 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
262 link->io.BasePort1 = 0xA24; 259 link->io.BasePort1 = 0xA24;
263 CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); 260 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
264 } 261 }
265 dev->base_addr = link->io.BasePort1; 262 dev->base_addr = link->io.BasePort1;
266 263
267 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 264 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
268 dev->irq = link->irq.AssignedIRQ; 265 dev->irq = link->irq.AssignedIRQ;
269 ti->irq = link->irq.AssignedIRQ; 266 ti->irq = link->irq.AssignedIRQ;
270 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 267 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
@@ -275,7 +272,7 @@ static void ibmtr_config(dev_link_t *link)
275 req.Base = 0; 272 req.Base = 0;
276 req.Size = 0x2000; 273 req.Size = 0x2000;
277 req.AccessSpeed = 250; 274 req.AccessSpeed = 250;
278 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 275 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
279 276
280 mem.CardOffset = mmiobase; 277 mem.CardOffset = mmiobase;
281 mem.Page = 0; 278 mem.Page = 0;
@@ -288,7 +285,7 @@ static void ibmtr_config(dev_link_t *link)
288 req.Base = 0; 285 req.Base = 0;
289 req.Size = sramsize * 1024; 286 req.Size = sramsize * 1024;
290 req.AccessSpeed = 250; 287 req.AccessSpeed = 250;
291 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &info->sram_win_handle)); 288 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle));
292 289
293 mem.CardOffset = srambase; 290 mem.CardOffset = srambase;
294 mem.Page = 0; 291 mem.Page = 0;
@@ -298,7 +295,7 @@ static void ibmtr_config(dev_link_t *link)
298 ti->sram_virt = ioremap(req.Base, req.Size); 295 ti->sram_virt = ioremap(req.Base, req.Size);
299 ti->sram_phys = req.Base; 296 ti->sram_phys = req.Base;
300 297
301 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 298 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
302 299
303 /* Set up the Token-Ring Controller Configuration Register and 300 /* Set up the Token-Ring Controller Configuration Register and
304 turn on the card. Check the "Local Area Network Credit Card 301 turn on the card. Check the "Local Area Network Credit Card
@@ -307,7 +304,7 @@ static void ibmtr_config(dev_link_t *link)
307 304
308 link->dev_node = &info->node; 305 link->dev_node = &info->node;
309 link->state &= ~DEV_CONFIG_PENDING; 306 link->state &= ~DEV_CONFIG_PENDING;
310 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 307 SET_NETDEV_DEV(dev, &handle_to_dev(link));
311 308
312 i = ibmtr_probe_card(dev); 309 i = ibmtr_probe_card(dev);
313 if (i != 0) { 310 if (i != 0) {
@@ -329,7 +326,7 @@ static void ibmtr_config(dev_link_t *link)
329 return; 326 return;
330 327
331cs_failed: 328cs_failed:
332 cs_error(link->handle, last_fn, last_ret); 329 cs_error(link, last_fn, last_ret);
333failed: 330failed:
334 ibmtr_release(link); 331 ibmtr_release(link);
335} /* ibmtr_config */ 332} /* ibmtr_config */
@@ -342,7 +339,7 @@ failed:
342 339
343======================================================================*/ 340======================================================================*/
344 341
345static void ibmtr_release(dev_link_t *link) 342static void ibmtr_release(struct pcmcia_device *link)
346{ 343{
347 ibmtr_dev_t *info = link->priv; 344 ibmtr_dev_t *info = link->priv;
348 struct net_device *dev = info->dev; 345 struct net_device *dev = info->dev;
@@ -354,12 +351,11 @@ static void ibmtr_release(dev_link_t *link)
354 iounmap(ti->mmio); 351 iounmap(ti->mmio);
355 pcmcia_release_window(info->sram_win_handle); 352 pcmcia_release_window(info->sram_win_handle);
356 } 353 }
357 pcmcia_disable_device(link->handle); 354 pcmcia_disable_device(link);
358} 355}
359 356
360static int ibmtr_suspend(struct pcmcia_device *p_dev) 357static int ibmtr_suspend(struct pcmcia_device *link)
361{ 358{
362 dev_link_t *link = dev_to_instance(p_dev);
363 ibmtr_dev_t *info = link->priv; 359 ibmtr_dev_t *info = link->priv;
364 struct net_device *dev = info->dev; 360 struct net_device *dev = info->dev;
365 361
@@ -369,9 +365,8 @@ static int ibmtr_suspend(struct pcmcia_device *p_dev)
369 return 0; 365 return 0;
370} 366}
371 367
372static int ibmtr_resume(struct pcmcia_device *p_dev) 368static int ibmtr_resume(struct pcmcia_device *link)
373{ 369{
374 dev_link_t *link = dev_to_instance(p_dev);
375 ibmtr_dev_t *info = link->priv; 370 ibmtr_dev_t *info = link->priv;
376 struct net_device *dev = info->dev; 371 struct net_device *dev = info->dev;
377 372
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 0ccca12d9d6e..8b8e7162314c 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -417,8 +417,8 @@ INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
417Function Prototypes 417Function Prototypes
418---------------------------------------------------------------------------- */ 418---------------------------------------------------------------------------- */
419 419
420static void nmclan_config(dev_link_t *link); 420static void nmclan_config(struct pcmcia_device *link);
421static void nmclan_release(dev_link_t *link); 421static void nmclan_release(struct pcmcia_device *link);
422 422
423static void nmclan_reset(struct net_device *dev); 423static void nmclan_reset(struct net_device *dev);
424static int mace_config(struct net_device *dev, struct ifmap *map); 424static int mace_config(struct net_device *dev, struct ifmap *map);
@@ -443,11 +443,10 @@ nmclan_attach
443 Services. 443 Services.
444---------------------------------------------------------------------------- */ 444---------------------------------------------------------------------------- */
445 445
446static int nmclan_attach(struct pcmcia_device *p_dev) 446static int nmclan_attach(struct pcmcia_device *link)
447{ 447{
448 mace_private *lp; 448 mace_private *lp;
449 struct net_device *dev; 449 struct net_device *dev;
450 dev_link_t *link = dev_to_instance(p_dev);
451 450
452 DEBUG(0, "nmclan_attach()\n"); 451 DEBUG(0, "nmclan_attach()\n");
453 DEBUG(1, "%s\n", rcsid); 452 DEBUG(1, "%s\n", rcsid);
@@ -457,7 +456,7 @@ static int nmclan_attach(struct pcmcia_device *p_dev)
457 if (!dev) 456 if (!dev)
458 return -ENOMEM; 457 return -ENOMEM;
459 lp = netdev_priv(dev); 458 lp = netdev_priv(dev);
460 lp->p_dev = p_dev; 459 lp->p_dev = link;
461 link->priv = dev; 460 link->priv = dev;
462 461
463 spin_lock_init(&lp->bank_lock); 462 spin_lock_init(&lp->bank_lock);
@@ -502,9 +501,8 @@ nmclan_detach
502 when the device is released. 501 when the device is released.
503---------------------------------------------------------------------------- */ 502---------------------------------------------------------------------------- */
504 503
505static void nmclan_detach(struct pcmcia_device *p_dev) 504static void nmclan_detach(struct pcmcia_device *link)
506{ 505{
507 dev_link_t *link = dev_to_instance(p_dev);
508 struct net_device *dev = link->priv; 506 struct net_device *dev = link->priv;
509 507
510 DEBUG(0, "nmclan_detach(0x%p)\n", link); 508 DEBUG(0, "nmclan_detach(0x%p)\n", link);
@@ -657,9 +655,8 @@ nmclan_config
657#define CS_CHECK(fn, ret) \ 655#define CS_CHECK(fn, ret) \
658 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 656 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
659 657
660static void nmclan_config(dev_link_t *link) 658static void nmclan_config(struct pcmcia_device *link)
661{ 659{
662 client_handle_t handle = link->handle;
663 struct net_device *dev = link->priv; 660 struct net_device *dev = link->priv;
664 mace_private *lp = netdev_priv(dev); 661 mace_private *lp = netdev_priv(dev);
665 tuple_t tuple; 662 tuple_t tuple;
@@ -675,17 +672,17 @@ static void nmclan_config(dev_link_t *link)
675 tuple.TupleDataMax = 64; 672 tuple.TupleDataMax = 64;
676 tuple.TupleOffset = 0; 673 tuple.TupleOffset = 0;
677 tuple.DesiredTuple = CISTPL_CONFIG; 674 tuple.DesiredTuple = CISTPL_CONFIG;
678 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 675 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
679 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 676 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
680 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 677 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
681 link->conf.ConfigBase = parse.config.base; 678 link->conf.ConfigBase = parse.config.base;
682 679
683 /* Configure card */ 680 /* Configure card */
684 link->state |= DEV_CONFIG; 681 link->state |= DEV_CONFIG;
685 682
686 CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io)); 683 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
687 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 684 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
688 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 685 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
689 dev->irq = link->irq.AssignedIRQ; 686 dev->irq = link->irq.AssignedIRQ;
690 dev->base_addr = link->io.BasePort1; 687 dev->base_addr = link->io.BasePort1;
691 688
@@ -696,8 +693,8 @@ static void nmclan_config(dev_link_t *link)
696 tuple.TupleData = buf; 693 tuple.TupleData = buf;
697 tuple.TupleDataMax = 64; 694 tuple.TupleDataMax = 64;
698 tuple.TupleOffset = 0; 695 tuple.TupleOffset = 0;
699 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 696 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
700 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 697 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
701 memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN); 698 memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN);
702 699
703 /* Verify configuration by reading the MACE ID. */ 700 /* Verify configuration by reading the MACE ID. */
@@ -728,7 +725,7 @@ static void nmclan_config(dev_link_t *link)
728 725
729 link->dev_node = &lp->node; 726 link->dev_node = &lp->node;
730 link->state &= ~DEV_CONFIG_PENDING; 727 link->state &= ~DEV_CONFIG_PENDING;
731 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 728 SET_NETDEV_DEV(dev, &handle_to_dev(link));
732 729
733 i = register_netdev(dev); 730 i = register_netdev(dev);
734 if (i != 0) { 731 if (i != 0) {
@@ -746,7 +743,7 @@ static void nmclan_config(dev_link_t *link)
746 return; 743 return;
747 744
748cs_failed: 745cs_failed:
749 cs_error(link->handle, last_fn, last_ret); 746 cs_error(link, last_fn, last_ret);
750failed: 747failed:
751 nmclan_release(link); 748 nmclan_release(link);
752 return; 749 return;
@@ -759,15 +756,14 @@ nmclan_release
759 net device, and release the PCMCIA configuration. If the device 756 net device, and release the PCMCIA configuration. If the device
760 is still open, this will be postponed until it is closed. 757 is still open, this will be postponed until it is closed.
761---------------------------------------------------------------------------- */ 758---------------------------------------------------------------------------- */
762static void nmclan_release(dev_link_t *link) 759static void nmclan_release(struct pcmcia_device *link)
763{ 760{
764 DEBUG(0, "nmclan_release(0x%p)\n", link); 761 DEBUG(0, "nmclan_release(0x%p)\n", link);
765 pcmcia_disable_device(link->handle); 762 pcmcia_disable_device(link);
766} 763}
767 764
768static int nmclan_suspend(struct pcmcia_device *p_dev) 765static int nmclan_suspend(struct pcmcia_device *link)
769{ 766{
770 dev_link_t *link = dev_to_instance(p_dev);
771 struct net_device *dev = link->priv; 767 struct net_device *dev = link->priv;
772 768
773 if ((link->state & DEV_CONFIG) && (link->open)) 769 if ((link->state & DEV_CONFIG) && (link->open))
@@ -776,9 +772,8 @@ static int nmclan_suspend(struct pcmcia_device *p_dev)
776 return 0; 772 return 0;
777} 773}
778 774
779static int nmclan_resume(struct pcmcia_device *p_dev) 775static int nmclan_resume(struct pcmcia_device *link)
780{ 776{
781 dev_link_t *link = dev_to_instance(p_dev);
782 struct net_device *dev = link->priv; 777 struct net_device *dev = link->priv;
783 778
784 if ((link->state & DEV_CONFIG) && (link->open)) { 779 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -799,7 +794,7 @@ static void nmclan_reset(struct net_device *dev)
799 mace_private *lp = netdev_priv(dev); 794 mace_private *lp = netdev_priv(dev);
800 795
801#if RESET_XILINX 796#if RESET_XILINX
802 dev_link_t *link = &lp->link; 797 struct pcmcia_device *link = &lp->link;
803 conf_reg_t reg; 798 conf_reg_t reg;
804 u_long OrigCorValue; 799 u_long OrigCorValue;
805 800
@@ -808,7 +803,7 @@ static void nmclan_reset(struct net_device *dev)
808 reg.Action = CS_READ; 803 reg.Action = CS_READ;
809 reg.Offset = CISREG_COR; 804 reg.Offset = CISREG_COR;
810 reg.Value = 0; 805 reg.Value = 0;
811 pcmcia_access_configuration_register(link->handle, &reg); 806 pcmcia_access_configuration_register(link, &reg);
812 OrigCorValue = reg.Value; 807 OrigCorValue = reg.Value;
813 808
814 /* Reset Xilinx */ 809 /* Reset Xilinx */
@@ -817,12 +812,12 @@ static void nmclan_reset(struct net_device *dev)
817 DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", 812 DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n",
818 OrigCorValue); 813 OrigCorValue);
819 reg.Value = COR_SOFT_RESET; 814 reg.Value = COR_SOFT_RESET;
820 pcmcia_access_configuration_register(link->handle, &reg); 815 pcmcia_access_configuration_register(link, &reg);
821 /* Need to wait for 20 ms for PCMCIA to finish reset. */ 816 /* Need to wait for 20 ms for PCMCIA to finish reset. */
822 817
823 /* Restore original COR configuration index */ 818 /* Restore original COR configuration index */
824 reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK); 819 reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK);
825 pcmcia_access_configuration_register(link->handle, &reg); 820 pcmcia_access_configuration_register(link, &reg);
826 /* Xilinx is now completely reset along with the MACE chip. */ 821 /* Xilinx is now completely reset along with the MACE chip. */
827 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 822 lp->tx_free_frames=AM2150_MAX_TX_FRAMES;
828 823
@@ -866,7 +861,7 @@ static int mace_open(struct net_device *dev)
866{ 861{
867 kio_addr_t ioaddr = dev->base_addr; 862 kio_addr_t ioaddr = dev->base_addr;
868 mace_private *lp = netdev_priv(dev); 863 mace_private *lp = netdev_priv(dev);
869 dev_link_t *link = lp->p_dev; 864 struct pcmcia_device *link = lp->p_dev;
870 865
871 if (!DEV_OK(link)) 866 if (!DEV_OK(link))
872 return -ENODEV; 867 return -ENODEV;
@@ -889,7 +884,7 @@ static int mace_close(struct net_device *dev)
889{ 884{
890 kio_addr_t ioaddr = dev->base_addr; 885 kio_addr_t ioaddr = dev->base_addr;
891 mace_private *lp = netdev_priv(dev); 886 mace_private *lp = netdev_priv(dev);
892 dev_link_t *link = lp->p_dev; 887 struct pcmcia_device *link = lp->p_dev;
893 888
894 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 889 DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
895 890
@@ -944,12 +939,12 @@ mace_start_xmit
944static void mace_tx_timeout(struct net_device *dev) 939static void mace_tx_timeout(struct net_device *dev)
945{ 940{
946 mace_private *lp = netdev_priv(dev); 941 mace_private *lp = netdev_priv(dev);
947 dev_link_t *link = lp->p_dev; 942 struct pcmcia_device *link = lp->p_dev;
948 943
949 printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); 944 printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name);
950#if RESET_ON_TIMEOUT 945#if RESET_ON_TIMEOUT
951 printk("resetting card\n"); 946 printk("resetting card\n");
952 pcmcia_reset_card(link->handle, NULL); 947 pcmcia_reset_card(link, NULL);
953#else /* #if RESET_ON_TIMEOUT */ 948#else /* #if RESET_ON_TIMEOUT */
954 printk("NOT resetting card\n"); 949 printk("NOT resetting card\n");
955#endif /* #if RESET_ON_TIMEOUT */ 950#endif /* #if RESET_ON_TIMEOUT */
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 8ed6a410ea10..9f41355e6beb 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -103,8 +103,8 @@ module_param_array(hw_addr, int, NULL, 0);
103/*====================================================================*/ 103/*====================================================================*/
104 104
105static void mii_phy_probe(struct net_device *dev); 105static void mii_phy_probe(struct net_device *dev);
106static void pcnet_config(dev_link_t *link); 106static void pcnet_config(struct pcmcia_device *link);
107static void pcnet_release(dev_link_t *link); 107static void pcnet_release(struct pcmcia_device *link);
108static int pcnet_open(struct net_device *dev); 108static int pcnet_open(struct net_device *dev);
109static int pcnet_close(struct net_device *dev); 109static int pcnet_close(struct net_device *dev);
110static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 110static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -113,9 +113,9 @@ static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs);
113static void ei_watchdog(u_long arg); 113static void ei_watchdog(u_long arg);
114static void pcnet_reset_8390(struct net_device *dev); 114static void pcnet_reset_8390(struct net_device *dev);
115static int set_config(struct net_device *dev, struct ifmap *map); 115static int set_config(struct net_device *dev, struct ifmap *map);
116static int setup_shmem_window(dev_link_t *link, int start_pg, 116static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
117 int stop_pg, int cm_offset); 117 int stop_pg, int cm_offset);
118static int setup_dma_config(dev_link_t *link, int start_pg, 118static int setup_dma_config(struct pcmcia_device *link, int start_pg,
119 int stop_pg); 119 int stop_pg);
120 120
121static void pcnet_detach(struct pcmcia_device *p_dev); 121static void pcnet_detach(struct pcmcia_device *p_dev);
@@ -240,11 +240,10 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev)
240 240
241======================================================================*/ 241======================================================================*/
242 242
243static int pcnet_probe(struct pcmcia_device *p_dev) 243static int pcnet_probe(struct pcmcia_device *link)
244{ 244{
245 pcnet_dev_t *info; 245 pcnet_dev_t *info;
246 struct net_device *dev; 246 struct net_device *dev;
247 dev_link_t *link = dev_to_instance(p_dev);
248 247
249 DEBUG(0, "pcnet_attach()\n"); 248 DEBUG(0, "pcnet_attach()\n");
250 249
@@ -252,7 +251,7 @@ static int pcnet_probe(struct pcmcia_device *p_dev)
252 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); 251 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t));
253 if (!dev) return -ENOMEM; 252 if (!dev) return -ENOMEM;
254 info = PRIV(dev); 253 info = PRIV(dev);
255 info->p_dev = p_dev; 254 info->p_dev = link;
256 link->priv = dev; 255 link->priv = dev;
257 256
258 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 257 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@@ -280,9 +279,8 @@ static int pcnet_probe(struct pcmcia_device *p_dev)
280 279
281======================================================================*/ 280======================================================================*/
282 281
283static void pcnet_detach(struct pcmcia_device *p_dev) 282static void pcnet_detach(struct pcmcia_device *link)
284{ 283{
285 dev_link_t *link = dev_to_instance(p_dev);
286 struct net_device *dev = link->priv; 284 struct net_device *dev = link->priv;
287 285
288 DEBUG(0, "pcnet_detach(0x%p)\n", link); 286 DEBUG(0, "pcnet_detach(0x%p)\n", link);
@@ -303,7 +301,7 @@ static void pcnet_detach(struct pcmcia_device *p_dev)
303 301
304======================================================================*/ 302======================================================================*/
305 303
306static hw_info_t *get_hwinfo(dev_link_t *link) 304static hw_info_t *get_hwinfo(struct pcmcia_device *link)
307{ 305{
308 struct net_device *dev = link->priv; 306 struct net_device *dev = link->priv;
309 win_req_t req; 307 win_req_t req;
@@ -315,9 +313,9 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
315 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 313 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
316 req.Base = 0; req.Size = 0; 314 req.Base = 0; req.Size = 0;
317 req.AccessSpeed = 0; 315 req.AccessSpeed = 0;
318 i = pcmcia_request_window(&link->handle, &req, &link->win); 316 i = pcmcia_request_window(&link, &req, &link->win);
319 if (i != CS_SUCCESS) { 317 if (i != CS_SUCCESS) {
320 cs_error(link->handle, RequestWindow, i); 318 cs_error(link, RequestWindow, i);
321 return NULL; 319 return NULL;
322 } 320 }
323 321
@@ -340,7 +338,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
340 iounmap(virt); 338 iounmap(virt);
341 j = pcmcia_release_window(link->win); 339 j = pcmcia_release_window(link->win);
342 if (j != CS_SUCCESS) 340 if (j != CS_SUCCESS)
343 cs_error(link->handle, ReleaseWindow, j); 341 cs_error(link, ReleaseWindow, j);
344 return (i < NR_INFO) ? hw_info+i : NULL; 342 return (i < NR_INFO) ? hw_info+i : NULL;
345} /* get_hwinfo */ 343} /* get_hwinfo */
346 344
@@ -352,7 +350,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link)
352 350
353======================================================================*/ 351======================================================================*/
354 352
355static hw_info_t *get_prom(dev_link_t *link) 353static hw_info_t *get_prom(struct pcmcia_device *link)
356{ 354{
357 struct net_device *dev = link->priv; 355 struct net_device *dev = link->priv;
358 kio_addr_t ioaddr = dev->base_addr; 356 kio_addr_t ioaddr = dev->base_addr;
@@ -406,7 +404,7 @@ static hw_info_t *get_prom(dev_link_t *link)
406 404
407======================================================================*/ 405======================================================================*/
408 406
409static hw_info_t *get_dl10019(dev_link_t *link) 407static hw_info_t *get_dl10019(struct pcmcia_device *link)
410{ 408{
411 struct net_device *dev = link->priv; 409 struct net_device *dev = link->priv;
412 int i; 410 int i;
@@ -428,7 +426,7 @@ static hw_info_t *get_dl10019(dev_link_t *link)
428 426
429======================================================================*/ 427======================================================================*/
430 428
431static hw_info_t *get_ax88190(dev_link_t *link) 429static hw_info_t *get_ax88190(struct pcmcia_device *link)
432{ 430{
433 struct net_device *dev = link->priv; 431 struct net_device *dev = link->priv;
434 kio_addr_t ioaddr = dev->base_addr; 432 kio_addr_t ioaddr = dev->base_addr;
@@ -461,7 +459,7 @@ static hw_info_t *get_ax88190(dev_link_t *link)
461 459
462======================================================================*/ 460======================================================================*/
463 461
464static hw_info_t *get_hwired(dev_link_t *link) 462static hw_info_t *get_hwired(struct pcmcia_device *link)
465{ 463{
466 struct net_device *dev = link->priv; 464 struct net_device *dev = link->priv;
467 int i; 465 int i;
@@ -488,7 +486,7 @@ static hw_info_t *get_hwired(dev_link_t *link)
488#define CS_CHECK(fn, ret) \ 486#define CS_CHECK(fn, ret) \
489do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 487do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
490 488
491static int try_io_port(dev_link_t *link) 489static int try_io_port(struct pcmcia_device *link)
492{ 490{
493 int j, ret; 491 int j, ret;
494 if (link->io.NumPorts1 == 32) { 492 if (link->io.NumPorts1 == 32) {
@@ -509,18 +507,17 @@ static int try_io_port(dev_link_t *link)
509 for (j = 0; j < 0x400; j += 0x20) { 507 for (j = 0; j < 0x400; j += 0x20) {
510 link->io.BasePort1 = j ^ 0x300; 508 link->io.BasePort1 = j ^ 0x300;
511 link->io.BasePort2 = (j ^ 0x300) + 0x10; 509 link->io.BasePort2 = (j ^ 0x300) + 0x10;
512 ret = pcmcia_request_io(link->handle, &link->io); 510 ret = pcmcia_request_io(link, &link->io);
513 if (ret == CS_SUCCESS) return ret; 511 if (ret == CS_SUCCESS) return ret;
514 } 512 }
515 return ret; 513 return ret;
516 } else { 514 } else {
517 return pcmcia_request_io(link->handle, &link->io); 515 return pcmcia_request_io(link, &link->io);
518 } 516 }
519} 517}
520 518
521static void pcnet_config(dev_link_t *link) 519static void pcnet_config(struct pcmcia_device *link)
522{ 520{
523 client_handle_t handle = link->handle;
524 struct net_device *dev = link->priv; 521 struct net_device *dev = link->priv;
525 pcnet_dev_t *info = PRIV(dev); 522 pcnet_dev_t *info = PRIV(dev);
526 tuple_t tuple; 523 tuple_t tuple;
@@ -537,9 +534,9 @@ static void pcnet_config(dev_link_t *link)
537 tuple.TupleDataMax = sizeof(buf); 534 tuple.TupleDataMax = sizeof(buf);
538 tuple.TupleOffset = 0; 535 tuple.TupleOffset = 0;
539 tuple.DesiredTuple = CISTPL_CONFIG; 536 tuple.DesiredTuple = CISTPL_CONFIG;
540 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 537 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
541 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 538 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
542 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 539 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
543 link->conf.ConfigBase = parse.config.base; 540 link->conf.ConfigBase = parse.config.base;
544 link->conf.Present = parse.config.rmask[0]; 541 link->conf.Present = parse.config.rmask[0];
545 542
@@ -548,21 +545,21 @@ static void pcnet_config(dev_link_t *link)
548 545
549 tuple.DesiredTuple = CISTPL_MANFID; 546 tuple.DesiredTuple = CISTPL_MANFID;
550 tuple.Attributes = TUPLE_RETURN_COMMON; 547 tuple.Attributes = TUPLE_RETURN_COMMON;
551 if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && 548 if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
552 (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) { 549 (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) {
553 manfid = le16_to_cpu(buf[0]); 550 manfid = le16_to_cpu(buf[0]);
554 prodid = le16_to_cpu(buf[1]); 551 prodid = le16_to_cpu(buf[1]);
555 } 552 }
556 553
557 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 554 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
558 tuple.Attributes = 0; 555 tuple.Attributes = 0;
559 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 556 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
560 while (last_ret == CS_SUCCESS) { 557 while (last_ret == CS_SUCCESS) {
561 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 558 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
562 cistpl_io_t *io = &(parse.cftable_entry.io); 559 cistpl_io_t *io = &(parse.cftable_entry.io);
563 560
564 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 561 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
565 pcmcia_parse_tuple(handle, &tuple, &parse) != 0 || 562 pcmcia_parse_tuple(link, &tuple, &parse) != 0 ||
566 cfg->index == 0 || cfg->io.nwin == 0) 563 cfg->index == 0 || cfg->io.nwin == 0)
567 goto next_entry; 564 goto next_entry;
568 565
@@ -586,14 +583,14 @@ static void pcnet_config(dev_link_t *link)
586 if (last_ret == CS_SUCCESS) break; 583 if (last_ret == CS_SUCCESS) break;
587 } 584 }
588 next_entry: 585 next_entry:
589 last_ret = pcmcia_get_next_tuple(handle, &tuple); 586 last_ret = pcmcia_get_next_tuple(link, &tuple);
590 } 587 }
591 if (last_ret != CS_SUCCESS) { 588 if (last_ret != CS_SUCCESS) {
592 cs_error(handle, RequestIO, last_ret); 589 cs_error(link, RequestIO, last_ret);
593 goto failed; 590 goto failed;
594 } 591 }
595 592
596 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 593 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
597 594
598 if (link->io.NumPorts2 == 8) { 595 if (link->io.NumPorts2 == 8) {
599 link->conf.Attributes |= CONF_ENABLE_SPKR; 596 link->conf.Attributes |= CONF_ENABLE_SPKR;
@@ -603,7 +600,7 @@ static void pcnet_config(dev_link_t *link)
603 (prodid == PRODID_IBM_HOME_AND_AWAY)) 600 (prodid == PRODID_IBM_HOME_AND_AWAY))
604 link->conf.ConfigIndex |= 0x10; 601 link->conf.ConfigIndex |= 0x10;
605 602
606 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 603 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
607 dev->irq = link->irq.AssignedIRQ; 604 dev->irq = link->irq.AssignedIRQ;
608 dev->base_addr = link->io.BasePort1; 605 dev->base_addr = link->io.BasePort1;
609 if (info->flags & HAS_MISC_REG) { 606 if (info->flags & HAS_MISC_REG) {
@@ -673,7 +670,7 @@ static void pcnet_config(dev_link_t *link)
673 670
674 link->dev_node = &info->node; 671 link->dev_node = &info->node;
675 link->state &= ~DEV_CONFIG_PENDING; 672 link->state &= ~DEV_CONFIG_PENDING;
676 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 673 SET_NETDEV_DEV(dev, &handle_to_dev(link));
677 674
678#ifdef CONFIG_NET_POLL_CONTROLLER 675#ifdef CONFIG_NET_POLL_CONTROLLER
679 dev->poll_controller = ei_poll; 676 dev->poll_controller = ei_poll;
@@ -707,7 +704,7 @@ static void pcnet_config(dev_link_t *link)
707 return; 704 return;
708 705
709cs_failed: 706cs_failed:
710 cs_error(link->handle, last_fn, last_ret); 707 cs_error(link, last_fn, last_ret);
711failed: 708failed:
712 pcnet_release(link); 709 pcnet_release(link);
713 link->state &= ~DEV_CONFIG_PENDING; 710 link->state &= ~DEV_CONFIG_PENDING;
@@ -722,7 +719,7 @@ failed:
722 719
723======================================================================*/ 720======================================================================*/
724 721
725static void pcnet_release(dev_link_t *link) 722static void pcnet_release(struct pcmcia_device *link)
726{ 723{
727 pcnet_dev_t *info = PRIV(link->priv); 724 pcnet_dev_t *info = PRIV(link->priv);
728 725
@@ -731,7 +728,7 @@ static void pcnet_release(dev_link_t *link)
731 if (info->flags & USE_SHMEM) 728 if (info->flags & USE_SHMEM)
732 iounmap(info->base); 729 iounmap(info->base);
733 730
734 pcmcia_disable_device(link->handle); 731 pcmcia_disable_device(link);
735} 732}
736 733
737/*====================================================================== 734/*======================================================================
@@ -743,9 +740,8 @@ static void pcnet_release(dev_link_t *link)
743 740
744======================================================================*/ 741======================================================================*/
745 742
746static int pcnet_suspend(struct pcmcia_device *p_dev) 743static int pcnet_suspend(struct pcmcia_device *link)
747{ 744{
748 dev_link_t *link = dev_to_instance(p_dev);
749 struct net_device *dev = link->priv; 745 struct net_device *dev = link->priv;
750 746
751 if ((link->state & DEV_CONFIG) && (link->open)) 747 if ((link->state & DEV_CONFIG) && (link->open))
@@ -754,9 +750,8 @@ static int pcnet_suspend(struct pcmcia_device *p_dev)
754 return 0; 750 return 0;
755} 751}
756 752
757static int pcnet_resume(struct pcmcia_device *p_dev) 753static int pcnet_resume(struct pcmcia_device *link)
758{ 754{
759 dev_link_t *link = dev_to_instance(p_dev);
760 struct net_device *dev = link->priv; 755 struct net_device *dev = link->priv;
761 756
762 if ((link->state & DEV_CONFIG) && (link->open)) { 757 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -1002,7 +997,7 @@ static void mii_phy_probe(struct net_device *dev)
1002static int pcnet_open(struct net_device *dev) 997static int pcnet_open(struct net_device *dev)
1003{ 998{
1004 pcnet_dev_t *info = PRIV(dev); 999 pcnet_dev_t *info = PRIV(dev);
1005 dev_link_t *link = info->p_dev; 1000 struct pcmcia_device *link = info->p_dev;
1006 1001
1007 DEBUG(2, "pcnet_open('%s')\n", dev->name); 1002 DEBUG(2, "pcnet_open('%s')\n", dev->name);
1008 1003
@@ -1030,7 +1025,7 @@ static int pcnet_open(struct net_device *dev)
1030static int pcnet_close(struct net_device *dev) 1025static int pcnet_close(struct net_device *dev)
1031{ 1026{
1032 pcnet_dev_t *info = PRIV(dev); 1027 pcnet_dev_t *info = PRIV(dev);
1033 dev_link_t *link = info->p_dev; 1028 struct pcmcia_device *link = info->p_dev;
1034 1029
1035 DEBUG(2, "pcnet_close('%s')\n", dev->name); 1030 DEBUG(2, "pcnet_close('%s')\n", dev->name);
1036 1031
@@ -1408,7 +1403,7 @@ static void dma_block_output(struct net_device *dev, int count,
1408 1403
1409/*====================================================================*/ 1404/*====================================================================*/
1410 1405
1411static int setup_dma_config(dev_link_t *link, int start_pg, 1406static int setup_dma_config(struct pcmcia_device *link, int start_pg,
1412 int stop_pg) 1407 int stop_pg)
1413{ 1408{
1414 struct net_device *dev = link->priv; 1409 struct net_device *dev = link->priv;
@@ -1511,7 +1506,7 @@ static void shmem_block_output(struct net_device *dev, int count,
1511 1506
1512/*====================================================================*/ 1507/*====================================================================*/
1513 1508
1514static int setup_shmem_window(dev_link_t *link, int start_pg, 1509static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1515 int stop_pg, int cm_offset) 1510 int stop_pg, int cm_offset)
1516{ 1511{
1517 struct net_device *dev = link->priv; 1512 struct net_device *dev = link->priv;
@@ -1533,7 +1528,7 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
1533 req.Attributes |= WIN_USE_WAIT; 1528 req.Attributes |= WIN_USE_WAIT;
1534 req.Base = 0; req.Size = window_size; 1529 req.Base = 0; req.Size = window_size;
1535 req.AccessSpeed = mem_speed; 1530 req.AccessSpeed = mem_speed;
1536 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 1531 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
1537 1532
1538 mem.CardOffset = (start_pg << 8) + cm_offset; 1533 mem.CardOffset = (start_pg << 8) + cm_offset;
1539 offset = mem.CardOffset % window_size; 1534 offset = mem.CardOffset % window_size;
@@ -1574,7 +1569,7 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
1574 return 0; 1569 return 0;
1575 1570
1576cs_failed: 1571cs_failed:
1577 cs_error(link->handle, last_fn, last_ret); 1572 cs_error(link, last_fn, last_ret);
1578failed: 1573failed:
1579 return 1; 1574 return 1;
1580} 1575}
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index a18b02a9a687..a4ee3057b831 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -279,8 +279,8 @@ enum RxCfg { RxAllMulti = 0x0004, RxPromisc = 0x0002,
279/*====================================================================*/ 279/*====================================================================*/
280 280
281static void smc91c92_detach(struct pcmcia_device *p_dev); 281static void smc91c92_detach(struct pcmcia_device *p_dev);
282static void smc91c92_config(dev_link_t *link); 282static void smc91c92_config(struct pcmcia_device *link);
283static void smc91c92_release(dev_link_t *link); 283static void smc91c92_release(struct pcmcia_device *link);
284 284
285static int smc_open(struct net_device *dev); 285static int smc_open(struct net_device *dev);
286static int smc_close(struct net_device *dev); 286static int smc_close(struct net_device *dev);
@@ -309,11 +309,10 @@ static struct ethtool_ops ethtool_ops;
309 309
310======================================================================*/ 310======================================================================*/
311 311
312static int smc91c92_attach(struct pcmcia_device *p_dev) 312static int smc91c92_attach(struct pcmcia_device *link)
313{ 313{
314 struct smc_private *smc; 314 struct smc_private *smc;
315 struct net_device *dev; 315 struct net_device *dev;
316 dev_link_t *link = dev_to_instance(p_dev);
317 316
318 DEBUG(0, "smc91c92_attach()\n"); 317 DEBUG(0, "smc91c92_attach()\n");
319 318
@@ -322,7 +321,7 @@ static int smc91c92_attach(struct pcmcia_device *p_dev)
322 if (!dev) 321 if (!dev)
323 return -ENOMEM; 322 return -ENOMEM;
324 smc = netdev_priv(dev); 323 smc = netdev_priv(dev);
325 smc->p_dev = p_dev; 324 smc->p_dev = link;
326 link->priv = dev; 325 link->priv = dev;
327 326
328 spin_lock_init(&smc->lock); 327 spin_lock_init(&smc->lock);
@@ -372,9 +371,8 @@ static int smc91c92_attach(struct pcmcia_device *p_dev)
372 371
373======================================================================*/ 372======================================================================*/
374 373
375static void smc91c92_detach(struct pcmcia_device *p_dev) 374static void smc91c92_detach(struct pcmcia_device *link)
376{ 375{
377 dev_link_t *link = dev_to_instance(p_dev);
378 struct net_device *dev = link->priv; 376 struct net_device *dev = link->priv;
379 377
380 DEBUG(0, "smc91c92_detach(0x%p)\n", link); 378 DEBUG(0, "smc91c92_detach(0x%p)\n", link);
@@ -411,7 +409,7 @@ static int cvt_ascii_address(struct net_device *dev, char *s)
411 409
412/*====================================================================*/ 410/*====================================================================*/
413 411
414static int first_tuple(client_handle_t handle, tuple_t *tuple, 412static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
415 cisparse_t *parse) 413 cisparse_t *parse)
416{ 414{
417 int i; 415 int i;
@@ -422,7 +420,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
422 return pcmcia_parse_tuple(handle, tuple, parse); 420 return pcmcia_parse_tuple(handle, tuple, parse);
423} 421}
424 422
425static int next_tuple(client_handle_t handle, tuple_t *tuple, 423static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
426 cisparse_t *parse) 424 cisparse_t *parse)
427{ 425{
428 int i; 426 int i;
@@ -444,7 +442,7 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
444 442
445======================================================================*/ 443======================================================================*/
446 444
447static int mhz_3288_power(dev_link_t *link) 445static int mhz_3288_power(struct pcmcia_device *link)
448{ 446{
449 struct net_device *dev = link->priv; 447 struct net_device *dev = link->priv;
450 struct smc_private *smc = netdev_priv(dev); 448 struct smc_private *smc = netdev_priv(dev);
@@ -466,7 +464,7 @@ static int mhz_3288_power(dev_link_t *link)
466 return 0; 464 return 0;
467} 465}
468 466
469static int mhz_mfc_config(dev_link_t *link) 467static int mhz_mfc_config(struct pcmcia_device *link)
470{ 468{
471 struct net_device *dev = link->priv; 469 struct net_device *dev = link->priv;
472 struct smc_private *smc = netdev_priv(dev); 470 struct smc_private *smc = netdev_priv(dev);
@@ -501,7 +499,7 @@ static int mhz_mfc_config(dev_link_t *link)
501 tuple->TupleDataMax = 255; 499 tuple->TupleDataMax = 255;
502 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; 500 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
503 501
504 i = first_tuple(link->handle, tuple, parse); 502 i = first_tuple(link, tuple, parse);
505 /* The Megahertz combo cards have modem-like CIS entries, so 503 /* The Megahertz combo cards have modem-like CIS entries, so
506 we have to explicitly try a bunch of port combinations. */ 504 we have to explicitly try a bunch of port combinations. */
507 while (i == CS_SUCCESS) { 505 while (i == CS_SUCCESS) {
@@ -510,11 +508,11 @@ static int mhz_mfc_config(dev_link_t *link)
510 for (k = 0; k < 0x400; k += 0x10) { 508 for (k = 0; k < 0x400; k += 0x10) {
511 if (k & 0x80) continue; 509 if (k & 0x80) continue;
512 link->io.BasePort1 = k ^ 0x300; 510 link->io.BasePort1 = k ^ 0x300;
513 i = pcmcia_request_io(link->handle, &link->io); 511 i = pcmcia_request_io(link, &link->io);
514 if (i == CS_SUCCESS) break; 512 if (i == CS_SUCCESS) break;
515 } 513 }
516 if (i == CS_SUCCESS) break; 514 if (i == CS_SUCCESS) break;
517 i = next_tuple(link->handle, tuple, parse); 515 i = next_tuple(link, tuple, parse);
518 } 516 }
519 if (i != CS_SUCCESS) 517 if (i != CS_SUCCESS)
520 goto free_cfg_mem; 518 goto free_cfg_mem;
@@ -524,7 +522,7 @@ static int mhz_mfc_config(dev_link_t *link)
524 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 522 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
525 req.Base = req.Size = 0; 523 req.Base = req.Size = 0;
526 req.AccessSpeed = 0; 524 req.AccessSpeed = 0;
527 i = pcmcia_request_window(&link->handle, &req, &link->win); 525 i = pcmcia_request_window(&link, &req, &link->win);
528 if (i != CS_SUCCESS) 526 if (i != CS_SUCCESS)
529 goto free_cfg_mem; 527 goto free_cfg_mem;
530 smc->base = ioremap(req.Base, req.Size); 528 smc->base = ioremap(req.Base, req.Size);
@@ -543,9 +541,8 @@ free_cfg_mem:
543 return i; 541 return i;
544} 542}
545 543
546static int mhz_setup(dev_link_t *link) 544static int mhz_setup(struct pcmcia_device *link)
547{ 545{
548 client_handle_t handle = link->handle;
549 struct net_device *dev = link->priv; 546 struct net_device *dev = link->priv;
550 struct smc_cfg_mem *cfg_mem; 547 struct smc_cfg_mem *cfg_mem;
551 tuple_t *tuple; 548 tuple_t *tuple;
@@ -568,13 +565,13 @@ static int mhz_setup(dev_link_t *link)
568 /* Read the station address from the CIS. It is stored as the last 565 /* Read the station address from the CIS. It is stored as the last
569 (fourth) string in the Version 1 Version/ID tuple. */ 566 (fourth) string in the Version 1 Version/ID tuple. */
570 tuple->DesiredTuple = CISTPL_VERS_1; 567 tuple->DesiredTuple = CISTPL_VERS_1;
571 if (first_tuple(handle, tuple, parse) != CS_SUCCESS) { 568 if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
572 rc = -1; 569 rc = -1;
573 goto free_cfg_mem; 570 goto free_cfg_mem;
574 } 571 }
575 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ 572 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
576 if (next_tuple(handle, tuple, parse) != CS_SUCCESS) 573 if (next_tuple(link, tuple, parse) != CS_SUCCESS)
577 first_tuple(handle, tuple, parse); 574 first_tuple(link, tuple, parse);
578 if (parse->version_1.ns > 3) { 575 if (parse->version_1.ns > 3) {
579 station_addr = parse->version_1.str + parse->version_1.ofs[3]; 576 station_addr = parse->version_1.str + parse->version_1.ofs[3];
580 if (cvt_ascii_address(dev, station_addr) == 0) { 577 if (cvt_ascii_address(dev, station_addr) == 0) {
@@ -585,11 +582,11 @@ static int mhz_setup(dev_link_t *link)
585 582
586 /* Another possibility: for the EM3288, in a special tuple */ 583 /* Another possibility: for the EM3288, in a special tuple */
587 tuple->DesiredTuple = 0x81; 584 tuple->DesiredTuple = 0x81;
588 if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) { 585 if (pcmcia_get_first_tuple(link, tuple) != CS_SUCCESS) {
589 rc = -1; 586 rc = -1;
590 goto free_cfg_mem; 587 goto free_cfg_mem;
591 } 588 }
592 if (pcmcia_get_tuple_data(handle, tuple) != CS_SUCCESS) { 589 if (pcmcia_get_tuple_data(link, tuple) != CS_SUCCESS) {
593 rc = -1; 590 rc = -1;
594 goto free_cfg_mem; 591 goto free_cfg_mem;
595 } 592 }
@@ -613,7 +610,7 @@ free_cfg_mem:
613 610
614======================================================================*/ 611======================================================================*/
615 612
616static void mot_config(dev_link_t *link) 613static void mot_config(struct pcmcia_device *link)
617{ 614{
618 struct net_device *dev = link->priv; 615 struct net_device *dev = link->priv;
619 struct smc_private *smc = netdev_priv(dev); 616 struct smc_private *smc = netdev_priv(dev);
@@ -634,7 +631,7 @@ static void mot_config(dev_link_t *link)
634 mdelay(100); 631 mdelay(100);
635} 632}
636 633
637static int mot_setup(dev_link_t *link) 634static int mot_setup(struct pcmcia_device *link)
638{ 635{
639 struct net_device *dev = link->priv; 636 struct net_device *dev = link->priv;
640 kio_addr_t ioaddr = dev->base_addr; 637 kio_addr_t ioaddr = dev->base_addr;
@@ -668,7 +665,7 @@ static int mot_setup(dev_link_t *link)
668 665
669/*====================================================================*/ 666/*====================================================================*/
670 667
671static int smc_config(dev_link_t *link) 668static int smc_config(struct pcmcia_device *link)
672{ 669{
673 struct net_device *dev = link->priv; 670 struct net_device *dev = link->priv;
674 struct smc_cfg_mem *cfg_mem; 671 struct smc_cfg_mem *cfg_mem;
@@ -693,16 +690,16 @@ static int smc_config(dev_link_t *link)
693 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; 690 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
694 691
695 link->io.NumPorts1 = 16; 692 link->io.NumPorts1 = 16;
696 i = first_tuple(link->handle, tuple, parse); 693 i = first_tuple(link, tuple, parse);
697 while (i != CS_NO_MORE_ITEMS) { 694 while (i != CS_NO_MORE_ITEMS) {
698 if (i == CS_SUCCESS) { 695 if (i == CS_SUCCESS) {
699 link->conf.ConfigIndex = cf->index; 696 link->conf.ConfigIndex = cf->index;
700 link->io.BasePort1 = cf->io.win[0].base; 697 link->io.BasePort1 = cf->io.win[0].base;
701 link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 698 link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
702 i = pcmcia_request_io(link->handle, &link->io); 699 i = pcmcia_request_io(link, &link->io);
703 if (i == CS_SUCCESS) break; 700 if (i == CS_SUCCESS) break;
704 } 701 }
705 i = next_tuple(link->handle, tuple, parse); 702 i = next_tuple(link, tuple, parse);
706 } 703 }
707 if (i == CS_SUCCESS) 704 if (i == CS_SUCCESS)
708 dev->base_addr = link->io.BasePort1; 705 dev->base_addr = link->io.BasePort1;
@@ -711,9 +708,8 @@ static int smc_config(dev_link_t *link)
711 return i; 708 return i;
712} 709}
713 710
714static int smc_setup(dev_link_t *link) 711static int smc_setup(struct pcmcia_device *link)
715{ 712{
716 client_handle_t handle = link->handle;
717 struct net_device *dev = link->priv; 713 struct net_device *dev = link->priv;
718 struct smc_cfg_mem *cfg_mem; 714 struct smc_cfg_mem *cfg_mem;
719 tuple_t *tuple; 715 tuple_t *tuple;
@@ -736,11 +732,11 @@ static int smc_setup(dev_link_t *link)
736 732
737 /* Check for a LAN function extension tuple */ 733 /* Check for a LAN function extension tuple */
738 tuple->DesiredTuple = CISTPL_FUNCE; 734 tuple->DesiredTuple = CISTPL_FUNCE;
739 i = first_tuple(handle, tuple, parse); 735 i = first_tuple(link, tuple, parse);
740 while (i == CS_SUCCESS) { 736 while (i == CS_SUCCESS) {
741 if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID) 737 if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID)
742 break; 738 break;
743 i = next_tuple(handle, tuple, parse); 739 i = next_tuple(link, tuple, parse);
744 } 740 }
745 if (i == CS_SUCCESS) { 741 if (i == CS_SUCCESS) {
746 node_id = (cistpl_lan_node_id_t *)parse->funce.data; 742 node_id = (cistpl_lan_node_id_t *)parse->funce.data;
@@ -753,7 +749,7 @@ static int smc_setup(dev_link_t *link)
753 } 749 }
754 /* Try the third string in the Version 1 Version/ID tuple. */ 750 /* Try the third string in the Version 1 Version/ID tuple. */
755 tuple->DesiredTuple = CISTPL_VERS_1; 751 tuple->DesiredTuple = CISTPL_VERS_1;
756 if (first_tuple(handle, tuple, parse) != CS_SUCCESS) { 752 if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
757 rc = -1; 753 rc = -1;
758 goto free_cfg_mem; 754 goto free_cfg_mem;
759 } 755 }
@@ -771,7 +767,7 @@ free_cfg_mem:
771 767
772/*====================================================================*/ 768/*====================================================================*/
773 769
774static int osi_config(dev_link_t *link) 770static int osi_config(struct pcmcia_device *link)
775{ 771{
776 struct net_device *dev = link->priv; 772 struct net_device *dev = link->priv;
777 static const kio_addr_t com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; 773 static const kio_addr_t com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
@@ -791,22 +787,21 @@ static int osi_config(dev_link_t *link)
791 787
792 for (i = j = 0; j < 4; j++) { 788 for (i = j = 0; j < 4; j++) {
793 link->io.BasePort2 = com[j]; 789 link->io.BasePort2 = com[j];
794 i = pcmcia_request_io(link->handle, &link->io); 790 i = pcmcia_request_io(link, &link->io);
795 if (i == CS_SUCCESS) break; 791 if (i == CS_SUCCESS) break;
796 } 792 }
797 if (i != CS_SUCCESS) { 793 if (i != CS_SUCCESS) {
798 /* Fallback: turn off hard decode */ 794 /* Fallback: turn off hard decode */
799 link->conf.ConfigIndex = 0x03; 795 link->conf.ConfigIndex = 0x03;
800 link->io.NumPorts2 = 0; 796 link->io.NumPorts2 = 0;
801 i = pcmcia_request_io(link->handle, &link->io); 797 i = pcmcia_request_io(link, &link->io);
802 } 798 }
803 dev->base_addr = link->io.BasePort1 + 0x10; 799 dev->base_addr = link->io.BasePort1 + 0x10;
804 return i; 800 return i;
805} 801}
806 802
807static int osi_setup(dev_link_t *link, u_short manfid, u_short cardid) 803static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid)
808{ 804{
809 client_handle_t handle = link->handle;
810 struct net_device *dev = link->priv; 805 struct net_device *dev = link->priv;
811 struct smc_cfg_mem *cfg_mem; 806 struct smc_cfg_mem *cfg_mem;
812 tuple_t *tuple; 807 tuple_t *tuple;
@@ -827,12 +822,12 @@ static int osi_setup(dev_link_t *link, u_short manfid, u_short cardid)
827 822
828 /* Read the station address from tuple 0x90, subtuple 0x04 */ 823 /* Read the station address from tuple 0x90, subtuple 0x04 */
829 tuple->DesiredTuple = 0x90; 824 tuple->DesiredTuple = 0x90;
830 i = pcmcia_get_first_tuple(handle, tuple); 825 i = pcmcia_get_first_tuple(link, tuple);
831 while (i == CS_SUCCESS) { 826 while (i == CS_SUCCESS) {
832 i = pcmcia_get_tuple_data(handle, tuple); 827 i = pcmcia_get_tuple_data(link, tuple);
833 if ((i != CS_SUCCESS) || (buf[0] == 0x04)) 828 if ((i != CS_SUCCESS) || (buf[0] == 0x04))
834 break; 829 break;
835 i = pcmcia_get_next_tuple(handle, tuple); 830 i = pcmcia_get_next_tuple(link, tuple);
836 } 831 }
837 if (i != CS_SUCCESS) { 832 if (i != CS_SUCCESS) {
838 rc = -1; 833 rc = -1;
@@ -865,9 +860,8 @@ free_cfg_mem:
865 return rc; 860 return rc;
866} 861}
867 862
868static int smc91c92_suspend(struct pcmcia_device *p_dev) 863static int smc91c92_suspend(struct pcmcia_device *link)
869{ 864{
870 dev_link_t *link = dev_to_instance(p_dev);
871 struct net_device *dev = link->priv; 865 struct net_device *dev = link->priv;
872 866
873 if ((link->state & DEV_CONFIG) && (link->open)) 867 if ((link->state & DEV_CONFIG) && (link->open))
@@ -876,9 +870,8 @@ static int smc91c92_suspend(struct pcmcia_device *p_dev)
876 return 0; 870 return 0;
877} 871}
878 872
879static int smc91c92_resume(struct pcmcia_device *p_dev) 873static int smc91c92_resume(struct pcmcia_device *link)
880{ 874{
881 dev_link_t *link = dev_to_instance(p_dev);
882 struct net_device *dev = link->priv; 875 struct net_device *dev = link->priv;
883 struct smc_private *smc = netdev_priv(dev); 876 struct smc_private *smc = netdev_priv(dev);
884 int i; 877 int i;
@@ -922,7 +915,7 @@ static int smc91c92_resume(struct pcmcia_device *p_dev)
922 915
923======================================================================*/ 916======================================================================*/
924 917
925static int check_sig(dev_link_t *link) 918static int check_sig(struct pcmcia_device *link)
926{ 919{
927 struct net_device *dev = link->priv; 920 struct net_device *dev = link->priv;
928 kio_addr_t ioaddr = dev->base_addr; 921 kio_addr_t ioaddr = dev->base_addr;
@@ -960,9 +953,9 @@ static int check_sig(dev_link_t *link)
960 }; 953 };
961 printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); 954 printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n");
962 955
963 smc91c92_suspend(link->handle); 956 smc91c92_suspend(link);
964 pcmcia_modify_configuration(link->handle, &mod); 957 pcmcia_modify_configuration(link, &mod);
965 smc91c92_resume(link->handle); 958 smc91c92_resume(link);
966 return check_sig(link); 959 return check_sig(link);
967 } 960 }
968 return -ENODEV; 961 return -ENODEV;
@@ -977,11 +970,10 @@ static int check_sig(dev_link_t *link)
977======================================================================*/ 970======================================================================*/
978 971
979#define CS_EXIT_TEST(ret, svc, label) \ 972#define CS_EXIT_TEST(ret, svc, label) \
980if (ret != CS_SUCCESS) { cs_error(link->handle, svc, ret); goto label; } 973if (ret != CS_SUCCESS) { cs_error(link, svc, ret); goto label; }
981 974
982static void smc91c92_config(dev_link_t *link) 975static void smc91c92_config(struct pcmcia_device *link)
983{ 976{
984 client_handle_t handle = link->handle;
985 struct net_device *dev = link->priv; 977 struct net_device *dev = link->priv;
986 struct smc_private *smc = netdev_priv(dev); 978 struct smc_private *smc = netdev_priv(dev);
987 struct smc_cfg_mem *cfg_mem; 979 struct smc_cfg_mem *cfg_mem;
@@ -1008,14 +1000,14 @@ static void smc91c92_config(dev_link_t *link)
1008 tuple->TupleDataMax = 64; 1000 tuple->TupleDataMax = 64;
1009 1001
1010 tuple->DesiredTuple = CISTPL_CONFIG; 1002 tuple->DesiredTuple = CISTPL_CONFIG;
1011 i = first_tuple(handle, tuple, parse); 1003 i = first_tuple(link, tuple, parse);
1012 CS_EXIT_TEST(i, ParseTuple, config_failed); 1004 CS_EXIT_TEST(i, ParseTuple, config_failed);
1013 link->conf.ConfigBase = parse->config.base; 1005 link->conf.ConfigBase = parse->config.base;
1014 link->conf.Present = parse->config.rmask[0]; 1006 link->conf.Present = parse->config.rmask[0];
1015 1007
1016 tuple->DesiredTuple = CISTPL_MANFID; 1008 tuple->DesiredTuple = CISTPL_MANFID;
1017 tuple->Attributes = TUPLE_RETURN_COMMON; 1009 tuple->Attributes = TUPLE_RETURN_COMMON;
1018 if (first_tuple(handle, tuple, parse) == CS_SUCCESS) { 1010 if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
1019 smc->manfid = parse->manfid.manf; 1011 smc->manfid = parse->manfid.manf;
1020 smc->cardid = parse->manfid.card; 1012 smc->cardid = parse->manfid.card;
1021 } 1013 }
@@ -1036,9 +1028,9 @@ static void smc91c92_config(dev_link_t *link)
1036 } 1028 }
1037 CS_EXIT_TEST(i, RequestIO, config_failed); 1029 CS_EXIT_TEST(i, RequestIO, config_failed);
1038 1030
1039 i = pcmcia_request_irq(link->handle, &link->irq); 1031 i = pcmcia_request_irq(link, &link->irq);
1040 CS_EXIT_TEST(i, RequestIRQ, config_failed); 1032 CS_EXIT_TEST(i, RequestIRQ, config_failed);
1041 i = pcmcia_request_configuration(link->handle, &link->conf); 1033 i = pcmcia_request_configuration(link, &link->conf);
1042 CS_EXIT_TEST(i, RequestConfiguration, config_failed); 1034 CS_EXIT_TEST(i, RequestConfiguration, config_failed);
1043 1035
1044 if (smc->manfid == MANFID_MOTOROLA) 1036 if (smc->manfid == MANFID_MOTOROLA)
@@ -1119,7 +1111,7 @@ static void smc91c92_config(dev_link_t *link)
1119 1111
1120 link->dev_node = &smc->node; 1112 link->dev_node = &smc->node;
1121 link->state &= ~DEV_CONFIG_PENDING; 1113 link->state &= ~DEV_CONFIG_PENDING;
1122 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 1114 SET_NETDEV_DEV(dev, &handle_to_dev(link));
1123 1115
1124 if (register_netdev(dev) != 0) { 1116 if (register_netdev(dev) != 0) {
1125 printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); 1117 printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n");
@@ -1172,7 +1164,7 @@ config_failed: /* CS_EXIT_TEST() calls jump to here... */
1172 1164
1173======================================================================*/ 1165======================================================================*/
1174 1166
1175static void smc91c92_release(dev_link_t *link) 1167static void smc91c92_release(struct pcmcia_device *link)
1176{ 1168{
1177 DEBUG(0, "smc91c92_release(0x%p)\n", link); 1169 DEBUG(0, "smc91c92_release(0x%p)\n", link);
1178 if (link->win) { 1170 if (link->win) {
@@ -1180,7 +1172,7 @@ static void smc91c92_release(dev_link_t *link)
1180 struct smc_private *smc = netdev_priv(dev); 1172 struct smc_private *smc = netdev_priv(dev);
1181 iounmap(smc->base); 1173 iounmap(smc->base);
1182 } 1174 }
1183 pcmcia_disable_device(link->handle); 1175 pcmcia_disable_device(link);
1184} 1176}
1185 1177
1186/*====================================================================== 1178/*======================================================================
@@ -1269,7 +1261,7 @@ static void smc_dump(struct net_device *dev)
1269static int smc_open(struct net_device *dev) 1261static int smc_open(struct net_device *dev)
1270{ 1262{
1271 struct smc_private *smc = netdev_priv(dev); 1263 struct smc_private *smc = netdev_priv(dev);
1272 dev_link_t *link = smc->p_dev; 1264 struct pcmcia_device *link = smc->p_dev;
1273 1265
1274#ifdef PCMCIA_DEBUG 1266#ifdef PCMCIA_DEBUG
1275 DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n", 1267 DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n",
@@ -1306,7 +1298,7 @@ static int smc_open(struct net_device *dev)
1306static int smc_close(struct net_device *dev) 1298static int smc_close(struct net_device *dev)
1307{ 1299{
1308 struct smc_private *smc = netdev_priv(dev); 1300 struct smc_private *smc = netdev_priv(dev);
1309 dev_link_t *link = smc->p_dev; 1301 struct pcmcia_device *link = smc->p_dev;
1310 kio_addr_t ioaddr = dev->base_addr; 1302 kio_addr_t ioaddr = dev->base_addr;
1311 1303
1312 DEBUG(0, "%s: smc_close(), status %4.4x.\n", 1304 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 94a1e644abdc..84328da075c3 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -289,9 +289,9 @@ static void mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg,
289 * and ejection events. They are invoked from the event handler. 289 * and ejection events. They are invoked from the event handler.
290 */ 290 */
291 291
292static int has_ce2_string(dev_link_t * link); 292static int has_ce2_string(struct pcmcia_device * link);
293static void xirc2ps_config(dev_link_t * link); 293static void xirc2ps_config(struct pcmcia_device * link);
294static void xirc2ps_release(dev_link_t * link); 294static void xirc2ps_release(struct pcmcia_device * link);
295 295
296/**************** 296/****************
297 * The attach() and detach() entry points are used to create and destroy 297 * The attach() and detach() entry points are used to create and destroy
@@ -313,10 +313,10 @@ static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs
313/**************** 313/****************
314 * A linked list of "instances" of the device. Each actual 314 * A linked list of "instances" of the device. Each actual
315 * PCMCIA card corresponds to one device instance, and is described 315 * PCMCIA card corresponds to one device instance, and is described
316 * by one dev_link_t structure (defined in ds.h). 316 * by one struct pcmcia_device structure (defined in ds.h).
317 * 317 *
318 * You may not want to use a linked list for this -- for example, the 318 * You may not want to use a linked list for this -- for example, the
319 * memory card driver uses an array of dev_link_t pointers, where minor 319 * memory card driver uses an array of struct pcmcia_device pointers, where minor
320 * device numbers are used to derive the corresponding array index. 320 * device numbers are used to derive the corresponding array index.
321 */ 321 */
322 322
@@ -326,7 +326,7 @@ static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs
326 * example, ethernet cards, modems). In other cases, there may be 326 * example, ethernet cards, modems). In other cases, there may be
327 * many actual or logical devices (SCSI adapters, memory cards with 327 * many actual or logical devices (SCSI adapters, memory cards with
328 * multiple partitions). The dev_node_t structures need to be kept 328 * multiple partitions). The dev_node_t structures need to be kept
329 * in a linked list starting at the 'dev' field of a dev_link_t 329 * in a linked list starting at the 'dev' field of a struct pcmcia_device
330 * structure. We allocate them in the card's private data structure, 330 * structure. We allocate them in the card's private data structure,
331 * because they generally can't be allocated dynamically. 331 * because they generally can't be allocated dynamically.
332 */ 332 */
@@ -355,7 +355,7 @@ static void do_tx_timeout(struct net_device *dev);
355static struct net_device_stats *do_get_stats(struct net_device *dev); 355static struct net_device_stats *do_get_stats(struct net_device *dev);
356static void set_addresses(struct net_device *dev); 356static void set_addresses(struct net_device *dev);
357static void set_multicast_list(struct net_device *dev); 357static void set_multicast_list(struct net_device *dev);
358static int set_card_type(dev_link_t *link, const void *s); 358static int set_card_type(struct pcmcia_device *link, const void *s);
359static int do_config(struct net_device *dev, struct ifmap *map); 359static int do_config(struct net_device *dev, struct ifmap *map);
360static int do_open(struct net_device *dev); 360static int do_open(struct net_device *dev);
361static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 361static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -368,7 +368,7 @@ static int do_stop(struct net_device *dev);
368 368
369/*=============== Helper functions =========================*/ 369/*=============== Helper functions =========================*/
370static int 370static int
371first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) 371first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
372{ 372{
373 int err; 373 int err;
374 374
@@ -379,7 +379,7 @@ first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
379} 379}
380 380
381static int 381static int
382next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) 382next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
383{ 383{
384 int err; 384 int err;
385 385
@@ -553,11 +553,10 @@ mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg, unsigned data, int len)
553 */ 553 */
554 554
555static int 555static int
556xirc2ps_attach(struct pcmcia_device *p_dev) 556xirc2ps_attach(struct pcmcia_device *link)
557{ 557{
558 struct net_device *dev; 558 struct net_device *dev;
559 local_info_t *local; 559 local_info_t *local;
560 dev_link_t *link = dev_to_instance(p_dev);
561 560
562 DEBUG(0, "attach()\n"); 561 DEBUG(0, "attach()\n");
563 562
@@ -566,7 +565,7 @@ xirc2ps_attach(struct pcmcia_device *p_dev)
566 if (!dev) 565 if (!dev)
567 return -ENOMEM; 566 return -ENOMEM;
568 local = netdev_priv(dev); 567 local = netdev_priv(dev);
569 local->p_dev = p_dev; 568 local->p_dev = link;
570 link->priv = dev; 569 link->priv = dev;
571 570
572 /* General socket configuration */ 571 /* General socket configuration */
@@ -606,9 +605,8 @@ xirc2ps_attach(struct pcmcia_device *p_dev)
606 */ 605 */
607 606
608static void 607static void
609xirc2ps_detach(struct pcmcia_device *p_dev) 608xirc2ps_detach(struct pcmcia_device *link)
610{ 609{
611 dev_link_t *link = dev_to_instance(p_dev);
612 struct net_device *dev = link->priv; 610 struct net_device *dev = link->priv;
613 611
614 DEBUG(0, "detach(0x%p)\n", link); 612 DEBUG(0, "detach(0x%p)\n", link);
@@ -641,7 +639,7 @@ xirc2ps_detach(struct pcmcia_device *p_dev)
641 * 639 *
642 */ 640 */
643static int 641static int
644set_card_type(dev_link_t *link, const void *s) 642set_card_type(struct pcmcia_device *link, const void *s)
645{ 643{
646 struct net_device *dev = link->priv; 644 struct net_device *dev = link->priv;
647 local_info_t *local = netdev_priv(dev); 645 local_info_t *local = netdev_priv(dev);
@@ -710,9 +708,8 @@ set_card_type(dev_link_t *link, const void *s)
710 * Returns: true if this is a CE2 708 * Returns: true if this is a CE2
711 */ 709 */
712static int 710static int
713has_ce2_string(dev_link_t * link) 711has_ce2_string(struct pcmcia_device * link)
714{ 712{
715 client_handle_t handle = link->handle;
716 tuple_t tuple; 713 tuple_t tuple;
717 cisparse_t parse; 714 cisparse_t parse;
718 u_char buf[256]; 715 u_char buf[256];
@@ -722,7 +719,7 @@ has_ce2_string(dev_link_t * link)
722 tuple.TupleDataMax = 254; 719 tuple.TupleDataMax = 254;
723 tuple.TupleOffset = 0; 720 tuple.TupleOffset = 0;
724 tuple.DesiredTuple = CISTPL_VERS_1; 721 tuple.DesiredTuple = CISTPL_VERS_1;
725 if (!first_tuple(handle, &tuple, &parse) && parse.version_1.ns > 2) { 722 if (!first_tuple(link, &tuple, &parse) && parse.version_1.ns > 2) {
726 if (strstr(parse.version_1.str + parse.version_1.ofs[2], "CE2")) 723 if (strstr(parse.version_1.str + parse.version_1.ofs[2], "CE2"))
727 return 1; 724 return 1;
728 } 725 }
@@ -735,9 +732,8 @@ has_ce2_string(dev_link_t * link)
735 * ethernet device available to the system. 732 * ethernet device available to the system.
736 */ 733 */
737static void 734static void
738xirc2ps_config(dev_link_t * link) 735xirc2ps_config(struct pcmcia_device * link)
739{ 736{
740 client_handle_t handle = link->handle;
741 struct net_device *dev = link->priv; 737 struct net_device *dev = link->priv;
742 local_info_t *local = netdev_priv(dev); 738 local_info_t *local = netdev_priv(dev);
743 tuple_t tuple; 739 tuple_t tuple;
@@ -763,7 +759,7 @@ xirc2ps_config(dev_link_t * link)
763 759
764 /* Is this a valid card */ 760 /* Is this a valid card */
765 tuple.DesiredTuple = CISTPL_MANFID; 761 tuple.DesiredTuple = CISTPL_MANFID;
766 if ((err=first_tuple(handle, &tuple, &parse))) { 762 if ((err=first_tuple(link, &tuple, &parse))) {
767 printk(KNOT_XIRC "manfid not found in CIS\n"); 763 printk(KNOT_XIRC "manfid not found in CIS\n");
768 goto failure; 764 goto failure;
769 } 765 }
@@ -799,15 +795,15 @@ xirc2ps_config(dev_link_t * link)
799 795
800 /* get configuration stuff */ 796 /* get configuration stuff */
801 tuple.DesiredTuple = CISTPL_CONFIG; 797 tuple.DesiredTuple = CISTPL_CONFIG;
802 if ((err=first_tuple(handle, &tuple, &parse))) 798 if ((err=first_tuple(link, &tuple, &parse)))
803 goto cis_error; 799 goto cis_error;
804 link->conf.ConfigBase = parse.config.base; 800 link->conf.ConfigBase = parse.config.base;
805 link->conf.Present = parse.config.rmask[0]; 801 link->conf.Present = parse.config.rmask[0];
806 802
807 /* get the ethernet address from the CIS */ 803 /* get the ethernet address from the CIS */
808 tuple.DesiredTuple = CISTPL_FUNCE; 804 tuple.DesiredTuple = CISTPL_FUNCE;
809 for (err = first_tuple(handle, &tuple, &parse); !err; 805 for (err = first_tuple(link, &tuple, &parse); !err;
810 err = next_tuple(handle, &tuple, &parse)) { 806 err = next_tuple(link, &tuple, &parse)) {
811 /* Once I saw two CISTPL_FUNCE_LAN_NODE_ID entries: 807 /* Once I saw two CISTPL_FUNCE_LAN_NODE_ID entries:
812 * the first one with a length of zero the second correct - 808 * the first one with a length of zero the second correct -
813 * so I skip all entries with length 0 */ 809 * so I skip all entries with length 0 */
@@ -817,8 +813,8 @@ xirc2ps_config(dev_link_t * link)
817 } 813 }
818 if (err) { /* not found: try to get the node-id from tuple 0x89 */ 814 if (err) { /* not found: try to get the node-id from tuple 0x89 */
819 tuple.DesiredTuple = 0x89; /* data layout looks like tuple 0x22 */ 815 tuple.DesiredTuple = 0x89; /* data layout looks like tuple 0x22 */
820 if ((err = pcmcia_get_first_tuple(handle, &tuple)) == 0 && 816 if ((err = pcmcia_get_first_tuple(link, &tuple)) == 0 &&
821 (err = pcmcia_get_tuple_data(handle, &tuple)) == 0) { 817 (err = pcmcia_get_tuple_data(link, &tuple)) == 0) {
822 if (tuple.TupleDataLen == 8 && *buf == CISTPL_FUNCE_LAN_NODE_ID) 818 if (tuple.TupleDataLen == 8 && *buf == CISTPL_FUNCE_LAN_NODE_ID)
823 memcpy(&parse, buf, 8); 819 memcpy(&parse, buf, 8);
824 else 820 else
@@ -827,8 +823,8 @@ xirc2ps_config(dev_link_t * link)
827 } 823 }
828 if (err) { /* another try (James Lehmer's CE2 version 4.1)*/ 824 if (err) { /* another try (James Lehmer's CE2 version 4.1)*/
829 tuple.DesiredTuple = CISTPL_FUNCE; 825 tuple.DesiredTuple = CISTPL_FUNCE;
830 for (err = first_tuple(handle, &tuple, &parse); !err; 826 for (err = first_tuple(link, &tuple, &parse); !err;
831 err = next_tuple(handle, &tuple, &parse)) { 827 err = next_tuple(link, &tuple, &parse)) {
832 if (parse.funce.type == 0x02 && parse.funce.data[0] == 1 828 if (parse.funce.type == 0x02 && parse.funce.data[0] == 1
833 && parse.funce.data[1] == 6 && tuple.TupleDataLen == 13) { 829 && parse.funce.data[1] == 6 && tuple.TupleDataLen == 13) {
834 buf[1] = 4; 830 buf[1] = 4;
@@ -871,14 +867,14 @@ xirc2ps_config(dev_link_t * link)
871 * Ethernet port */ 867 * Ethernet port */
872 link->io.NumPorts1 = 16; /* no Mako stuff anymore */ 868 link->io.NumPorts1 = 16; /* no Mako stuff anymore */
873 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 869 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
874 for (err = first_tuple(handle, &tuple, &parse); !err; 870 for (err = first_tuple(link, &tuple, &parse); !err;
875 err = next_tuple(handle, &tuple, &parse)) { 871 err = next_tuple(link, &tuple, &parse)) {
876 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 872 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
877 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 873 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
878 link->conf.ConfigIndex = cf->index ; 874 link->conf.ConfigIndex = cf->index ;
879 link->io.BasePort2 = cf->io.win[0].base; 875 link->io.BasePort2 = cf->io.win[0].base;
880 link->io.BasePort1 = ioaddr; 876 link->io.BasePort1 = ioaddr;
881 if (!(err=pcmcia_request_io(link->handle, &link->io))) 877 if (!(err=pcmcia_request_io(link, &link->io)))
882 goto port_found; 878 goto port_found;
883 } 879 }
884 } 880 }
@@ -892,15 +888,15 @@ xirc2ps_config(dev_link_t * link)
892 */ 888 */
893 for (pass=0; pass < 2; pass++) { 889 for (pass=0; pass < 2; pass++) {
894 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 890 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
895 for (err = first_tuple(handle, &tuple, &parse); !err; 891 for (err = first_tuple(link, &tuple, &parse); !err;
896 err = next_tuple(handle, &tuple, &parse)){ 892 err = next_tuple(link, &tuple, &parse)){
897 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8){ 893 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8){
898 link->conf.ConfigIndex = cf->index ; 894 link->conf.ConfigIndex = cf->index ;
899 link->io.BasePort2 = cf->io.win[0].base; 895 link->io.BasePort2 = cf->io.win[0].base;
900 link->io.BasePort1 = link->io.BasePort2 896 link->io.BasePort1 = link->io.BasePort2
901 + (pass ? (cf->index & 0x20 ? -24:8) 897 + (pass ? (cf->index & 0x20 ? -24:8)
902 : (cf->index & 0x20 ? 8:-24)); 898 : (cf->index & 0x20 ? 8:-24));
903 if (!(err=pcmcia_request_io(link->handle, &link->io))) 899 if (!(err=pcmcia_request_io(link, &link->io)))
904 goto port_found; 900 goto port_found;
905 } 901 }
906 } 902 }
@@ -915,12 +911,12 @@ xirc2ps_config(dev_link_t * link)
915 link->io.NumPorts1 = 16; 911 link->io.NumPorts1 = 16;
916 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 912 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
917 link->io.BasePort1 = ioaddr; 913 link->io.BasePort1 = ioaddr;
918 if (!(err=pcmcia_request_io(link->handle, &link->io))) 914 if (!(err=pcmcia_request_io(link, &link->io)))
919 goto port_found; 915 goto port_found;
920 } 916 }
921 link->io.BasePort1 = 0; /* let CS decide */ 917 link->io.BasePort1 = 0; /* let CS decide */
922 if ((err=pcmcia_request_io(link->handle, &link->io))) { 918 if ((err=pcmcia_request_io(link, &link->io))) {
923 cs_error(link->handle, RequestIO, err); 919 cs_error(link, RequestIO, err);
924 goto config_error; 920 goto config_error;
925 } 921 }
926 } 922 }
@@ -932,8 +928,8 @@ xirc2ps_config(dev_link_t * link)
932 * Now allocate an interrupt line. Note that this does not 928 * Now allocate an interrupt line. Note that this does not
933 * actually assign a handler to the interrupt. 929 * actually assign a handler to the interrupt.
934 */ 930 */
935 if ((err=pcmcia_request_irq(link->handle, &link->irq))) { 931 if ((err=pcmcia_request_irq(link, &link->irq))) {
936 cs_error(link->handle, RequestIRQ, err); 932 cs_error(link, RequestIRQ, err);
937 goto config_error; 933 goto config_error;
938 } 934 }
939 935
@@ -941,8 +937,8 @@ xirc2ps_config(dev_link_t * link)
941 * This actually configures the PCMCIA socket -- setting up 937 * This actually configures the PCMCIA socket -- setting up
942 * the I/O windows and the interrupt mapping. 938 * the I/O windows and the interrupt mapping.
943 */ 939 */
944 if ((err=pcmcia_request_configuration(link->handle, &link->conf))) { 940 if ((err=pcmcia_request_configuration(link, &link->conf))) {
945 cs_error(link->handle, RequestConfiguration, err); 941 cs_error(link, RequestConfiguration, err);
946 goto config_error; 942 goto config_error;
947 } 943 }
948 944
@@ -959,15 +955,15 @@ xirc2ps_config(dev_link_t * link)
959 reg.Action = CS_WRITE; 955 reg.Action = CS_WRITE;
960 reg.Offset = CISREG_IOBASE_0; 956 reg.Offset = CISREG_IOBASE_0;
961 reg.Value = link->io.BasePort2 & 0xff; 957 reg.Value = link->io.BasePort2 & 0xff;
962 if ((err = pcmcia_access_configuration_register(link->handle, &reg))) { 958 if ((err = pcmcia_access_configuration_register(link, &reg))) {
963 cs_error(link->handle, AccessConfigurationRegister, err); 959 cs_error(link, AccessConfigurationRegister, err);
964 goto config_error; 960 goto config_error;
965 } 961 }
966 reg.Action = CS_WRITE; 962 reg.Action = CS_WRITE;
967 reg.Offset = CISREG_IOBASE_1; 963 reg.Offset = CISREG_IOBASE_1;
968 reg.Value = (link->io.BasePort2 >> 8) & 0xff; 964 reg.Value = (link->io.BasePort2 >> 8) & 0xff;
969 if ((err = pcmcia_access_configuration_register(link->handle, &reg))) { 965 if ((err = pcmcia_access_configuration_register(link, &reg))) {
970 cs_error(link->handle, AccessConfigurationRegister, err); 966 cs_error(link, AccessConfigurationRegister, err);
971 goto config_error; 967 goto config_error;
972 } 968 }
973 969
@@ -978,15 +974,15 @@ xirc2ps_config(dev_link_t * link)
978 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 974 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
979 req.Base = req.Size = 0; 975 req.Base = req.Size = 0;
980 req.AccessSpeed = 0; 976 req.AccessSpeed = 0;
981 if ((err = pcmcia_request_window(&link->handle, &req, &link->win))) { 977 if ((err = pcmcia_request_window(&link, &req, &link->win))) {
982 cs_error(link->handle, RequestWindow, err); 978 cs_error(link, RequestWindow, err);
983 goto config_error; 979 goto config_error;
984 } 980 }
985 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 981 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800;
986 mem.CardOffset = 0x0; 982 mem.CardOffset = 0x0;
987 mem.Page = 0; 983 mem.Page = 0;
988 if ((err = pcmcia_map_mem_page(link->win, &mem))) { 984 if ((err = pcmcia_map_mem_page(link->win, &mem))) {
989 cs_error(link->handle, MapMemPage, err); 985 cs_error(link, MapMemPage, err);
990 goto config_error; 986 goto config_error;
991 } 987 }
992 988
@@ -1048,7 +1044,7 @@ xirc2ps_config(dev_link_t * link)
1048 1044
1049 link->dev_node = &local->node; 1045 link->dev_node = &local->node;
1050 link->state &= ~DEV_CONFIG_PENDING; 1046 link->state &= ~DEV_CONFIG_PENDING;
1051 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 1047 SET_NETDEV_DEV(dev, &handle_to_dev(link));
1052 1048
1053 if ((err=register_netdev(dev))) { 1049 if ((err=register_netdev(dev))) {
1054 printk(KNOT_XIRC "register_netdev() failed\n"); 1050 printk(KNOT_XIRC "register_netdev() failed\n");
@@ -1084,7 +1080,7 @@ xirc2ps_config(dev_link_t * link)
1084 * still open, this will be postponed until it is closed. 1080 * still open, this will be postponed until it is closed.
1085 */ 1081 */
1086static void 1082static void
1087xirc2ps_release(dev_link_t *link) 1083xirc2ps_release(struct pcmcia_device *link)
1088{ 1084{
1089 DEBUG(0, "release(0x%p)\n", link); 1085 DEBUG(0, "release(0x%p)\n", link);
1090 1086
@@ -1094,15 +1090,14 @@ xirc2ps_release(dev_link_t *link)
1094 if (local->dingo) 1090 if (local->dingo)
1095 iounmap(local->dingo_ccr - 0x0800); 1091 iounmap(local->dingo_ccr - 0x0800);
1096 } 1092 }
1097 pcmcia_disable_device(link->handle); 1093 pcmcia_disable_device(link);
1098} /* xirc2ps_release */ 1094} /* xirc2ps_release */
1099 1095
1100/*====================================================================*/ 1096/*====================================================================*/
1101 1097
1102 1098
1103static int xirc2ps_suspend(struct pcmcia_device *p_dev) 1099static int xirc2ps_suspend(struct pcmcia_device *link)
1104{ 1100{
1105 dev_link_t *link = dev_to_instance(p_dev);
1106 struct net_device *dev = link->priv; 1101 struct net_device *dev = link->priv;
1107 1102
1108 if ((link->state & DEV_CONFIG) && (link->open)) { 1103 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -1113,9 +1108,8 @@ static int xirc2ps_suspend(struct pcmcia_device *p_dev)
1113 return 0; 1108 return 0;
1114} 1109}
1115 1110
1116static int xirc2ps_resume(struct pcmcia_device *p_dev) 1111static int xirc2ps_resume(struct pcmcia_device *link)
1117{ 1112{
1118 dev_link_t *link = dev_to_instance(p_dev);
1119 struct net_device *dev = link->priv; 1113 struct net_device *dev = link->priv;
1120 1114
1121 if ((link->state & DEV_CONFIG) && (link->open)) { 1115 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -1534,7 +1528,7 @@ static int
1534do_open(struct net_device *dev) 1528do_open(struct net_device *dev)
1535{ 1529{
1536 local_info_t *lp = netdev_priv(dev); 1530 local_info_t *lp = netdev_priv(dev);
1537 dev_link_t *link = lp->p_dev; 1531 struct pcmcia_device *link = lp->p_dev;
1538 1532
1539 DEBUG(0, "do_open(%p)\n", dev); 1533 DEBUG(0, "do_open(%p)\n", dev);
1540 1534
@@ -1864,7 +1858,7 @@ do_stop(struct net_device *dev)
1864{ 1858{
1865 kio_addr_t ioaddr = dev->base_addr; 1859 kio_addr_t ioaddr = dev->base_addr;
1866 local_info_t *lp = netdev_priv(dev); 1860 local_info_t *lp = netdev_priv(dev);
1867 dev_link_t *link = lp->p_dev; 1861 struct pcmcia_device *link = lp->p_dev;
1868 1862
1869 DEBUG(0, "do_stop(%p)\n", dev); 1863 DEBUG(0, "do_stop(%p)\n", dev);
1870 1864