aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-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
-rw-r--r--drivers/net/wireless/airo_cs.c58
-rw-r--r--drivers/net/wireless/atmel_cs.c56
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c82
-rw-r--r--drivers/net/wireless/netwave_cs.c61
-rw-r--r--drivers/net/wireless/orinoco_cs.c59
-rw-r--r--drivers/net/wireless/ray_cs.c92
-rw-r--r--drivers/net/wireless/ray_cs.h2
-rw-r--r--drivers/net/wireless/spectrum_cs.c80
-rw-r--r--drivers/net/wireless/wavelan_cs.c67
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h6
-rw-r--r--drivers/net/wireless/wl3501_cs.c67
21 files changed, 634 insertions, 734 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
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 836c71ff7762..76970197f98f 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -80,8 +80,8 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
80 event handler. 80 event handler.
81*/ 81*/
82 82
83static void airo_config(dev_link_t *link); 83static void airo_config(struct pcmcia_device *link);
84static void airo_release(dev_link_t *link); 84static void airo_release(struct pcmcia_device *link);
85 85
86/* 86/*
87 The attach() and detach() entry points are used to create and destroy 87 The attach() and detach() entry points are used to create and destroy
@@ -101,10 +101,10 @@ static void airo_detach(struct pcmcia_device *p_dev);
101/* 101/*
102 A linked list of "instances" of the aironet device. Each actual 102 A linked list of "instances" of the aironet device. Each actual
103 PCMCIA card corresponds to one device instance, and is described 103 PCMCIA card corresponds to one device instance, and is described
104 by one dev_link_t structure (defined in ds.h). 104 by one struct pcmcia_device structure (defined in ds.h).
105 105
106 You may not want to use a linked list for this -- for example, the 106 You may not want to use a linked list for this -- for example, the
107 memory card driver uses an array of dev_link_t pointers, where minor 107 memory card driver uses an array of struct pcmcia_device pointers, where minor
108 device numbers are used to derive the corresponding array index. 108 device numbers are used to derive the corresponding array index.
109*/ 109*/
110 110
@@ -114,7 +114,7 @@ static void airo_detach(struct pcmcia_device *p_dev);
114 example, ethernet cards, modems). In other cases, there may be 114 example, ethernet cards, modems). In other cases, there may be
115 many actual or logical devices (SCSI adapters, memory cards with 115 many actual or logical devices (SCSI adapters, memory cards with
116 multiple partitions). The dev_node_t structures need to be kept 116 multiple partitions). The dev_node_t structures need to be kept
117 in a linked list starting at the 'dev' field of a dev_link_t 117 in a linked list starting at the 'dev' field of a struct pcmcia_device
118 structure. We allocate them in the card's private data structure, 118 structure. We allocate them in the card's private data structure,
119 because they generally shouldn't be allocated dynamically. 119 because they generally shouldn't be allocated dynamically.
120 120
@@ -185,10 +185,8 @@ static int airo_attach(struct pcmcia_device *p_dev)
185 185
186 ======================================================================*/ 186 ======================================================================*/
187 187
188static void airo_detach(struct pcmcia_device *p_dev) 188static void airo_detach(struct pcmcia_device *link)
189{ 189{
190 dev_link_t *link = dev_to_instance(p_dev);
191
192 DEBUG(0, "airo_detach(0x%p)\n", link); 190 DEBUG(0, "airo_detach(0x%p)\n", link);
193 191
194 if (link->state & DEV_CONFIG) 192 if (link->state & DEV_CONFIG)
@@ -213,9 +211,8 @@ static void airo_detach(struct pcmcia_device *p_dev)
213#define CS_CHECK(fn, ret) \ 211#define CS_CHECK(fn, ret) \
214do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 212do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
215 213
216static void airo_config(dev_link_t *link) 214static void airo_config(struct pcmcia_device *link)
217{ 215{
218 client_handle_t handle;
219 tuple_t tuple; 216 tuple_t tuple;
220 cisparse_t parse; 217 cisparse_t parse;
221 local_info_t *dev; 218 local_info_t *dev;
@@ -223,8 +220,7 @@ static void airo_config(dev_link_t *link)
223 u_char buf[64]; 220 u_char buf[64];
224 win_req_t req; 221 win_req_t req;
225 memreq_t map; 222 memreq_t map;
226 223
227 handle = link->handle;
228 dev = link->priv; 224 dev = link->priv;
229 225
230 DEBUG(0, "airo_config(0x%p)\n", link); 226 DEBUG(0, "airo_config(0x%p)\n", link);
@@ -238,9 +234,9 @@ static void airo_config(dev_link_t *link)
238 tuple.TupleData = buf; 234 tuple.TupleData = buf;
239 tuple.TupleDataMax = sizeof(buf); 235 tuple.TupleDataMax = sizeof(buf);
240 tuple.TupleOffset = 0; 236 tuple.TupleOffset = 0;
241 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 237 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
242 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 238 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
243 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 239 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
244 link->conf.ConfigBase = parse.config.base; 240 link->conf.ConfigBase = parse.config.base;
245 link->conf.Present = parse.config.rmask[0]; 241 link->conf.Present = parse.config.rmask[0];
246 242
@@ -260,12 +256,12 @@ static void airo_config(dev_link_t *link)
260 will only use the CIS to fill in implementation-defined details. 256 will only use the CIS to fill in implementation-defined details.
261 */ 257 */
262 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 258 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
263 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 259 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
264 while (1) { 260 while (1) {
265 cistpl_cftable_entry_t dflt = { 0 }; 261 cistpl_cftable_entry_t dflt = { 0 };
266 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 262 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
267 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 263 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
268 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 264 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
269 goto next_entry; 265 goto next_entry;
270 266
271 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 267 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
@@ -310,12 +306,12 @@ static void airo_config(dev_link_t *link)
310 } 306 }
311 307
312 /* This reserves IO space but doesn't actually enable it */ 308 /* This reserves IO space but doesn't actually enable it */
313 if (pcmcia_request_io(link->handle, &link->io) != 0) 309 if (pcmcia_request_io(link, &link->io) != 0)
314 goto next_entry; 310 goto next_entry;
315 311
316 /* 312 /*
317 Now set up a common memory window, if needed. There is room 313 Now set up a common memory window, if needed. There is room
318 in the dev_link_t structure for one memory window handle, 314 in the struct pcmcia_device structure for one memory window handle,
319 but if the base addresses need to be saved, or if multiple 315 but if the base addresses need to be saved, or if multiple
320 windows are needed, the info should go in the private data 316 windows are needed, the info should go in the private data
321 structure for this device. 317 structure for this device.
@@ -331,7 +327,7 @@ static void airo_config(dev_link_t *link)
331 req.Base = mem->win[0].host_addr; 327 req.Base = mem->win[0].host_addr;
332 req.Size = mem->win[0].len; 328 req.Size = mem->win[0].len;
333 req.AccessSpeed = 0; 329 req.AccessSpeed = 0;
334 if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) 330 if (pcmcia_request_window(&link, &req, &link->win) != 0)
335 goto next_entry; 331 goto next_entry;
336 map.Page = 0; map.CardOffset = mem->win[0].card_addr; 332 map.Page = 0; map.CardOffset = mem->win[0].card_addr;
337 if (pcmcia_map_mem_page(link->win, &map) != 0) 333 if (pcmcia_map_mem_page(link->win, &map) != 0)
@@ -341,7 +337,7 @@ static void airo_config(dev_link_t *link)
341 break; 337 break;
342 338
343 next_entry: 339 next_entry:
344 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 340 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
345 } 341 }
346 342
347 /* 343 /*
@@ -350,17 +346,17 @@ static void airo_config(dev_link_t *link)
350 irq structure is initialized. 346 irq structure is initialized.
351 */ 347 */
352 if (link->conf.Attributes & CONF_ENABLE_IRQ) 348 if (link->conf.Attributes & CONF_ENABLE_IRQ)
353 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 349 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
354 350
355 /* 351 /*
356 This actually configures the PCMCIA socket -- setting up 352 This actually configures the PCMCIA socket -- setting up
357 the I/O windows and the interrupt mapping, and putting the 353 the I/O windows and the interrupt mapping, and putting the
358 card and host interface into "Memory and IO" mode. 354 card and host interface into "Memory and IO" mode.
359 */ 355 */
360 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 356 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
361 ((local_info_t*)link->priv)->eth_dev = 357 ((local_info_t*)link->priv)->eth_dev =
362 init_airo_card( link->irq.AssignedIRQ, 358 init_airo_card( link->irq.AssignedIRQ,
363 link->io.BasePort1, 1, &handle_to_dev(handle) ); 359 link->io.BasePort1, 1, &handle_to_dev(link) );
364 if (!((local_info_t*)link->priv)->eth_dev) goto cs_failed; 360 if (!((local_info_t*)link->priv)->eth_dev) goto cs_failed;
365 361
366 /* 362 /*
@@ -393,7 +389,7 @@ static void airo_config(dev_link_t *link)
393 return; 389 return;
394 390
395 cs_failed: 391 cs_failed:
396 cs_error(link->handle, last_fn, last_ret); 392 cs_error(link, last_fn, last_ret);
397 airo_release(link); 393 airo_release(link);
398 394
399} /* airo_config */ 395} /* airo_config */
@@ -406,15 +402,14 @@ static void airo_config(dev_link_t *link)
406 402
407 ======================================================================*/ 403 ======================================================================*/
408 404
409static void airo_release(dev_link_t *link) 405static void airo_release(struct pcmcia_device *link)
410{ 406{
411 DEBUG(0, "airo_release(0x%p)\n", link); 407 DEBUG(0, "airo_release(0x%p)\n", link);
412 pcmcia_disable_device(link->handle); 408 pcmcia_disable_device(link);
413} 409}
414 410
415static int airo_suspend(struct pcmcia_device *p_dev) 411static int airo_suspend(struct pcmcia_device *link)
416{ 412{
417 dev_link_t *link = dev_to_instance(p_dev);
418 local_info_t *local = link->priv; 413 local_info_t *local = link->priv;
419 414
420 if (link->state & DEV_CONFIG) 415 if (link->state & DEV_CONFIG)
@@ -423,9 +418,8 @@ static int airo_suspend(struct pcmcia_device *p_dev)
423 return 0; 418 return 0;
424} 419}
425 420
426static int airo_resume(struct pcmcia_device *p_dev) 421static int airo_resume(struct pcmcia_device *link)
427{ 422{
428 dev_link_t *link = dev_to_instance(p_dev);
429 local_info_t *local = link->priv; 423 local_info_t *local = link->priv;
430 424
431 if ((link->state & DEV_CONFIG) && (link->open)) { 425 if ((link->state & DEV_CONFIG) && (link->open)) {
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 522bbed47a05..843dd1a036d2 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -91,8 +91,8 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
91 event handler. 91 event handler.
92*/ 92*/
93 93
94static void atmel_config(dev_link_t *link); 94static void atmel_config(struct pcmcia_device *link);
95static void atmel_release(dev_link_t *link); 95static void atmel_release(struct pcmcia_device *link);
96 96
97/* 97/*
98 The attach() and detach() entry points are used to create and destroy 98 The attach() and detach() entry points are used to create and destroy
@@ -112,10 +112,10 @@ static void atmel_detach(struct pcmcia_device *p_dev);
112/* 112/*
113 A linked list of "instances" of the atmelnet device. Each actual 113 A linked list of "instances" of the atmelnet device. Each actual
114 PCMCIA card corresponds to one device instance, and is described 114 PCMCIA card corresponds to one device instance, and is described
115 by one dev_link_t structure (defined in ds.h). 115 by one struct pcmcia_device structure (defined in ds.h).
116 116
117 You may not want to use a linked list for this -- for example, the 117 You may not want to use a linked list for this -- for example, the
118 memory card driver uses an array of dev_link_t pointers, where minor 118 memory card driver uses an array of struct pcmcia_device pointers, where minor
119 device numbers are used to derive the corresponding array index. 119 device numbers are used to derive the corresponding array index.
120*/ 120*/
121 121
@@ -125,7 +125,7 @@ static void atmel_detach(struct pcmcia_device *p_dev);
125 example, ethernet cards, modems). In other cases, there may be 125 example, ethernet cards, modems). In other cases, there may be
126 many actual or logical devices (SCSI adapters, memory cards with 126 many actual or logical devices (SCSI adapters, memory cards with
127 multiple partitions). The dev_node_t structures need to be kept 127 multiple partitions). The dev_node_t structures need to be kept
128 in a linked list starting at the 'dev' field of a dev_link_t 128 in a linked list starting at the 'dev' field of a struct pcmcia_device
129 structure. We allocate them in the card's private data structure, 129 structure. We allocate them in the card's private data structure,
130 because they generally shouldn't be allocated dynamically. 130 because they generally shouldn't be allocated dynamically.
131 131
@@ -196,10 +196,8 @@ static int atmel_attach(struct pcmcia_device *p_dev)
196 196
197 ======================================================================*/ 197 ======================================================================*/
198 198
199static void atmel_detach(struct pcmcia_device *p_dev) 199static void atmel_detach(struct pcmcia_device *link)
200{ 200{
201 dev_link_t *link = dev_to_instance(p_dev);
202
203 DEBUG(0, "atmel_detach(0x%p)\n", link); 201 DEBUG(0, "atmel_detach(0x%p)\n", link);
204 202
205 if (link->state & DEV_CONFIG) 203 if (link->state & DEV_CONFIG)
@@ -223,7 +221,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
223 about the current existance of the card */ 221 about the current existance of the card */
224static int card_present(void *arg) 222static int card_present(void *arg)
225{ 223{
226 dev_link_t *link = (dev_link_t *)arg; 224 struct pcmcia_device *link = (struct pcmcia_device *)arg;
227 if (link->state & DEV_SUSPEND) 225 if (link->state & DEV_SUSPEND)
228 return 0; 226 return 0;
229 else if (link->state & DEV_PRESENT) 227 else if (link->state & DEV_PRESENT)
@@ -232,9 +230,8 @@ static int card_present(void *arg)
232 return 0; 230 return 0;
233} 231}
234 232
235static void atmel_config(dev_link_t *link) 233static void atmel_config(struct pcmcia_device *link)
236{ 234{
237 client_handle_t handle;
238 tuple_t tuple; 235 tuple_t tuple;
239 cisparse_t parse; 236 cisparse_t parse;
240 local_info_t *dev; 237 local_info_t *dev;
@@ -242,9 +239,8 @@ static void atmel_config(dev_link_t *link)
242 u_char buf[64]; 239 u_char buf[64];
243 struct pcmcia_device_id *did; 240 struct pcmcia_device_id *did;
244 241
245 handle = link->handle;
246 dev = link->priv; 242 dev = link->priv;
247 did = handle_to_dev(handle).driver_data; 243 did = handle_to_dev(link).driver_data;
248 244
249 DEBUG(0, "atmel_config(0x%p)\n", link); 245 DEBUG(0, "atmel_config(0x%p)\n", link);
250 246
@@ -258,9 +254,9 @@ static void atmel_config(dev_link_t *link)
258 registers. 254 registers.
259 */ 255 */
260 tuple.DesiredTuple = CISTPL_CONFIG; 256 tuple.DesiredTuple = CISTPL_CONFIG;
261 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 257 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
262 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 258 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
263 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 259 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
264 link->conf.ConfigBase = parse.config.base; 260 link->conf.ConfigBase = parse.config.base;
265 link->conf.Present = parse.config.rmask[0]; 261 link->conf.Present = parse.config.rmask[0];
266 262
@@ -280,12 +276,12 @@ static void atmel_config(dev_link_t *link)
280 will only use the CIS to fill in implementation-defined details. 276 will only use the CIS to fill in implementation-defined details.
281 */ 277 */
282 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 278 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
283 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 279 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
284 while (1) { 280 while (1) {
285 cistpl_cftable_entry_t dflt = { 0 }; 281 cistpl_cftable_entry_t dflt = { 0 };
286 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 282 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
287 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 283 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
288 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 284 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
289 goto next_entry; 285 goto next_entry;
290 286
291 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 287 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
@@ -330,14 +326,14 @@ static void atmel_config(dev_link_t *link)
330 } 326 }
331 327
332 /* This reserves IO space but doesn't actually enable it */ 328 /* This reserves IO space but doesn't actually enable it */
333 if (pcmcia_request_io(link->handle, &link->io) != 0) 329 if (pcmcia_request_io(link, &link->io) != 0)
334 goto next_entry; 330 goto next_entry;
335 331
336 /* If we got this far, we're cool! */ 332 /* If we got this far, we're cool! */
337 break; 333 break;
338 334
339 next_entry: 335 next_entry:
340 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 336 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
341 } 337 }
342 338
343 /* 339 /*
@@ -346,14 +342,14 @@ static void atmel_config(dev_link_t *link)
346 irq structure is initialized. 342 irq structure is initialized.
347 */ 343 */
348 if (link->conf.Attributes & CONF_ENABLE_IRQ) 344 if (link->conf.Attributes & CONF_ENABLE_IRQ)
349 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 345 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
350 346
351 /* 347 /*
352 This actually configures the PCMCIA socket -- setting up 348 This actually configures the PCMCIA socket -- setting up
353 the I/O windows and the interrupt mapping, and putting the 349 the I/O windows and the interrupt mapping, and putting the
354 card and host interface into "Memory and IO" mode. 350 card and host interface into "Memory and IO" mode.
355 */ 351 */
356 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 352 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
357 353
358 if (link->irq.AssignedIRQ == 0) { 354 if (link->irq.AssignedIRQ == 0) {
359 printk(KERN_ALERT 355 printk(KERN_ALERT
@@ -365,7 +361,7 @@ static void atmel_config(dev_link_t *link)
365 init_atmel_card(link->irq.AssignedIRQ, 361 init_atmel_card(link->irq.AssignedIRQ,
366 link->io.BasePort1, 362 link->io.BasePort1,
367 did ? did->driver_info : ATMEL_FW_TYPE_NONE, 363 did ? did->driver_info : ATMEL_FW_TYPE_NONE,
368 &handle_to_dev(handle), 364 &handle_to_dev(link),
369 card_present, 365 card_present,
370 link); 366 link);
371 if (!((local_info_t*)link->priv)->eth_dev) 367 if (!((local_info_t*)link->priv)->eth_dev)
@@ -384,7 +380,7 @@ static void atmel_config(dev_link_t *link)
384 return; 380 return;
385 381
386 cs_failed: 382 cs_failed:
387 cs_error(link->handle, last_fn, last_ret); 383 cs_error(link, last_fn, last_ret);
388 atmel_release(link); 384 atmel_release(link);
389} 385}
390 386
@@ -396,7 +392,7 @@ static void atmel_config(dev_link_t *link)
396 392
397 ======================================================================*/ 393 ======================================================================*/
398 394
399static void atmel_release(dev_link_t *link) 395static void atmel_release(struct pcmcia_device *link)
400{ 396{
401 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; 397 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
402 398
@@ -406,12 +402,11 @@ static void atmel_release(dev_link_t *link)
406 stop_atmel_card(dev); 402 stop_atmel_card(dev);
407 ((local_info_t*)link->priv)->eth_dev = NULL; 403 ((local_info_t*)link->priv)->eth_dev = NULL;
408 404
409 pcmcia_disable_device(link->handle); 405 pcmcia_disable_device(link);
410} 406}
411 407
412static int atmel_suspend(struct pcmcia_device *dev) 408static int atmel_suspend(struct pcmcia_device *link)
413{ 409{
414 dev_link_t *link = dev_to_instance(dev);
415 local_info_t *local = link->priv; 410 local_info_t *local = link->priv;
416 411
417 if (link->state & DEV_CONFIG) 412 if (link->state & DEV_CONFIG)
@@ -420,9 +415,8 @@ static int atmel_suspend(struct pcmcia_device *dev)
420 return 0; 415 return 0;
421} 416}
422 417
423static int atmel_resume(struct pcmcia_device *dev) 418static int atmel_resume(struct pcmcia_device *link)
424{ 419{
425 dev_link_t *link = dev_to_instance(dev);
426 local_info_t *local = link->priv; 420 local_info_t *local = link->priv;
427 421
428 if (link->state & DEV_CONFIG) { 422 if (link->state & DEV_CONFIG) {
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index e3095a88745c..89b178106edf 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -42,7 +42,7 @@ MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
42/* struct local_info::hw_priv */ 42/* struct local_info::hw_priv */
43struct hostap_cs_priv { 43struct hostap_cs_priv {
44 dev_node_t node; 44 dev_node_t node;
45 dev_link_t *link; 45 struct pcmcia_device *link;
46 int sandisk_connectplus; 46 int sandisk_connectplus;
47}; 47};
48 48
@@ -204,7 +204,7 @@ static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
204 204
205static void prism2_detach(struct pcmcia_device *p_dev); 205static void prism2_detach(struct pcmcia_device *p_dev);
206static void prism2_release(u_long arg); 206static void prism2_release(u_long arg);
207static int prism2_config(dev_link_t *link); 207static int prism2_config(struct pcmcia_device *link);
208 208
209 209
210static int prism2_pccard_card_present(local_info_t *local) 210static int prism2_pccard_card_present(local_info_t *local)
@@ -237,7 +237,7 @@ static void sandisk_set_iobase(local_info_t *local)
237 reg.Action = CS_WRITE; 237 reg.Action = CS_WRITE;
238 reg.Offset = 0x10; /* 0x3f0 IO base 1 */ 238 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
239 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; 239 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
240 res = pcmcia_access_configuration_register(hw_priv->link->handle, 240 res = pcmcia_access_configuration_register(hw_priv->link,
241 &reg); 241 &reg);
242 if (res != CS_SUCCESS) { 242 if (res != CS_SUCCESS) {
243 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" 243 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
@@ -249,7 +249,7 @@ static void sandisk_set_iobase(local_info_t *local)
249 reg.Action = CS_WRITE; 249 reg.Action = CS_WRITE;
250 reg.Offset = 0x12; /* 0x3f2 IO base 2 */ 250 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
251 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; 251 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
252 res = pcmcia_access_configuration_register(hw_priv->link->handle, 252 res = pcmcia_access_configuration_register(hw_priv->link,
253 &reg); 253 &reg);
254 if (res != CS_SUCCESS) { 254 if (res != CS_SUCCESS) {
255 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" 255 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
@@ -301,9 +301,9 @@ static int sandisk_enable_wireless(struct net_device *dev)
301 tuple.TupleData = buf; 301 tuple.TupleData = buf;
302 tuple.TupleDataMax = sizeof(buf); 302 tuple.TupleDataMax = sizeof(buf);
303 tuple.TupleOffset = 0; 303 tuple.TupleOffset = 0;
304 if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || 304 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
305 pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || 305 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
306 pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || 306 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
307 parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) { 307 parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) {
308 /* No SanDisk manfid found */ 308 /* No SanDisk manfid found */
309 ret = -ENODEV; 309 ret = -ENODEV;
@@ -311,9 +311,9 @@ static int sandisk_enable_wireless(struct net_device *dev)
311 } 311 }
312 312
313 tuple.DesiredTuple = CISTPL_LONGLINK_MFC; 313 tuple.DesiredTuple = CISTPL_LONGLINK_MFC;
314 if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || 314 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
315 pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || 315 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
316 pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || 316 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
317 parse->longlink_mfc.nfn < 2) { 317 parse->longlink_mfc.nfn < 2) {
318 /* No multi-function links found */ 318 /* No multi-function links found */
319 ret = -ENODEV; 319 ret = -ENODEV;
@@ -328,7 +328,7 @@ static int sandisk_enable_wireless(struct net_device *dev)
328 reg.Action = CS_WRITE; 328 reg.Action = CS_WRITE;
329 reg.Offset = CISREG_COR; 329 reg.Offset = CISREG_COR;
330 reg.Value = COR_SOFT_RESET; 330 reg.Value = COR_SOFT_RESET;
331 res = pcmcia_access_configuration_register(hw_priv->link->handle, 331 res = pcmcia_access_configuration_register(hw_priv->link,
332 &reg); 332 &reg);
333 if (res != CS_SUCCESS) { 333 if (res != CS_SUCCESS) {
334 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 334 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
@@ -345,7 +345,7 @@ static int sandisk_enable_wireless(struct net_device *dev)
345 * will be enabled during the first cor_sreset call. 345 * will be enabled during the first cor_sreset call.
346 */ 346 */
347 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; 347 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
348 res = pcmcia_access_configuration_register(hw_priv->link->handle, 348 res = pcmcia_access_configuration_register(hw_priv->link,
349 &reg); 349 &reg);
350 if (res != CS_SUCCESS) { 350 if (res != CS_SUCCESS) {
351 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 351 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
@@ -380,7 +380,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
380 reg.Action = CS_READ; 380 reg.Action = CS_READ;
381 reg.Offset = CISREG_COR; 381 reg.Offset = CISREG_COR;
382 reg.Value = 0; 382 reg.Value = 0;
383 res = pcmcia_access_configuration_register(hw_priv->link->handle, 383 res = pcmcia_access_configuration_register(hw_priv->link,
384 &reg); 384 &reg);
385 if (res != CS_SUCCESS) { 385 if (res != CS_SUCCESS) {
386 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", 386 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
@@ -392,7 +392,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
392 392
393 reg.Action = CS_WRITE; 393 reg.Action = CS_WRITE;
394 reg.Value |= COR_SOFT_RESET; 394 reg.Value |= COR_SOFT_RESET;
395 res = pcmcia_access_configuration_register(hw_priv->link->handle, 395 res = pcmcia_access_configuration_register(hw_priv->link,
396 &reg); 396 &reg);
397 if (res != CS_SUCCESS) { 397 if (res != CS_SUCCESS) {
398 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", 398 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
@@ -405,7 +405,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
405 reg.Value &= ~COR_SOFT_RESET; 405 reg.Value &= ~COR_SOFT_RESET;
406 if (hw_priv->sandisk_connectplus) 406 if (hw_priv->sandisk_connectplus)
407 reg.Value |= COR_IREQ_ENA; 407 reg.Value |= COR_IREQ_ENA;
408 res = pcmcia_access_configuration_register(hw_priv->link->handle, 408 res = pcmcia_access_configuration_register(hw_priv->link,
409 &reg); 409 &reg);
410 if (res != CS_SUCCESS) { 410 if (res != CS_SUCCESS) {
411 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", 411 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
@@ -439,7 +439,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
439 reg.Action = CS_READ; 439 reg.Action = CS_READ;
440 reg.Offset = CISREG_COR; 440 reg.Offset = CISREG_COR;
441 reg.Value = 0; 441 reg.Value = 0;
442 res = pcmcia_access_configuration_register(hw_priv->link->handle, 442 res = pcmcia_access_configuration_register(hw_priv->link,
443 &reg); 443 &reg);
444 if (res != CS_SUCCESS) { 444 if (res != CS_SUCCESS) {
445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
@@ -452,7 +452,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
452 452
453 reg.Action = CS_WRITE; 453 reg.Action = CS_WRITE;
454 reg.Value |= COR_SOFT_RESET; 454 reg.Value |= COR_SOFT_RESET;
455 res = pcmcia_access_configuration_register(hw_priv->link->handle, 455 res = pcmcia_access_configuration_register(hw_priv->link,
456 &reg); 456 &reg);
457 if (res != CS_SUCCESS) { 457 if (res != CS_SUCCESS) {
458 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 458 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
@@ -466,7 +466,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
466 reg.Action = CS_WRITE; 466 reg.Action = CS_WRITE;
467 reg.Value = hcr; 467 reg.Value = hcr;
468 reg.Offset = CISREG_CCSR; 468 reg.Offset = CISREG_CCSR;
469 res = pcmcia_access_configuration_register(hw_priv->link->handle, 469 res = pcmcia_access_configuration_register(hw_priv->link,
470 &reg); 470 &reg);
471 if (res != CS_SUCCESS) { 471 if (res != CS_SUCCESS) {
472 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 472 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
@@ -478,7 +478,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
478 reg.Action = CS_WRITE; 478 reg.Action = CS_WRITE;
479 reg.Offset = CISREG_COR; 479 reg.Offset = CISREG_COR;
480 reg.Value = old_cor & ~COR_SOFT_RESET; 480 reg.Value = old_cor & ~COR_SOFT_RESET;
481 res = pcmcia_access_configuration_register(hw_priv->link->handle, 481 res = pcmcia_access_configuration_register(hw_priv->link,
482 &reg); 482 &reg);
483 if (res != CS_SUCCESS) { 483 if (res != CS_SUCCESS) {
484 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 484 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
@@ -514,10 +514,8 @@ static int prism2_attach(struct pcmcia_device *p_dev)
514} 514}
515 515
516 516
517static void prism2_detach(struct pcmcia_device *p_dev) 517static void prism2_detach(struct pcmcia_device *link)
518{ 518{
519 dev_link_t *link = dev_to_instance(p_dev);
520
521 PDEBUG(DEBUG_FLOW, "prism2_detach\n"); 519 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
522 520
523 if (link->state & DEV_CONFIG) { 521 if (link->state & DEV_CONFIG) {
@@ -545,7 +543,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
545do { int ret = (retf); \ 543do { int ret = (retf); \
546if (ret != 0) { \ 544if (ret != 0) { \
547 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \ 545 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \
548 cs_error(link->handle, fn, ret); \ 546 cs_error(link, fn, ret); \
549 goto next_entry; \ 547 goto next_entry; \
550} \ 548} \
551} while (0) 549} while (0)
@@ -553,7 +551,7 @@ if (ret != 0) { \
553 551
554/* run after a CARD_INSERTION event is received to configure the PCMCIA 552/* run after a CARD_INSERTION event is received to configure the PCMCIA
555 * socket and make the device available to the system */ 553 * socket and make the device available to the system */
556static int prism2_config(dev_link_t *link) 554static int prism2_config(struct pcmcia_device *link)
557{ 555{
558 struct net_device *dev; 556 struct net_device *dev;
559 struct hostap_interface *iface; 557 struct hostap_interface *iface;
@@ -582,24 +580,24 @@ static int prism2_config(dev_link_t *link)
582 tuple.TupleData = buf; 580 tuple.TupleData = buf;
583 tuple.TupleDataMax = sizeof(buf); 581 tuple.TupleDataMax = sizeof(buf);
584 tuple.TupleOffset = 0; 582 tuple.TupleOffset = 0;
585 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link->handle, &tuple)); 583 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
586 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link->handle, &tuple)); 584 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
587 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link->handle, &tuple, parse)); 585 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
588 link->conf.ConfigBase = parse->config.base; 586 link->conf.ConfigBase = parse->config.base;
589 link->conf.Present = parse->config.rmask[0]; 587 link->conf.Present = parse->config.rmask[0];
590 588
591 CS_CHECK(GetConfigurationInfo, 589 CS_CHECK(GetConfigurationInfo,
592 pcmcia_get_configuration_info(link->handle, &conf)); 590 pcmcia_get_configuration_info(link, &conf));
593 591
594 /* Look for an appropriate configuration table entry in the CIS */ 592 /* Look for an appropriate configuration table entry in the CIS */
595 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 593 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
596 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link->handle, &tuple)); 594 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
597 for (;;) { 595 for (;;) {
598 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry); 596 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry);
599 CFG_CHECK2(GetTupleData, 597 CFG_CHECK2(GetTupleData,
600 pcmcia_get_tuple_data(link->handle, &tuple)); 598 pcmcia_get_tuple_data(link, &tuple));
601 CFG_CHECK2(ParseTuple, 599 CFG_CHECK2(ParseTuple,
602 pcmcia_parse_tuple(link->handle, &tuple, parse)); 600 pcmcia_parse_tuple(link, &tuple, parse));
603 601
604 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 602 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
605 dflt = *cfg; 603 dflt = *cfg;
@@ -679,19 +677,19 @@ static int prism2_config(dev_link_t *link)
679 677
680 /* This reserves IO space but doesn't actually enable it */ 678 /* This reserves IO space but doesn't actually enable it */
681 CFG_CHECK2(RequestIO, 679 CFG_CHECK2(RequestIO,
682 pcmcia_request_io(link->handle, &link->io)); 680 pcmcia_request_io(link, &link->io));
683 681
684 /* This configuration table entry is OK */ 682 /* This configuration table entry is OK */
685 break; 683 break;
686 684
687 next_entry: 685 next_entry:
688 CS_CHECK(GetNextTuple, 686 CS_CHECK(GetNextTuple,
689 pcmcia_get_next_tuple(link->handle, &tuple)); 687 pcmcia_get_next_tuple(link, &tuple));
690 } 688 }
691 689
692 /* Need to allocate net_device before requesting IRQ handler */ 690 /* Need to allocate net_device before requesting IRQ handler */
693 dev = prism2_init_local_data(&prism2_pccard_funcs, 0, 691 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
694 &handle_to_dev(link->handle)); 692 &handle_to_dev(link));
695 if (dev == NULL) 693 if (dev == NULL)
696 goto failed; 694 goto failed;
697 link->priv = dev; 695 link->priv = dev;
@@ -714,7 +712,7 @@ static int prism2_config(dev_link_t *link)
714 link->irq.Handler = prism2_interrupt; 712 link->irq.Handler = prism2_interrupt;
715 link->irq.Instance = dev; 713 link->irq.Instance = dev;
716 CS_CHECK(RequestIRQ, 714 CS_CHECK(RequestIRQ,
717 pcmcia_request_irq(link->handle, &link->irq)); 715 pcmcia_request_irq(link, &link->irq));
718 } 716 }
719 717
720 /* 718 /*
@@ -723,7 +721,7 @@ static int prism2_config(dev_link_t *link)
723 * card and host interface into "Memory and IO" mode. 721 * card and host interface into "Memory and IO" mode.
724 */ 722 */
725 CS_CHECK(RequestConfiguration, 723 CS_CHECK(RequestConfiguration,
726 pcmcia_request_configuration(link->handle, &link->conf)); 724 pcmcia_request_configuration(link, &link->conf));
727 725
728 dev->irq = link->irq.AssignedIRQ; 726 dev->irq = link->irq.AssignedIRQ;
729 dev->base_addr = link->io.BasePort1; 727 dev->base_addr = link->io.BasePort1;
@@ -761,7 +759,7 @@ static int prism2_config(dev_link_t *link)
761 return ret; 759 return ret;
762 760
763 cs_failed: 761 cs_failed:
764 cs_error(link->handle, last_fn, last_ret); 762 cs_error(link, last_fn, last_ret);
765 763
766 failed: 764 failed:
767 kfree(parse); 765 kfree(parse);
@@ -773,7 +771,7 @@ static int prism2_config(dev_link_t *link)
773 771
774static void prism2_release(u_long arg) 772static void prism2_release(u_long arg)
775{ 773{
776 dev_link_t *link = (dev_link_t *)arg; 774 struct pcmcia_device *link = (struct pcmcia_device *)arg;
777 775
778 PDEBUG(DEBUG_FLOW, "prism2_release\n"); 776 PDEBUG(DEBUG_FLOW, "prism2_release\n");
779 777
@@ -787,13 +785,12 @@ static void prism2_release(u_long arg)
787 iface->local->shutdown = 1; 785 iface->local->shutdown = 1;
788 } 786 }
789 787
790 pcmcia_disable_device(link->handle); 788 pcmcia_disable_device(link);
791 PDEBUG(DEBUG_FLOW, "release - done\n"); 789 PDEBUG(DEBUG_FLOW, "release - done\n");
792} 790}
793 791
794static int hostap_cs_suspend(struct pcmcia_device *p_dev) 792static int hostap_cs_suspend(struct pcmcia_device *link)
795{ 793{
796 dev_link_t *link = dev_to_instance(p_dev);
797 struct net_device *dev = (struct net_device *) link->priv; 794 struct net_device *dev = (struct net_device *) link->priv;
798 int dev_open = 0; 795 int dev_open = 0;
799 796
@@ -813,9 +810,8 @@ static int hostap_cs_suspend(struct pcmcia_device *p_dev)
813 return 0; 810 return 0;
814} 811}
815 812
816static int hostap_cs_resume(struct pcmcia_device *p_dev) 813static int hostap_cs_resume(struct pcmcia_device *link)
817{ 814{
818 dev_link_t *link = dev_to_instance(p_dev);
819 struct net_device *dev = (struct net_device *) link->priv; 815 struct net_device *dev = (struct net_device *) link->priv;
820 int dev_open = 0; 816 int dev_open = 0;
821 817
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 68dfe68ffecf..2a688865f777 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -190,8 +190,8 @@ module_param(mem_speed, int, 0);
190/*====================================================================*/ 190/*====================================================================*/
191 191
192/* PCMCIA (Card Services) related functions */ 192/* PCMCIA (Card Services) related functions */
193static void netwave_release(dev_link_t *link); /* Card removal */ 193static void netwave_release(struct pcmcia_device *link); /* Card removal */
194static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card 194static void netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
195 insertion */ 195 insertion */
196static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ 196static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */
197 197
@@ -221,10 +221,10 @@ static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev);
221static void set_multicast_list(struct net_device *dev); 221static void set_multicast_list(struct net_device *dev);
222 222
223/* 223/*
224 A dev_link_t structure has fields for most things that are needed 224 A struct pcmcia_device structure has fields for most things that are needed
225 to keep track of a socket, but there will usually be some device 225 to keep track of a socket, but there will usually be some device
226 specific information that also needs to be kept track of. The 226 specific information that also needs to be kept track of. The
227 'priv' pointer in a dev_link_t structure can be used to point to 227 'priv' pointer in a struct pcmcia_device structure can be used to point to
228 a device-specific private data structure, like this. 228 a device-specific private data structure, like this.
229 229
230 A driver needs to provide a dev_node_t structure for each device 230 A driver needs to provide a dev_node_t structure for each device
@@ -232,7 +232,7 @@ static void set_multicast_list(struct net_device *dev);
232 example, ethernet cards, modems). In other cases, there may be 232 example, ethernet cards, modems). In other cases, there may be
233 many actual or logical devices (SCSI adapters, memory cards with 233 many actual or logical devices (SCSI adapters, memory cards with
234 multiple partitions). The dev_node_t structures need to be kept 234 multiple partitions). The dev_node_t structures need to be kept
235 in a linked list starting at the 'dev' field of a dev_link_t 235 in a linked list starting at the 'dev' field of a struct pcmcia_device
236 structure. We allocate them in the card's private data structure, 236 structure. We allocate them in the card's private data structure,
237 because they generally can't be allocated dynamically. 237 because they generally can't be allocated dynamically.
238*/ 238*/
@@ -376,20 +376,19 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
376 * configure the card at this point -- we wait until we receive a 376 * configure the card at this point -- we wait until we receive a
377 * card insertion event. 377 * card insertion event.
378 */ 378 */
379static int netwave_attach(struct pcmcia_device *p_dev) 379static int netwave_attach(struct pcmcia_device *link)
380{ 380{
381 struct net_device *dev; 381 struct net_device *dev;
382 netwave_private *priv; 382 netwave_private *priv;
383 dev_link_t *link = dev_to_instance(p_dev);
384 383
385 DEBUG(0, "netwave_attach()\n"); 384 DEBUG(0, "netwave_attach()\n");
386 385
387 /* Initialize the dev_link_t structure */ 386 /* Initialize the struct pcmcia_device structure */
388 dev = alloc_etherdev(sizeof(netwave_private)); 387 dev = alloc_etherdev(sizeof(netwave_private));
389 if (!dev) 388 if (!dev)
390 return -ENOMEM; 389 return -ENOMEM;
391 priv = netdev_priv(dev); 390 priv = netdev_priv(dev);
392 priv->p_dev = p_dev; 391 priv->p_dev = link;
393 link->priv = dev; 392 link->priv = dev;
394 393
395 /* The io structure describes IO port mapping */ 394 /* The io structure describes IO port mapping */
@@ -443,9 +442,8 @@ static int netwave_attach(struct pcmcia_device *p_dev)
443 * structures are freed. Otherwise, the structures will be freed 442 * structures are freed. Otherwise, the structures will be freed
444 * when the device is released. 443 * when the device is released.
445 */ 444 */
446static void netwave_detach(struct pcmcia_device *p_dev) 445static void netwave_detach(struct pcmcia_device *link)
447{ 446{
448 dev_link_t *link = dev_to_instance(p_dev);
449 struct net_device *dev = link->priv; 447 struct net_device *dev = link->priv;
450 448
451 DEBUG(0, "netwave_detach(0x%p)\n", link); 449 DEBUG(0, "netwave_detach(0x%p)\n", link);
@@ -739,8 +737,7 @@ static const struct iw_handler_def netwave_handler_def =
739#define CS_CHECK(fn, ret) \ 737#define CS_CHECK(fn, ret) \
740do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 738do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
741 739
742static void netwave_pcmcia_config(dev_link_t *link) { 740static void netwave_pcmcia_config(struct pcmcia_device *link) {
743 client_handle_t handle = link->handle;
744 struct net_device *dev = link->priv; 741 struct net_device *dev = link->priv;
745 netwave_private *priv = netdev_priv(dev); 742 netwave_private *priv = netdev_priv(dev);
746 tuple_t tuple; 743 tuple_t tuple;
@@ -762,9 +759,9 @@ static void netwave_pcmcia_config(dev_link_t *link) {
762 tuple.TupleDataMax = 64; 759 tuple.TupleDataMax = 64;
763 tuple.TupleOffset = 0; 760 tuple.TupleOffset = 0;
764 tuple.DesiredTuple = CISTPL_CONFIG; 761 tuple.DesiredTuple = CISTPL_CONFIG;
765 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 762 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
766 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 763 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
767 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 764 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
768 link->conf.ConfigBase = parse.config.base; 765 link->conf.ConfigBase = parse.config.base;
769 link->conf.Present = parse.config.rmask[0]; 766 link->conf.Present = parse.config.rmask[0];
770 767
@@ -778,11 +775,11 @@ static void netwave_pcmcia_config(dev_link_t *link) {
778 */ 775 */
779 for (i = j = 0x0; j < 0x400; j += 0x20) { 776 for (i = j = 0x0; j < 0x400; j += 0x20) {
780 link->io.BasePort1 = j ^ 0x300; 777 link->io.BasePort1 = j ^ 0x300;
781 i = pcmcia_request_io(link->handle, &link->io); 778 i = pcmcia_request_io(link, &link->io);
782 if (i == CS_SUCCESS) break; 779 if (i == CS_SUCCESS) break;
783 } 780 }
784 if (i != CS_SUCCESS) { 781 if (i != CS_SUCCESS) {
785 cs_error(link->handle, RequestIO, i); 782 cs_error(link, RequestIO, i);
786 goto failed; 783 goto failed;
787 } 784 }
788 785
@@ -790,16 +787,16 @@ static void netwave_pcmcia_config(dev_link_t *link) {
790 * Now allocate an interrupt line. Note that this does not 787 * Now allocate an interrupt line. Note that this does not
791 * actually assign a handler to the interrupt. 788 * actually assign a handler to the interrupt.
792 */ 789 */
793 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 790 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
794 791
795 /* 792 /*
796 * This actually configures the PCMCIA socket -- setting up 793 * This actually configures the PCMCIA socket -- setting up
797 * the I/O windows and the interrupt mapping. 794 * the I/O windows and the interrupt mapping.
798 */ 795 */
799 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 796 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
800 797
801 /* 798 /*
802 * Allocate a 32K memory window. Note that the dev_link_t 799 * Allocate a 32K memory window. Note that the struct pcmcia_device
803 * structure provides space for one window handle -- if your 800 * structure provides space for one window handle -- if your
804 * device needs several windows, you'll need to keep track of 801 * device needs several windows, you'll need to keep track of
805 * the handles in your private data structure, dev->priv. 802 * the handles in your private data structure, dev->priv.
@@ -809,7 +806,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
809 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 806 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
810 req.Base = 0; req.Size = 0x8000; 807 req.Base = 0; req.Size = 0x8000;
811 req.AccessSpeed = mem_speed; 808 req.AccessSpeed = mem_speed;
812 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 809 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
813 mem.CardOffset = 0x20000; mem.Page = 0; 810 mem.CardOffset = 0x20000; mem.Page = 0;
814 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 811 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
815 812
@@ -819,7 +816,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
819 816
820 dev->irq = link->irq.AssignedIRQ; 817 dev->irq = link->irq.AssignedIRQ;
821 dev->base_addr = link->io.BasePort1; 818 dev->base_addr = link->io.BasePort1;
822 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 819 SET_NETDEV_DEV(dev, &handle_to_dev(link));
823 820
824 if (register_netdev(dev) != 0) { 821 if (register_netdev(dev) != 0) {
825 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); 822 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n");
@@ -851,7 +848,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
851 return; 848 return;
852 849
853cs_failed: 850cs_failed:
854 cs_error(link->handle, last_fn, last_ret); 851 cs_error(link, last_fn, last_ret);
855failed: 852failed:
856 netwave_release(link); 853 netwave_release(link);
857} /* netwave_pcmcia_config */ 854} /* netwave_pcmcia_config */
@@ -863,21 +860,20 @@ failed:
863 * device, and release the PCMCIA configuration. If the device is 860 * device, and release the PCMCIA configuration. If the device is
864 * still open, this will be postponed until it is closed. 861 * still open, this will be postponed until it is closed.
865 */ 862 */
866static void netwave_release(dev_link_t *link) 863static void netwave_release(struct pcmcia_device *link)
867{ 864{
868 struct net_device *dev = link->priv; 865 struct net_device *dev = link->priv;
869 netwave_private *priv = netdev_priv(dev); 866 netwave_private *priv = netdev_priv(dev);
870 867
871 DEBUG(0, "netwave_release(0x%p)\n", link); 868 DEBUG(0, "netwave_release(0x%p)\n", link);
872 869
873 pcmcia_disable_device(link->handle); 870 pcmcia_disable_device(link);
874 if (link->win) 871 if (link->win)
875 iounmap(priv->ramBase); 872 iounmap(priv->ramBase);
876} 873}
877 874
878static int netwave_suspend(struct pcmcia_device *p_dev) 875static int netwave_suspend(struct pcmcia_device *link)
879{ 876{
880 dev_link_t *link = dev_to_instance(p_dev);
881 struct net_device *dev = link->priv; 877 struct net_device *dev = link->priv;
882 878
883 if ((link->state & DEV_CONFIG) && (link->open)) 879 if ((link->state & DEV_CONFIG) && (link->open))
@@ -886,9 +882,8 @@ static int netwave_suspend(struct pcmcia_device *p_dev)
886 return 0; 882 return 0;
887} 883}
888 884
889static int netwave_resume(struct pcmcia_device *p_dev) 885static int netwave_resume(struct pcmcia_device *link)
890{ 886{
891 dev_link_t *link = dev_to_instance(p_dev);
892 struct net_device *dev = link->priv; 887 struct net_device *dev = link->priv;
893 888
894 if ((link->state & DEV_CONFIG) && (link->open)) { 889 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -1100,7 +1095,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id, struct pt_regs *regs
1100 u_char __iomem *ramBase; 1095 u_char __iomem *ramBase;
1101 struct net_device *dev = (struct net_device *)dev_id; 1096 struct net_device *dev = (struct net_device *)dev_id;
1102 struct netwave_private *priv = netdev_priv(dev); 1097 struct netwave_private *priv = netdev_priv(dev);
1103 dev_link_t *link = priv->p_dev; 1098 struct pcmcia_device *link = priv->p_dev;
1104 int i; 1099 int i;
1105 1100
1106 if (!netif_device_present(dev)) 1101 if (!netif_device_present(dev))
@@ -1354,7 +1349,7 @@ static int netwave_rx(struct net_device *dev)
1354 1349
1355static int netwave_open(struct net_device *dev) { 1350static int netwave_open(struct net_device *dev) {
1356 netwave_private *priv = netdev_priv(dev); 1351 netwave_private *priv = netdev_priv(dev);
1357 dev_link_t *link = priv->p_dev; 1352 struct pcmcia_device *link = priv->p_dev;
1358 1353
1359 DEBUG(1, "netwave_open: starting.\n"); 1354 DEBUG(1, "netwave_open: starting.\n");
1360 1355
@@ -1371,7 +1366,7 @@ static int netwave_open(struct net_device *dev) {
1371 1366
1372static int netwave_close(struct net_device *dev) { 1367static int netwave_close(struct net_device *dev) {
1373 netwave_private *priv = netdev_priv(dev); 1368 netwave_private *priv = netdev_priv(dev);
1374 dev_link_t *link = priv->p_dev; 1369 struct pcmcia_device *link = priv->p_dev;
1375 1370
1376 DEBUG(1, "netwave_close: finishing.\n"); 1371 DEBUG(1, "netwave_close: finishing.\n");
1377 1372
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index f10d97bc45f0..405b7baa8bc3 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -63,8 +63,8 @@ struct orinoco_pccard {
63/* Function prototypes */ 63/* Function prototypes */
64/********************************************************************/ 64/********************************************************************/
65 65
66static void orinoco_cs_config(dev_link_t *link); 66static void orinoco_cs_config(struct pcmcia_device *link);
67static void orinoco_cs_release(dev_link_t *link); 67static void orinoco_cs_release(struct pcmcia_device *link);
68static void orinoco_cs_detach(struct pcmcia_device *p_dev); 68static void orinoco_cs_detach(struct pcmcia_device *p_dev);
69 69
70/********************************************************************/ 70/********************************************************************/
@@ -75,13 +75,13 @@ static int
75orinoco_cs_hard_reset(struct orinoco_private *priv) 75orinoco_cs_hard_reset(struct orinoco_private *priv)
76{ 76{
77 struct orinoco_pccard *card = priv->card; 77 struct orinoco_pccard *card = priv->card;
78 dev_link_t *link = card->p_dev; 78 struct pcmcia_device *link = card->p_dev;
79 int err; 79 int err;
80 80
81 /* We need atomic ops here, because we're not holding the lock */ 81 /* We need atomic ops here, because we're not holding the lock */
82 set_bit(0, &card->hard_reset_in_progress); 82 set_bit(0, &card->hard_reset_in_progress);
83 83
84 err = pcmcia_reset_card(link->handle, NULL); 84 err = pcmcia_reset_card(link, NULL);
85 if (err) 85 if (err)
86 return err; 86 return err;
87 87
@@ -104,12 +104,11 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
104 * configure the card at this point -- we wait until we receive a card 104 * configure the card at this point -- we wait until we receive a card
105 * insertion event. */ 105 * insertion event. */
106static int 106static int
107orinoco_cs_attach(struct pcmcia_device *p_dev) 107orinoco_cs_attach(struct pcmcia_device *link)
108{ 108{
109 struct net_device *dev; 109 struct net_device *dev;
110 struct orinoco_private *priv; 110 struct orinoco_private *priv;
111 struct orinoco_pccard *card; 111 struct orinoco_pccard *card;
112 dev_link_t *link = dev_to_instance(p_dev);
113 112
114 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); 113 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset);
115 if (! dev) 114 if (! dev)
@@ -118,7 +117,7 @@ orinoco_cs_attach(struct pcmcia_device *p_dev)
118 card = priv->card; 117 card = priv->card;
119 118
120 /* Link both structures together */ 119 /* Link both structures together */
121 card->p_dev = p_dev; 120 card->p_dev = link;
122 link->priv = dev; 121 link->priv = dev;
123 122
124 /* Interrupt setup */ 123 /* Interrupt setup */
@@ -147,9 +146,8 @@ orinoco_cs_attach(struct pcmcia_device *p_dev)
147 * are freed. Otherwise, the structures will be freed when the device 146 * are freed. Otherwise, the structures will be freed when the device
148 * is released. 147 * is released.
149 */ 148 */
150static void orinoco_cs_detach(struct pcmcia_device *p_dev) 149static void orinoco_cs_detach(struct pcmcia_device *link)
151{ 150{
152 dev_link_t *link = dev_to_instance(p_dev);
153 struct net_device *dev = link->priv; 151 struct net_device *dev = link->priv;
154 152
155 if (link->state & DEV_CONFIG) 153 if (link->state & DEV_CONFIG)
@@ -175,10 +173,9 @@ static void orinoco_cs_detach(struct pcmcia_device *p_dev)
175 } while (0) 173 } while (0)
176 174
177static void 175static void
178orinoco_cs_config(dev_link_t *link) 176orinoco_cs_config(struct pcmcia_device *link)
179{ 177{
180 struct net_device *dev = link->priv; 178 struct net_device *dev = link->priv;
181 client_handle_t handle = link->handle;
182 struct orinoco_private *priv = netdev_priv(dev); 179 struct orinoco_private *priv = netdev_priv(dev);
183 struct orinoco_pccard *card = priv->card; 180 struct orinoco_pccard *card = priv->card;
184 hermes_t *hw = &priv->hw; 181 hermes_t *hw = &priv->hw;
@@ -190,7 +187,7 @@ orinoco_cs_config(dev_link_t *link)
190 cisparse_t parse; 187 cisparse_t parse;
191 void __iomem *mem; 188 void __iomem *mem;
192 189
193 CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info)); 190 CS_CHECK(ValidateCIS, pcmcia_validate_cis(link, &info));
194 191
195 /* 192 /*
196 * This reads the card's CONFIG tuple to find its 193 * This reads the card's CONFIG tuple to find its
@@ -201,9 +198,9 @@ orinoco_cs_config(dev_link_t *link)
201 tuple.TupleData = buf; 198 tuple.TupleData = buf;
202 tuple.TupleDataMax = sizeof(buf); 199 tuple.TupleDataMax = sizeof(buf);
203 tuple.TupleOffset = 0; 200 tuple.TupleOffset = 0;
204 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 201 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
205 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 202 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
206 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 203 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
207 link->conf.ConfigBase = parse.config.base; 204 link->conf.ConfigBase = parse.config.base;
208 link->conf.Present = parse.config.rmask[0]; 205 link->conf.Present = parse.config.rmask[0];
209 206
@@ -212,7 +209,7 @@ orinoco_cs_config(dev_link_t *link)
212 209
213 /* Look up the current Vcc */ 210 /* Look up the current Vcc */
214 CS_CHECK(GetConfigurationInfo, 211 CS_CHECK(GetConfigurationInfo,
215 pcmcia_get_configuration_info(link->handle, &conf)); 212 pcmcia_get_configuration_info(link, &conf));
216 213
217 /* 214 /*
218 * In this loop, we scan the CIS for configuration table 215 * In this loop, we scan the CIS for configuration table
@@ -229,13 +226,13 @@ orinoco_cs_config(dev_link_t *link)
229 * implementation-defined details. 226 * implementation-defined details.
230 */ 227 */
231 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 228 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
232 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 229 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
233 while (1) { 230 while (1) {
234 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 231 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
235 cistpl_cftable_entry_t dflt = { .index = 0 }; 232 cistpl_cftable_entry_t dflt = { .index = 0 };
236 233
237 if ( (pcmcia_get_tuple_data(handle, &tuple) != 0) 234 if ( (pcmcia_get_tuple_data(link, &tuple) != 0)
238 || (pcmcia_parse_tuple(handle, &tuple, &parse) != 0)) 235 || (pcmcia_parse_tuple(link, &tuple, &parse) != 0))
239 goto next_entry; 236 goto next_entry;
240 237
241 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 238 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
@@ -300,7 +297,7 @@ orinoco_cs_config(dev_link_t *link)
300 } 297 }
301 298
302 /* This reserves IO space but doesn't actually enable it */ 299 /* This reserves IO space but doesn't actually enable it */
303 if (pcmcia_request_io(link->handle, &link->io) != 0) 300 if (pcmcia_request_io(link, &link->io) != 0)
304 goto next_entry; 301 goto next_entry;
305 } 302 }
306 303
@@ -310,8 +307,8 @@ orinoco_cs_config(dev_link_t *link)
310 break; 307 break;
311 308
312 next_entry: 309 next_entry:
313 pcmcia_disable_device(handle); 310 pcmcia_disable_device(link);
314 last_ret = pcmcia_get_next_tuple(handle, &tuple); 311 last_ret = pcmcia_get_next_tuple(link, &tuple);
315 if (last_ret == CS_NO_MORE_ITEMS) { 312 if (last_ret == CS_NO_MORE_ITEMS) {
316 printk(KERN_ERR PFX "GetNextTuple(): No matching " 313 printk(KERN_ERR PFX "GetNextTuple(): No matching "
317 "CIS configuration. Maybe you need the " 314 "CIS configuration. Maybe you need the "
@@ -325,7 +322,7 @@ orinoco_cs_config(dev_link_t *link)
325 * a handler to the interrupt, unless the 'Handler' member of 322 * a handler to the interrupt, unless the 'Handler' member of
326 * the irq structure is initialized. 323 * the irq structure is initialized.
327 */ 324 */
328 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 325 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
329 326
330 /* We initialize the hermes structure before completing PCMCIA 327 /* We initialize the hermes structure before completing PCMCIA
331 * configuration just in case the interrupt handler gets 328 * configuration just in case the interrupt handler gets
@@ -342,7 +339,7 @@ orinoco_cs_config(dev_link_t *link)
342 * card and host interface into "Memory and IO" mode. 339 * card and host interface into "Memory and IO" mode.
343 */ 340 */
344 CS_CHECK(RequestConfiguration, 341 CS_CHECK(RequestConfiguration,
345 pcmcia_request_configuration(link->handle, &link->conf)); 342 pcmcia_request_configuration(link, &link->conf));
346 343
347 /* Ok, we have the configuration, prepare to register the netdev */ 344 /* Ok, we have the configuration, prepare to register the netdev */
348 dev->base_addr = link->io.BasePort1; 345 dev->base_addr = link->io.BasePort1;
@@ -350,7 +347,7 @@ orinoco_cs_config(dev_link_t *link)
350 SET_MODULE_OWNER(dev); 347 SET_MODULE_OWNER(dev);
351 card->node.major = card->node.minor = 0; 348 card->node.major = card->node.minor = 0;
352 349
353 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 350 SET_NETDEV_DEV(dev, &handle_to_dev(link));
354 /* Tell the stack we exist */ 351 /* Tell the stack we exist */
355 if (register_netdev(dev) != 0) { 352 if (register_netdev(dev) != 0) {
356 printk(KERN_ERR PFX "register_netdev() failed\n"); 353 printk(KERN_ERR PFX "register_netdev() failed\n");
@@ -383,7 +380,7 @@ orinoco_cs_config(dev_link_t *link)
383 return; 380 return;
384 381
385 cs_failed: 382 cs_failed:
386 cs_error(link->handle, last_fn, last_ret); 383 cs_error(link, last_fn, last_ret);
387 384
388 failed: 385 failed:
389 orinoco_cs_release(link); 386 orinoco_cs_release(link);
@@ -395,7 +392,7 @@ orinoco_cs_config(dev_link_t *link)
395 * still open, this will be postponed until it is closed. 392 * still open, this will be postponed until it is closed.
396 */ 393 */
397static void 394static void
398orinoco_cs_release(dev_link_t *link) 395orinoco_cs_release(struct pcmcia_device *link)
399{ 396{
400 struct net_device *dev = link->priv; 397 struct net_device *dev = link->priv;
401 struct orinoco_private *priv = netdev_priv(dev); 398 struct orinoco_private *priv = netdev_priv(dev);
@@ -407,14 +404,13 @@ orinoco_cs_release(dev_link_t *link)
407 priv->hw_unavailable++; 404 priv->hw_unavailable++;
408 spin_unlock_irqrestore(&priv->lock, flags); 405 spin_unlock_irqrestore(&priv->lock, flags);
409 406
410 pcmcia_disable_device(link->handle); 407 pcmcia_disable_device(link);
411 if (priv->hw.iobase) 408 if (priv->hw.iobase)
412 ioport_unmap(priv->hw.iobase); 409 ioport_unmap(priv->hw.iobase);
413} /* orinoco_cs_release */ 410} /* orinoco_cs_release */
414 411
415static int orinoco_cs_suspend(struct pcmcia_device *p_dev) 412static int orinoco_cs_suspend(struct pcmcia_device *link)
416{ 413{
417 dev_link_t *link = dev_to_instance(p_dev);
418 struct net_device *dev = link->priv; 414 struct net_device *dev = link->priv;
419 struct orinoco_private *priv = netdev_priv(dev); 415 struct orinoco_private *priv = netdev_priv(dev);
420 struct orinoco_pccard *card = priv->card; 416 struct orinoco_pccard *card = priv->card;
@@ -443,9 +439,8 @@ static int orinoco_cs_suspend(struct pcmcia_device *p_dev)
443 return 0; 439 return 0;
444} 440}
445 441
446static int orinoco_cs_resume(struct pcmcia_device *p_dev) 442static int orinoco_cs_resume(struct pcmcia_device *link)
447{ 443{
448 dev_link_t *link = dev_to_instance(p_dev);
449 struct net_device *dev = link->priv; 444 struct net_device *dev = link->priv;
450 struct orinoco_private *priv = netdev_priv(dev); 445 struct orinoco_private *priv = netdev_priv(dev);
451 struct orinoco_pccard *card = priv->card; 446 struct orinoco_pccard *card = priv->card;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 60297460debd..415ae8be1e22 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -90,8 +90,8 @@ module_param(pc_debug, int, 0);
90#define DEBUG(n, args...) 90#define DEBUG(n, args...)
91#endif 91#endif
92/** Prototypes based on PCMCIA skeleton driver *******************************/ 92/** Prototypes based on PCMCIA skeleton driver *******************************/
93static void ray_config(dev_link_t *link); 93static void ray_config(struct pcmcia_device *link);
94static void ray_release(dev_link_t *link); 94static void ray_release(struct pcmcia_device *link);
95static void ray_detach(struct pcmcia_device *p_dev); 95static void ray_detach(struct pcmcia_device *p_dev);
96 96
97/***** Prototypes indicated by device structure ******************************/ 97/***** Prototypes indicated by device structure ******************************/
@@ -190,10 +190,10 @@ static int bc;
190static char *phy_addr = NULL; 190static char *phy_addr = NULL;
191 191
192 192
193/* A dev_link_t structure has fields for most things that are needed 193/* A struct pcmcia_device structure has fields for most things that are needed
194 to keep track of a socket, but there will usually be some device 194 to keep track of a socket, but there will usually be some device
195 specific information that also needs to be kept track of. The 195 specific information that also needs to be kept track of. The
196 'priv' pointer in a dev_link_t structure can be used to point to 196 'priv' pointer in a struct pcmcia_device structure can be used to point to
197 a device-specific private data structure, like this. 197 a device-specific private data structure, like this.
198*/ 198*/
199static unsigned int ray_mem_speed = 500; 199static unsigned int ray_mem_speed = 500;
@@ -381,9 +381,8 @@ fail_alloc_dev:
381 structures are freed. Otherwise, the structures will be freed 381 structures are freed. Otherwise, the structures will be freed
382 when the device is released. 382 when the device is released.
383=============================================================================*/ 383=============================================================================*/
384static void ray_detach(struct pcmcia_device *p_dev) 384static void ray_detach(struct pcmcia_device *link)
385{ 385{
386 dev_link_t *link = dev_to_instance(p_dev);
387 struct net_device *dev; 386 struct net_device *dev;
388 ray_dev_t *local; 387 ray_dev_t *local;
389 388
@@ -413,9 +412,8 @@ static void ray_detach(struct pcmcia_device *p_dev)
413#define CS_CHECK(fn, ret) \ 412#define CS_CHECK(fn, ret) \
414do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 413do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
415#define MAX_TUPLE_SIZE 128 414#define MAX_TUPLE_SIZE 128
416static void ray_config(dev_link_t *link) 415static void ray_config(struct pcmcia_device *link)
417{ 416{
418 client_handle_t handle = link->handle;
419 tuple_t tuple; 417 tuple_t tuple;
420 cisparse_t parse; 418 cisparse_t parse;
421 int last_fn = 0, last_ret = 0; 419 int last_fn = 0, last_ret = 0;
@@ -430,23 +428,23 @@ static void ray_config(dev_link_t *link)
430 428
431 /* This reads the card's CONFIG tuple to find its configuration regs */ 429 /* This reads the card's CONFIG tuple to find its configuration regs */
432 tuple.DesiredTuple = CISTPL_CONFIG; 430 tuple.DesiredTuple = CISTPL_CONFIG;
433 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 431 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
434 tuple.TupleData = buf; 432 tuple.TupleData = buf;
435 tuple.TupleDataMax = MAX_TUPLE_SIZE; 433 tuple.TupleDataMax = MAX_TUPLE_SIZE;
436 tuple.TupleOffset = 0; 434 tuple.TupleOffset = 0;
437 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 435 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
438 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 436 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
439 link->conf.ConfigBase = parse.config.base; 437 link->conf.ConfigBase = parse.config.base;
440 link->conf.Present = parse.config.rmask[0]; 438 link->conf.Present = parse.config.rmask[0];
441 439
442 /* Determine card type and firmware version */ 440 /* Determine card type and firmware version */
443 buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0; 441 buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
444 tuple.DesiredTuple = CISTPL_VERS_1; 442 tuple.DesiredTuple = CISTPL_VERS_1;
445 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 443 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
446 tuple.TupleData = buf; 444 tuple.TupleData = buf;
447 tuple.TupleDataMax = MAX_TUPLE_SIZE; 445 tuple.TupleDataMax = MAX_TUPLE_SIZE;
448 tuple.TupleOffset = 2; 446 tuple.TupleOffset = 2;
449 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 447 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
450 448
451 for (i=0; i<tuple.TupleDataLen - 4; i++) 449 for (i=0; i<tuple.TupleDataLen - 4; i++)
452 if (buf[i] == 0) buf[i] = ' '; 450 if (buf[i] == 0) buf[i] = ' ';
@@ -458,20 +456,20 @@ static void ray_config(dev_link_t *link)
458 /* Now allocate an interrupt line. Note that this does not 456 /* Now allocate an interrupt line. Note that this does not
459 actually assign a handler to the interrupt. 457 actually assign a handler to the interrupt.
460 */ 458 */
461 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 459 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
462 dev->irq = link->irq.AssignedIRQ; 460 dev->irq = link->irq.AssignedIRQ;
463 461
464 /* This actually configures the PCMCIA socket -- setting up 462 /* This actually configures the PCMCIA socket -- setting up
465 the I/O windows and the interrupt mapping. 463 the I/O windows and the interrupt mapping.
466 */ 464 */
467 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 465 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
468 466
469/*** Set up 32k window for shared memory (transmit and control) ************/ 467/*** Set up 32k window for shared memory (transmit and control) ************/
470 req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 468 req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
471 req.Base = 0; 469 req.Base = 0;
472 req.Size = 0x8000; 470 req.Size = 0x8000;
473 req.AccessSpeed = ray_mem_speed; 471 req.AccessSpeed = ray_mem_speed;
474 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 472 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
475 mem.CardOffset = 0x0000; mem.Page = 0; 473 mem.CardOffset = 0x0000; mem.Page = 0;
476 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 474 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
477 local->sram = ioremap(req.Base,req.Size); 475 local->sram = ioremap(req.Base,req.Size);
@@ -481,7 +479,7 @@ static void ray_config(dev_link_t *link)
481 req.Base = 0; 479 req.Base = 0;
482 req.Size = 0x4000; 480 req.Size = 0x4000;
483 req.AccessSpeed = ray_mem_speed; 481 req.AccessSpeed = ray_mem_speed;
484 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &local->rmem_handle)); 482 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &local->rmem_handle));
485 mem.CardOffset = 0x8000; mem.Page = 0; 483 mem.CardOffset = 0x8000; mem.Page = 0;
486 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem)); 484 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem));
487 local->rmem = ioremap(req.Base,req.Size); 485 local->rmem = ioremap(req.Base,req.Size);
@@ -491,7 +489,7 @@ static void ray_config(dev_link_t *link)
491 req.Base = 0; 489 req.Base = 0;
492 req.Size = 0x1000; 490 req.Size = 0x1000;
493 req.AccessSpeed = ray_mem_speed; 491 req.AccessSpeed = ray_mem_speed;
494 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &local->amem_handle)); 492 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &local->amem_handle));
495 mem.CardOffset = 0x0000; mem.Page = 0; 493 mem.CardOffset = 0x0000; mem.Page = 0;
496 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem)); 494 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem));
497 local->amem = ioremap(req.Base,req.Size); 495 local->amem = ioremap(req.Base,req.Size);
@@ -504,7 +502,7 @@ static void ray_config(dev_link_t *link)
504 return; 502 return;
505 } 503 }
506 504
507 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 505 SET_NETDEV_DEV(dev, &handle_to_dev(link));
508 i = register_netdev(dev); 506 i = register_netdev(dev);
509 if (i != 0) { 507 if (i != 0) {
510 printk("ray_config register_netdev() failed\n"); 508 printk("ray_config register_netdev() failed\n");
@@ -524,7 +522,7 @@ static void ray_config(dev_link_t *link)
524 return; 522 return;
525 523
526cs_failed: 524cs_failed:
527 cs_error(link->handle, last_fn, last_ret); 525 cs_error(link, last_fn, last_ret);
528 526
529 ray_release(link); 527 ray_release(link);
530} /* ray_config */ 528} /* ray_config */
@@ -553,7 +551,7 @@ static int ray_init(struct net_device *dev)
553 UCHAR *p; 551 UCHAR *p;
554 struct ccs __iomem *pccs; 552 struct ccs __iomem *pccs;
555 ray_dev_t *local = (ray_dev_t *)dev->priv; 553 ray_dev_t *local = (ray_dev_t *)dev->priv;
556 dev_link_t *link = local->finder; 554 struct pcmcia_device *link = local->finder;
557 DEBUG(1, "ray_init(0x%p)\n", dev); 555 DEBUG(1, "ray_init(0x%p)\n", dev);
558 if (!(link->state & DEV_PRESENT)) { 556 if (!(link->state & DEV_PRESENT)) {
559 DEBUG(0,"ray_init - device not present\n"); 557 DEBUG(0,"ray_init - device not present\n");
@@ -615,7 +613,7 @@ static int dl_startup_params(struct net_device *dev)
615 int ccsindex; 613 int ccsindex;
616 ray_dev_t *local = (ray_dev_t *)dev->priv; 614 ray_dev_t *local = (ray_dev_t *)dev->priv;
617 struct ccs __iomem *pccs; 615 struct ccs __iomem *pccs;
618 dev_link_t *link = local->finder; 616 struct pcmcia_device *link = local->finder;
619 617
620 DEBUG(1,"dl_startup_params entered\n"); 618 DEBUG(1,"dl_startup_params entered\n");
621 if (!(link->state & DEV_PRESENT)) { 619 if (!(link->state & DEV_PRESENT)) {
@@ -722,7 +720,7 @@ static void verify_dl_startup(u_long data)
722 ray_dev_t *local = (ray_dev_t *)data; 720 ray_dev_t *local = (ray_dev_t *)data;
723 struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs; 721 struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs;
724 UCHAR status; 722 UCHAR status;
725 dev_link_t *link = local->finder; 723 struct pcmcia_device *link = local->finder;
726 724
727 if (!(link->state & DEV_PRESENT)) { 725 if (!(link->state & DEV_PRESENT)) {
728 DEBUG(2,"ray_cs verify_dl_startup - device not present\n"); 726 DEBUG(2,"ray_cs verify_dl_startup - device not present\n");
@@ -762,7 +760,7 @@ static void start_net(u_long data)
762 ray_dev_t *local = (ray_dev_t *)data; 760 ray_dev_t *local = (ray_dev_t *)data;
763 struct ccs __iomem *pccs; 761 struct ccs __iomem *pccs;
764 int ccsindex; 762 int ccsindex;
765 dev_link_t *link = local->finder; 763 struct pcmcia_device *link = local->finder;
766 if (!(link->state & DEV_PRESENT)) { 764 if (!(link->state & DEV_PRESENT)) {
767 DEBUG(2,"ray_cs start_net - device not present\n"); 765 DEBUG(2,"ray_cs start_net - device not present\n");
768 return; 766 return;
@@ -789,7 +787,7 @@ static void join_net(u_long data)
789 787
790 struct ccs __iomem *pccs; 788 struct ccs __iomem *pccs;
791 int ccsindex; 789 int ccsindex;
792 dev_link_t *link = local->finder; 790 struct pcmcia_device *link = local->finder;
793 791
794 if (!(link->state & DEV_PRESENT)) { 792 if (!(link->state & DEV_PRESENT)) {
795 DEBUG(2,"ray_cs join_net - device not present\n"); 793 DEBUG(2,"ray_cs join_net - device not present\n");
@@ -815,7 +813,7 @@ static void join_net(u_long data)
815 device, and release the PCMCIA configuration. If the device is 813 device, and release the PCMCIA configuration. If the device is
816 still open, this will be postponed until it is closed. 814 still open, this will be postponed until it is closed.
817=============================================================================*/ 815=============================================================================*/
818static void ray_release(dev_link_t *link) 816static void ray_release(struct pcmcia_device *link)
819{ 817{
820 struct net_device *dev = link->priv; 818 struct net_device *dev = link->priv;
821 ray_dev_t *local = dev->priv; 819 ray_dev_t *local = dev->priv;
@@ -833,14 +831,13 @@ static void ray_release(dev_link_t *link)
833 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i); 831 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i);
834 i = pcmcia_release_window(local->rmem_handle); 832 i = pcmcia_release_window(local->rmem_handle);
835 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i); 833 if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i);
836 pcmcia_disable_device(link->handle); 834 pcmcia_disable_device(link);
837 835
838 DEBUG(2,"ray_release ending\n"); 836 DEBUG(2,"ray_release ending\n");
839} 837}
840 838
841static int ray_suspend(struct pcmcia_device *p_dev) 839static int ray_suspend(struct pcmcia_device *link)
842{ 840{
843 dev_link_t *link = dev_to_instance(p_dev);
844 struct net_device *dev = link->priv; 841 struct net_device *dev = link->priv;
845 842
846 if ((link->state & DEV_CONFIG) && (link->open)) 843 if ((link->state & DEV_CONFIG) && (link->open))
@@ -849,9 +846,8 @@ static int ray_suspend(struct pcmcia_device *p_dev)
849 return 0; 846 return 0;
850} 847}
851 848
852static int ray_resume(struct pcmcia_device *p_dev) 849static int ray_resume(struct pcmcia_device *link)
853{ 850{
854 dev_link_t *link = dev_to_instance(p_dev);
855 struct net_device *dev = link->priv; 851 struct net_device *dev = link->priv;
856 852
857 if ((link->state & DEV_CONFIG) && (link->open)) { 853 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -869,7 +865,7 @@ int ray_dev_init(struct net_device *dev)
869 int i; 865 int i;
870#endif /* RAY_IMMEDIATE_INIT */ 866#endif /* RAY_IMMEDIATE_INIT */
871 ray_dev_t *local = dev->priv; 867 ray_dev_t *local = dev->priv;
872 dev_link_t *link = local->finder; 868 struct pcmcia_device *link = local->finder;
873 869
874 DEBUG(1,"ray_dev_init(dev=%p)\n",dev); 870 DEBUG(1,"ray_dev_init(dev=%p)\n",dev);
875 if (!(link->state & DEV_PRESENT)) { 871 if (!(link->state & DEV_PRESENT)) {
@@ -903,7 +899,7 @@ int ray_dev_init(struct net_device *dev)
903static int ray_dev_config(struct net_device *dev, struct ifmap *map) 899static int ray_dev_config(struct net_device *dev, struct ifmap *map)
904{ 900{
905 ray_dev_t *local = dev->priv; 901 ray_dev_t *local = dev->priv;
906 dev_link_t *link = local->finder; 902 struct pcmcia_device *link = local->finder;
907 /* Dummy routine to satisfy device structure */ 903 /* Dummy routine to satisfy device structure */
908 DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map); 904 DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map);
909 if (!(link->state & DEV_PRESENT)) { 905 if (!(link->state & DEV_PRESENT)) {
@@ -917,7 +913,7 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map)
917static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev) 913static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
918{ 914{
919 ray_dev_t *local = dev->priv; 915 ray_dev_t *local = dev->priv;
920 dev_link_t *link = local->finder; 916 struct pcmcia_device *link = local->finder;
921 short length = skb->len; 917 short length = skb->len;
922 918
923 if (!(link->state & DEV_PRESENT)) { 919 if (!(link->state & DEV_PRESENT)) {
@@ -1529,7 +1525,7 @@ static int ray_commit(struct net_device *dev,
1529static iw_stats * ray_get_wireless_stats(struct net_device * dev) 1525static iw_stats * ray_get_wireless_stats(struct net_device * dev)
1530{ 1526{
1531 ray_dev_t * local = (ray_dev_t *) dev->priv; 1527 ray_dev_t * local = (ray_dev_t *) dev->priv;
1532 dev_link_t *link = local->finder; 1528 struct pcmcia_device *link = local->finder;
1533 struct status __iomem *p = local->sram + STATUS_BASE; 1529 struct status __iomem *p = local->sram + STATUS_BASE;
1534 1530
1535 if(local == (ray_dev_t *) NULL) 1531 if(local == (ray_dev_t *) NULL)
@@ -1617,7 +1613,7 @@ static const struct iw_handler_def ray_handler_def =
1617static int ray_open(struct net_device *dev) 1613static int ray_open(struct net_device *dev)
1618{ 1614{
1619 ray_dev_t *local = (ray_dev_t *)dev->priv; 1615 ray_dev_t *local = (ray_dev_t *)dev->priv;
1620 dev_link_t *link; 1616 struct pcmcia_device *link;
1621 link = local->finder; 1617 link = local->finder;
1622 1618
1623 DEBUG(1, "ray_open('%s')\n", dev->name); 1619 DEBUG(1, "ray_open('%s')\n", dev->name);
@@ -1651,7 +1647,7 @@ static int ray_open(struct net_device *dev)
1651static int ray_dev_close(struct net_device *dev) 1647static int ray_dev_close(struct net_device *dev)
1652{ 1648{
1653 ray_dev_t *local = (ray_dev_t *)dev->priv; 1649 ray_dev_t *local = (ray_dev_t *)dev->priv;
1654 dev_link_t *link; 1650 struct pcmcia_device *link;
1655 link = local->finder; 1651 link = local->finder;
1656 1652
1657 DEBUG(1, "ray_dev_close('%s')\n", dev->name); 1653 DEBUG(1, "ray_dev_close('%s')\n", dev->name);
@@ -1677,7 +1673,7 @@ static void ray_reset(struct net_device *dev) {
1677static int interrupt_ecf(ray_dev_t *local, int ccs) 1673static int interrupt_ecf(ray_dev_t *local, int ccs)
1678{ 1674{
1679 int i = 50; 1675 int i = 50;
1680 dev_link_t *link = local->finder; 1676 struct pcmcia_device *link = local->finder;
1681 1677
1682 if (!(link->state & DEV_PRESENT)) { 1678 if (!(link->state & DEV_PRESENT)) {
1683 DEBUG(2,"ray_cs interrupt_ecf - device not present\n"); 1679 DEBUG(2,"ray_cs interrupt_ecf - device not present\n");
@@ -1704,7 +1700,7 @@ static int get_free_tx_ccs(ray_dev_t *local)
1704{ 1700{
1705 int i; 1701 int i;
1706 struct ccs __iomem *pccs = ccs_base(local); 1702 struct ccs __iomem *pccs = ccs_base(local);
1707 dev_link_t *link = local->finder; 1703 struct pcmcia_device *link = local->finder;
1708 1704
1709 if (!(link->state & DEV_PRESENT)) { 1705 if (!(link->state & DEV_PRESENT)) {
1710 DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n"); 1706 DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n");
@@ -1735,7 +1731,7 @@ static int get_free_ccs(ray_dev_t *local)
1735{ 1731{
1736 int i; 1732 int i;
1737 struct ccs __iomem *pccs = ccs_base(local); 1733 struct ccs __iomem *pccs = ccs_base(local);
1738 dev_link_t *link = local->finder; 1734 struct pcmcia_device *link = local->finder;
1739 1735
1740 if (!(link->state & DEV_PRESENT)) { 1736 if (!(link->state & DEV_PRESENT)) {
1741 DEBUG(2,"ray_cs get_free_ccs - device not present\n"); 1737 DEBUG(2,"ray_cs get_free_ccs - device not present\n");
@@ -1810,7 +1806,7 @@ static int parse_addr(char *in_str, UCHAR *out)
1810static struct net_device_stats *ray_get_stats(struct net_device *dev) 1806static struct net_device_stats *ray_get_stats(struct net_device *dev)
1811{ 1807{
1812 ray_dev_t *local = (ray_dev_t *)dev->priv; 1808 ray_dev_t *local = (ray_dev_t *)dev->priv;
1813 dev_link_t *link = local->finder; 1809 struct pcmcia_device *link = local->finder;
1814 struct status __iomem *p = local->sram + STATUS_BASE; 1810 struct status __iomem *p = local->sram + STATUS_BASE;
1815 if (!(link->state & DEV_PRESENT)) { 1811 if (!(link->state & DEV_PRESENT)) {
1816 DEBUG(2,"ray_cs net_device_stats - device not present\n"); 1812 DEBUG(2,"ray_cs net_device_stats - device not present\n");
@@ -1840,7 +1836,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev)
1840static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len) 1836static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len)
1841{ 1837{
1842 ray_dev_t *local = (ray_dev_t *)dev->priv; 1838 ray_dev_t *local = (ray_dev_t *)dev->priv;
1843 dev_link_t *link = local->finder; 1839 struct pcmcia_device *link = local->finder;
1844 int ccsindex; 1840 int ccsindex;
1845 int i; 1841 int i;
1846 struct ccs __iomem *pccs; 1842 struct ccs __iomem *pccs;
@@ -1877,7 +1873,7 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1877 struct ccs __iomem *pccs; 1873 struct ccs __iomem *pccs;
1878 int i = 0; 1874 int i = 0;
1879 ray_dev_t *local = (ray_dev_t *)dev->priv; 1875 ray_dev_t *local = (ray_dev_t *)dev->priv;
1880 dev_link_t *link = local->finder; 1876 struct pcmcia_device *link = local->finder;
1881 void __iomem *p = local->sram + HOST_TO_ECF_BASE; 1877 void __iomem *p = local->sram + HOST_TO_ECF_BASE;
1882 1878
1883 if (!(link->state & DEV_PRESENT)) { 1879 if (!(link->state & DEV_PRESENT)) {
@@ -1957,7 +1953,7 @@ static void set_multicast_list(struct net_device *dev)
1957static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs) 1953static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1958{ 1954{
1959 struct net_device *dev = (struct net_device *)dev_id; 1955 struct net_device *dev = (struct net_device *)dev_id;
1960 dev_link_t *link; 1956 struct pcmcia_device *link;
1961 ray_dev_t *local; 1957 ray_dev_t *local;
1962 struct ccs __iomem *pccs; 1958 struct ccs __iomem *pccs;
1963 struct rcs __iomem *prcs; 1959 struct rcs __iomem *prcs;
@@ -1972,7 +1968,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1972 DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev); 1968 DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev);
1973 1969
1974 local = (ray_dev_t *)dev->priv; 1970 local = (ray_dev_t *)dev->priv;
1975 link = (dev_link_t *)local->finder; 1971 link = (struct pcmcia_device *)local->finder;
1976 if ( ! (link->state & DEV_PRESENT) || link->state & DEV_SUSPEND ) { 1972 if ( ! (link->state & DEV_PRESENT) || link->state & DEV_SUSPEND ) {
1977 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n"); 1973 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
1978 return IRQ_NONE; 1974 return IRQ_NONE;
@@ -2492,7 +2488,7 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem * prcs)
2492/*===========================================================================*/ 2488/*===========================================================================*/
2493static void authenticate(ray_dev_t *local) 2489static void authenticate(ray_dev_t *local)
2494{ 2490{
2495 dev_link_t *link = local->finder; 2491 struct pcmcia_device *link = local->finder;
2496 DEBUG(0,"ray_cs Starting authentication.\n"); 2492 DEBUG(0,"ray_cs Starting authentication.\n");
2497 if (!(link->state & DEV_PRESENT)) { 2493 if (!(link->state & DEV_PRESENT)) {
2498 DEBUG(2,"ray_cs authenticate - device not present\n"); 2494 DEBUG(2,"ray_cs authenticate - device not present\n");
@@ -2558,7 +2554,7 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2558static void associate(ray_dev_t *local) 2554static void associate(ray_dev_t *local)
2559{ 2555{
2560 struct ccs __iomem *pccs; 2556 struct ccs __iomem *pccs;
2561 dev_link_t *link = local->finder; 2557 struct pcmcia_device *link = local->finder;
2562 struct net_device *dev = link->priv; 2558 struct net_device *dev = link->priv;
2563 int ccsindex; 2559 int ccsindex;
2564 if (!(link->state & DEV_PRESENT)) { 2560 if (!(link->state & DEV_PRESENT)) {
@@ -2641,7 +2637,7 @@ static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len)
2641 * eg ifconfig 2637 * eg ifconfig
2642 */ 2638 */
2643 int i; 2639 int i;
2644 dev_link_t *link; 2640 struct pcmcia_device *link;
2645 struct net_device *dev; 2641 struct net_device *dev;
2646 ray_dev_t *local; 2642 ray_dev_t *local;
2647 UCHAR *p; 2643 UCHAR *p;
diff --git a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h
index 42660fe64bfd..bd73ebf03340 100644
--- a/drivers/net/wireless/ray_cs.h
+++ b/drivers/net/wireless/ray_cs.h
@@ -31,7 +31,7 @@ typedef struct ray_dev_t {
31 void __iomem *sram; /* pointer to beginning of shared RAM */ 31 void __iomem *sram; /* pointer to beginning of shared RAM */
32 void __iomem *amem; /* pointer to attribute mem window */ 32 void __iomem *amem; /* pointer to attribute mem window */
33 void __iomem *rmem; /* pointer to receive buffer window */ 33 void __iomem *rmem; /* pointer to receive buffer window */
34 dev_link_t *finder; /* pointer back to dev_link_t for card */ 34 struct pcmcia_device *finder; /* pointer back to struct pcmcia_device for card */
35 struct timer_list timer; 35 struct timer_list timer;
36 long tx_ccs_lock; 36 long tx_ccs_lock;
37 long ccs_lock; 37 long ccs_lock;
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index be36679c8c95..a75ea7e593ac 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -71,8 +71,8 @@ struct orinoco_pccard {
71/* Function prototypes */ 71/* Function prototypes */
72/********************************************************************/ 72/********************************************************************/
73 73
74static void spectrum_cs_config(dev_link_t *link); 74static void spectrum_cs_config(struct pcmcia_device *link);
75static void spectrum_cs_release(dev_link_t *link); 75static void spectrum_cs_release(struct pcmcia_device *link);
76 76
77/********************************************************************/ 77/********************************************************************/
78/* Firmware downloader */ 78/* Firmware downloader */
@@ -238,7 +238,7 @@ spectrum_aux_open(hermes_t *hw)
238 * If IDLE is 1, stop the firmware, so that it can be safely rewritten. 238 * If IDLE is 1, stop the firmware, so that it can be safely rewritten.
239 */ 239 */
240static int 240static int
241spectrum_reset(dev_link_t *link, int idle) 241spectrum_reset(struct pcmcia_device *link, int idle)
242{ 242{
243 int last_ret, last_fn; 243 int last_ret, last_fn;
244 conf_reg_t reg; 244 conf_reg_t reg;
@@ -253,7 +253,7 @@ spectrum_reset(dev_link_t *link, int idle)
253 reg.Action = CS_READ; 253 reg.Action = CS_READ;
254 reg.Offset = CISREG_COR; 254 reg.Offset = CISREG_COR;
255 CS_CHECK(AccessConfigurationRegister, 255 CS_CHECK(AccessConfigurationRegister,
256 pcmcia_access_configuration_register(link->handle, &reg)); 256 pcmcia_access_configuration_register(link, &reg));
257 save_cor = reg.Value; 257 save_cor = reg.Value;
258 258
259 /* Soft-Reset card */ 259 /* Soft-Reset card */
@@ -261,14 +261,14 @@ spectrum_reset(dev_link_t *link, int idle)
261 reg.Offset = CISREG_COR; 261 reg.Offset = CISREG_COR;
262 reg.Value = (save_cor | COR_SOFT_RESET); 262 reg.Value = (save_cor | COR_SOFT_RESET);
263 CS_CHECK(AccessConfigurationRegister, 263 CS_CHECK(AccessConfigurationRegister,
264 pcmcia_access_configuration_register(link->handle, &reg)); 264 pcmcia_access_configuration_register(link, &reg));
265 udelay(1000); 265 udelay(1000);
266 266
267 /* Read CCSR */ 267 /* Read CCSR */
268 reg.Action = CS_READ; 268 reg.Action = CS_READ;
269 reg.Offset = CISREG_CCSR; 269 reg.Offset = CISREG_CCSR;
270 CS_CHECK(AccessConfigurationRegister, 270 CS_CHECK(AccessConfigurationRegister,
271 pcmcia_access_configuration_register(link->handle, &reg)); 271 pcmcia_access_configuration_register(link, &reg));
272 272
273 /* 273 /*
274 * Start or stop the firmware. Memory width bit should be 274 * Start or stop the firmware. Memory width bit should be
@@ -278,7 +278,7 @@ spectrum_reset(dev_link_t *link, int idle)
278 reg.Offset = CISREG_CCSR; 278 reg.Offset = CISREG_CCSR;
279 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); 279 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16);
280 CS_CHECK(AccessConfigurationRegister, 280 CS_CHECK(AccessConfigurationRegister,
281 pcmcia_access_configuration_register(link->handle, &reg)); 281 pcmcia_access_configuration_register(link, &reg));
282 udelay(1000); 282 udelay(1000);
283 283
284 /* Restore original COR configuration index */ 284 /* Restore original COR configuration index */
@@ -286,12 +286,12 @@ spectrum_reset(dev_link_t *link, int idle)
286 reg.Offset = CISREG_COR; 286 reg.Offset = CISREG_COR;
287 reg.Value = (save_cor & ~COR_SOFT_RESET); 287 reg.Value = (save_cor & ~COR_SOFT_RESET);
288 CS_CHECK(AccessConfigurationRegister, 288 CS_CHECK(AccessConfigurationRegister,
289 pcmcia_access_configuration_register(link->handle, &reg)); 289 pcmcia_access_configuration_register(link, &reg));
290 udelay(1000); 290 udelay(1000);
291 return 0; 291 return 0;
292 292
293 cs_failed: 293 cs_failed:
294 cs_error(link->handle, last_fn, last_ret); 294 cs_error(link, last_fn, last_ret);
295 return -ENODEV; 295 return -ENODEV;
296} 296}
297 297
@@ -441,7 +441,7 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block)
441 * care of the PDA - read it and then write it on top of the firmware. 441 * care of the PDA - read it and then write it on top of the firmware.
442 */ 442 */
443static int 443static int
444spectrum_dl_image(hermes_t *hw, dev_link_t *link, 444spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link,
445 const unsigned char *image) 445 const unsigned char *image)
446{ 446{
447 int ret; 447 int ret;
@@ -505,14 +505,13 @@ spectrum_dl_image(hermes_t *hw, dev_link_t *link,
505 * reset on the card, to make sure it's in a sane state. 505 * reset on the card, to make sure it's in a sane state.
506 */ 506 */
507static int 507static int
508spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) 508spectrum_dl_firmware(hermes_t *hw, struct pcmcia_device *link)
509{ 509{
510 int ret; 510 int ret;
511 client_handle_t handle = link->handle;
512 const struct firmware *fw_entry; 511 const struct firmware *fw_entry;
513 512
514 if (request_firmware(&fw_entry, primary_fw_name, 513 if (request_firmware(&fw_entry, primary_fw_name,
515 &handle_to_dev(handle)) == 0) { 514 &handle_to_dev(link)) == 0) {
516 primsym = fw_entry->data; 515 primsym = fw_entry->data;
517 } else { 516 } else {
518 printk(KERN_ERR PFX "Cannot find firmware: %s\n", 517 printk(KERN_ERR PFX "Cannot find firmware: %s\n",
@@ -521,7 +520,7 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link)
521 } 520 }
522 521
523 if (request_firmware(&fw_entry, secondary_fw_name, 522 if (request_firmware(&fw_entry, secondary_fw_name,
524 &handle_to_dev(handle)) == 0) { 523 &handle_to_dev(link)) == 0) {
525 secsym = fw_entry->data; 524 secsym = fw_entry->data;
526 } else { 525 } else {
527 printk(KERN_ERR PFX "Cannot find firmware: %s\n", 526 printk(KERN_ERR PFX "Cannot find firmware: %s\n",
@@ -554,7 +553,7 @@ static int
554spectrum_cs_hard_reset(struct orinoco_private *priv) 553spectrum_cs_hard_reset(struct orinoco_private *priv)
555{ 554{
556 struct orinoco_pccard *card = priv->card; 555 struct orinoco_pccard *card = priv->card;
557 dev_link_t *link = card->p_dev; 556 struct pcmcia_device *link = card->p_dev;
558 int err; 557 int err;
559 558
560 if (!hermes_present(&priv->hw)) { 559 if (!hermes_present(&priv->hw)) {
@@ -584,12 +583,11 @@ spectrum_cs_hard_reset(struct orinoco_private *priv)
584 * configure the card at this point -- we wait until we receive a card 583 * configure the card at this point -- we wait until we receive a card
585 * insertion event. */ 584 * insertion event. */
586static int 585static int
587spectrum_cs_attach(struct pcmcia_device *p_dev) 586spectrum_cs_attach(struct pcmcia_device *link)
588{ 587{
589 struct net_device *dev; 588 struct net_device *dev;
590 struct orinoco_private *priv; 589 struct orinoco_private *priv;
591 struct orinoco_pccard *card; 590 struct orinoco_pccard *card;
592 dev_link_t *link = dev_to_instance(p_dev);
593 591
594 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); 592 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset);
595 if (! dev) 593 if (! dev)
@@ -598,7 +596,7 @@ spectrum_cs_attach(struct pcmcia_device *p_dev)
598 card = priv->card; 596 card = priv->card;
599 597
600 /* Link both structures together */ 598 /* Link both structures together */
601 card->p_dev = p_dev; 599 card->p_dev = link;
602 link->priv = dev; 600 link->priv = dev;
603 601
604 /* Interrupt setup */ 602 /* Interrupt setup */
@@ -627,9 +625,8 @@ spectrum_cs_attach(struct pcmcia_device *p_dev)
627 * are freed. Otherwise, the structures will be freed when the device 625 * are freed. Otherwise, the structures will be freed when the device
628 * is released. 626 * is released.
629 */ 627 */
630static void spectrum_cs_detach(struct pcmcia_device *p_dev) 628static void spectrum_cs_detach(struct pcmcia_device *link)
631{ 629{
632 dev_link_t *link = dev_to_instance(p_dev);
633 struct net_device *dev = link->priv; 630 struct net_device *dev = link->priv;
634 631
635 if (link->state & DEV_CONFIG) 632 if (link->state & DEV_CONFIG)
@@ -651,10 +648,9 @@ static void spectrum_cs_detach(struct pcmcia_device *p_dev)
651 */ 648 */
652 649
653static void 650static void
654spectrum_cs_config(dev_link_t *link) 651spectrum_cs_config(struct pcmcia_device *link)
655{ 652{
656 struct net_device *dev = link->priv; 653 struct net_device *dev = link->priv;
657 client_handle_t handle = link->handle;
658 struct orinoco_private *priv = netdev_priv(dev); 654 struct orinoco_private *priv = netdev_priv(dev);
659 struct orinoco_pccard *card = priv->card; 655 struct orinoco_pccard *card = priv->card;
660 hermes_t *hw = &priv->hw; 656 hermes_t *hw = &priv->hw;
@@ -666,7 +662,7 @@ spectrum_cs_config(dev_link_t *link)
666 cisparse_t parse; 662 cisparse_t parse;
667 void __iomem *mem; 663 void __iomem *mem;
668 664
669 CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info)); 665 CS_CHECK(ValidateCIS, pcmcia_validate_cis(link, &info));
670 666
671 /* 667 /*
672 * This reads the card's CONFIG tuple to find its 668 * This reads the card's CONFIG tuple to find its
@@ -677,9 +673,9 @@ spectrum_cs_config(dev_link_t *link)
677 tuple.TupleData = buf; 673 tuple.TupleData = buf;
678 tuple.TupleDataMax = sizeof(buf); 674 tuple.TupleDataMax = sizeof(buf);
679 tuple.TupleOffset = 0; 675 tuple.TupleOffset = 0;
680 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 676 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
681 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 677 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
682 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 678 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
683 link->conf.ConfigBase = parse.config.base; 679 link->conf.ConfigBase = parse.config.base;
684 link->conf.Present = parse.config.rmask[0]; 680 link->conf.Present = parse.config.rmask[0];
685 681
@@ -688,7 +684,7 @@ spectrum_cs_config(dev_link_t *link)
688 684
689 /* Look up the current Vcc */ 685 /* Look up the current Vcc */
690 CS_CHECK(GetConfigurationInfo, 686 CS_CHECK(GetConfigurationInfo,
691 pcmcia_get_configuration_info(handle, &conf)); 687 pcmcia_get_configuration_info(link, &conf));
692 688
693 /* 689 /*
694 * In this loop, we scan the CIS for configuration table 690 * In this loop, we scan the CIS for configuration table
@@ -705,13 +701,13 @@ spectrum_cs_config(dev_link_t *link)
705 * implementation-defined details. 701 * implementation-defined details.
706 */ 702 */
707 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 703 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
708 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 704 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
709 while (1) { 705 while (1) {
710 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 706 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
711 cistpl_cftable_entry_t dflt = { .index = 0 }; 707 cistpl_cftable_entry_t dflt = { .index = 0 };
712 708
713 if ( (pcmcia_get_tuple_data(handle, &tuple) != 0) 709 if ( (pcmcia_get_tuple_data(link, &tuple) != 0)
714 || (pcmcia_parse_tuple(handle, &tuple, &parse) != 0)) 710 || (pcmcia_parse_tuple(link, &tuple, &parse) != 0))
715 goto next_entry; 711 goto next_entry;
716 712
717 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 713 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
@@ -776,7 +772,7 @@ spectrum_cs_config(dev_link_t *link)
776 } 772 }
777 773
778 /* This reserves IO space but doesn't actually enable it */ 774 /* This reserves IO space but doesn't actually enable it */
779 if (pcmcia_request_io(link->handle, &link->io) != 0) 775 if (pcmcia_request_io(link, &link->io) != 0)
780 goto next_entry; 776 goto next_entry;
781 } 777 }
782 778
@@ -786,8 +782,8 @@ spectrum_cs_config(dev_link_t *link)
786 break; 782 break;
787 783
788 next_entry: 784 next_entry:
789 pcmcia_disable_device(handle); 785 pcmcia_disable_device(link);
790 last_ret = pcmcia_get_next_tuple(handle, &tuple); 786 last_ret = pcmcia_get_next_tuple(link, &tuple);
791 if (last_ret == CS_NO_MORE_ITEMS) { 787 if (last_ret == CS_NO_MORE_ITEMS) {
792 printk(KERN_ERR PFX "GetNextTuple(): No matching " 788 printk(KERN_ERR PFX "GetNextTuple(): No matching "
793 "CIS configuration. Maybe you need the " 789 "CIS configuration. Maybe you need the "
@@ -801,7 +797,7 @@ spectrum_cs_config(dev_link_t *link)
801 * a handler to the interrupt, unless the 'Handler' member of 797 * a handler to the interrupt, unless the 'Handler' member of
802 * the irq structure is initialized. 798 * the irq structure is initialized.
803 */ 799 */
804 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 800 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
805 801
806 /* We initialize the hermes structure before completing PCMCIA 802 /* We initialize the hermes structure before completing PCMCIA
807 * configuration just in case the interrupt handler gets 803 * configuration just in case the interrupt handler gets
@@ -818,7 +814,7 @@ spectrum_cs_config(dev_link_t *link)
818 * card and host interface into "Memory and IO" mode. 814 * card and host interface into "Memory and IO" mode.
819 */ 815 */
820 CS_CHECK(RequestConfiguration, 816 CS_CHECK(RequestConfiguration,
821 pcmcia_request_configuration(link->handle, &link->conf)); 817 pcmcia_request_configuration(link, &link->conf));
822 818
823 /* Ok, we have the configuration, prepare to register the netdev */ 819 /* Ok, we have the configuration, prepare to register the netdev */
824 dev->base_addr = link->io.BasePort1; 820 dev->base_addr = link->io.BasePort1;
@@ -831,7 +827,7 @@ spectrum_cs_config(dev_link_t *link)
831 goto failed; 827 goto failed;
832 } 828 }
833 829
834 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 830 SET_NETDEV_DEV(dev, &handle_to_dev(link));
835 /* Tell the stack we exist */ 831 /* Tell the stack we exist */
836 if (register_netdev(dev) != 0) { 832 if (register_netdev(dev) != 0) {
837 printk(KERN_ERR PFX "register_netdev() failed\n"); 833 printk(KERN_ERR PFX "register_netdev() failed\n");
@@ -864,7 +860,7 @@ spectrum_cs_config(dev_link_t *link)
864 return; 860 return;
865 861
866 cs_failed: 862 cs_failed:
867 cs_error(link->handle, last_fn, last_ret); 863 cs_error(link, last_fn, last_ret);
868 864
869 failed: 865 failed:
870 spectrum_cs_release(link); 866 spectrum_cs_release(link);
@@ -876,7 +872,7 @@ spectrum_cs_config(dev_link_t *link)
876 * still open, this will be postponed until it is closed. 872 * still open, this will be postponed until it is closed.
877 */ 873 */
878static void 874static void
879spectrum_cs_release(dev_link_t *link) 875spectrum_cs_release(struct pcmcia_device *link)
880{ 876{
881 struct net_device *dev = link->priv; 877 struct net_device *dev = link->priv;
882 struct orinoco_private *priv = netdev_priv(dev); 878 struct orinoco_private *priv = netdev_priv(dev);
@@ -888,16 +884,15 @@ spectrum_cs_release(dev_link_t *link)
888 priv->hw_unavailable++; 884 priv->hw_unavailable++;
889 spin_unlock_irqrestore(&priv->lock, flags); 885 spin_unlock_irqrestore(&priv->lock, flags);
890 886
891 pcmcia_disable_device(link->handle); 887 pcmcia_disable_device(link);
892 if (priv->hw.iobase) 888 if (priv->hw.iobase)
893 ioport_unmap(priv->hw.iobase); 889 ioport_unmap(priv->hw.iobase);
894} /* spectrum_cs_release */ 890} /* spectrum_cs_release */
895 891
896 892
897static int 893static int
898spectrum_cs_suspend(struct pcmcia_device *p_dev) 894spectrum_cs_suspend(struct pcmcia_device *link)
899{ 895{
900 dev_link_t *link = dev_to_instance(p_dev);
901 struct net_device *dev = link->priv; 896 struct net_device *dev = link->priv;
902 struct orinoco_private *priv = netdev_priv(dev); 897 struct orinoco_private *priv = netdev_priv(dev);
903 unsigned long flags; 898 unsigned long flags;
@@ -922,9 +917,8 @@ spectrum_cs_suspend(struct pcmcia_device *p_dev)
922} 917}
923 918
924static int 919static int
925spectrum_cs_resume(struct pcmcia_device *p_dev) 920spectrum_cs_resume(struct pcmcia_device *link)
926{ 921{
927 dev_link_t *link = dev_to_instance(p_dev);
928 struct net_device *dev = link->priv; 922 struct net_device *dev = link->priv;
929 struct orinoco_private *priv = netdev_priv(dev); 923 struct orinoco_private *priv = netdev_priv(dev);
930 924
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index baa1011e70e0..352d4a50b799 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -1005,7 +1005,7 @@ static inline void
1005wv_82593_reconfig(struct net_device * dev) 1005wv_82593_reconfig(struct net_device * dev)
1006{ 1006{
1007 net_local * lp = netdev_priv(dev); 1007 net_local * lp = netdev_priv(dev);
1008 dev_link_t * link = lp->link; 1008 struct pcmcia_device * link = lp->link;
1009 unsigned long flags; 1009 unsigned long flags;
1010 1010
1011 /* Arm the flag, will be cleard in wv_82593_config() */ 1011 /* Arm the flag, will be cleard in wv_82593_config() */
@@ -3744,16 +3744,16 @@ wv_pcmcia_reset(struct net_device * dev)
3744{ 3744{
3745 int i; 3745 int i;
3746 conf_reg_t reg = { 0, CS_READ, CISREG_COR, 0 }; 3746 conf_reg_t reg = { 0, CS_READ, CISREG_COR, 0 };
3747 dev_link_t * link = ((net_local *)netdev_priv(dev))->link; 3747 struct pcmcia_device * link = ((net_local *)netdev_priv(dev))->link;
3748 3748
3749#ifdef DEBUG_CONFIG_TRACE 3749#ifdef DEBUG_CONFIG_TRACE
3750 printk(KERN_DEBUG "%s: ->wv_pcmcia_reset()\n", dev->name); 3750 printk(KERN_DEBUG "%s: ->wv_pcmcia_reset()\n", dev->name);
3751#endif 3751#endif
3752 3752
3753 i = pcmcia_access_configuration_register(link->handle, &reg); 3753 i = pcmcia_access_configuration_register(link, &reg);
3754 if(i != CS_SUCCESS) 3754 if(i != CS_SUCCESS)
3755 { 3755 {
3756 cs_error(link->handle, AccessConfigurationRegister, i); 3756 cs_error(link, AccessConfigurationRegister, i);
3757 return FALSE; 3757 return FALSE;
3758 } 3758 }
3759 3759
@@ -3764,19 +3764,19 @@ wv_pcmcia_reset(struct net_device * dev)
3764 3764
3765 reg.Action = CS_WRITE; 3765 reg.Action = CS_WRITE;
3766 reg.Value = reg.Value | COR_SW_RESET; 3766 reg.Value = reg.Value | COR_SW_RESET;
3767 i = pcmcia_access_configuration_register(link->handle, &reg); 3767 i = pcmcia_access_configuration_register(link, &reg);
3768 if(i != CS_SUCCESS) 3768 if(i != CS_SUCCESS)
3769 { 3769 {
3770 cs_error(link->handle, AccessConfigurationRegister, i); 3770 cs_error(link, AccessConfigurationRegister, i);
3771 return FALSE; 3771 return FALSE;
3772 } 3772 }
3773 3773
3774 reg.Action = CS_WRITE; 3774 reg.Action = CS_WRITE;
3775 reg.Value = COR_LEVEL_IRQ | COR_CONFIG; 3775 reg.Value = COR_LEVEL_IRQ | COR_CONFIG;
3776 i = pcmcia_access_configuration_register(link->handle, &reg); 3776 i = pcmcia_access_configuration_register(link, &reg);
3777 if(i != CS_SUCCESS) 3777 if(i != CS_SUCCESS)
3778 { 3778 {
3779 cs_error(link->handle, AccessConfigurationRegister, i); 3779 cs_error(link, AccessConfigurationRegister, i);
3780 return FALSE; 3780 return FALSE;
3781 } 3781 }
3782 3782
@@ -3940,9 +3940,8 @@ wv_hw_reset(struct net_device * dev)
3940 * (called by wavelan_event()) 3940 * (called by wavelan_event())
3941 */ 3941 */
3942static inline int 3942static inline int
3943wv_pcmcia_config(dev_link_t * link) 3943wv_pcmcia_config(struct pcmcia_device * link)
3944{ 3944{
3945 client_handle_t handle = link->handle;
3946 tuple_t tuple; 3945 tuple_t tuple;
3947 cisparse_t parse; 3946 cisparse_t parse;
3948 struct net_device * dev = (struct net_device *) link->priv; 3947 struct net_device * dev = (struct net_device *) link->priv;
@@ -3965,16 +3964,16 @@ wv_pcmcia_config(dev_link_t * link)
3965 { 3964 {
3966 tuple.Attributes = 0; 3965 tuple.Attributes = 0;
3967 tuple.DesiredTuple = CISTPL_CONFIG; 3966 tuple.DesiredTuple = CISTPL_CONFIG;
3968 i = pcmcia_get_first_tuple(handle, &tuple); 3967 i = pcmcia_get_first_tuple(link, &tuple);
3969 if(i != CS_SUCCESS) 3968 if(i != CS_SUCCESS)
3970 break; 3969 break;
3971 tuple.TupleData = (cisdata_t *)buf; 3970 tuple.TupleData = (cisdata_t *)buf;
3972 tuple.TupleDataMax = 64; 3971 tuple.TupleDataMax = 64;
3973 tuple.TupleOffset = 0; 3972 tuple.TupleOffset = 0;
3974 i = pcmcia_get_tuple_data(handle, &tuple); 3973 i = pcmcia_get_tuple_data(link, &tuple);
3975 if(i != CS_SUCCESS) 3974 if(i != CS_SUCCESS)
3976 break; 3975 break;
3977 i = pcmcia_parse_tuple(handle, &tuple, &parse); 3976 i = pcmcia_parse_tuple(link, &tuple, &parse);
3978 if(i != CS_SUCCESS) 3977 if(i != CS_SUCCESS)
3979 break; 3978 break;
3980 link->conf.ConfigBase = parse.config.base; 3979 link->conf.ConfigBase = parse.config.base;
@@ -3983,7 +3982,7 @@ wv_pcmcia_config(dev_link_t * link)
3983 while(0); 3982 while(0);
3984 if(i != CS_SUCCESS) 3983 if(i != CS_SUCCESS)
3985 { 3984 {
3986 cs_error(link->handle, ParseTuple, i); 3985 cs_error(link, ParseTuple, i);
3987 link->state &= ~DEV_CONFIG_PENDING; 3986 link->state &= ~DEV_CONFIG_PENDING;
3988 return FALSE; 3987 return FALSE;
3989 } 3988 }
@@ -3992,10 +3991,10 @@ wv_pcmcia_config(dev_link_t * link)
3992 link->state |= DEV_CONFIG; 3991 link->state |= DEV_CONFIG;
3993 do 3992 do
3994 { 3993 {
3995 i = pcmcia_request_io(link->handle, &link->io); 3994 i = pcmcia_request_io(link, &link->io);
3996 if(i != CS_SUCCESS) 3995 if(i != CS_SUCCESS)
3997 { 3996 {
3998 cs_error(link->handle, RequestIO, i); 3997 cs_error(link, RequestIO, i);
3999 break; 3998 break;
4000 } 3999 }
4001 4000
@@ -4003,10 +4002,10 @@ wv_pcmcia_config(dev_link_t * link)
4003 * Now allocate an interrupt line. Note that this does not 4002 * Now allocate an interrupt line. Note that this does not
4004 * actually assign a handler to the interrupt. 4003 * actually assign a handler to the interrupt.
4005 */ 4004 */
4006 i = pcmcia_request_irq(link->handle, &link->irq); 4005 i = pcmcia_request_irq(link, &link->irq);
4007 if(i != CS_SUCCESS) 4006 if(i != CS_SUCCESS)
4008 { 4007 {
4009 cs_error(link->handle, RequestIRQ, i); 4008 cs_error(link, RequestIRQ, i);
4010 break; 4009 break;
4011 } 4010 }
4012 4011
@@ -4015,15 +4014,15 @@ wv_pcmcia_config(dev_link_t * link)
4015 * the I/O windows and the interrupt mapping. 4014 * the I/O windows and the interrupt mapping.
4016 */ 4015 */
4017 link->conf.ConfigIndex = 1; 4016 link->conf.ConfigIndex = 1;
4018 i = pcmcia_request_configuration(link->handle, &link->conf); 4017 i = pcmcia_request_configuration(link, &link->conf);
4019 if(i != CS_SUCCESS) 4018 if(i != CS_SUCCESS)
4020 { 4019 {
4021 cs_error(link->handle, RequestConfiguration, i); 4020 cs_error(link, RequestConfiguration, i);
4022 break; 4021 break;
4023 } 4022 }
4024 4023
4025 /* 4024 /*
4026 * Allocate a small memory window. Note that the dev_link_t 4025 * Allocate a small memory window. Note that the struct pcmcia_device
4027 * structure provides space for one window handle -- if your 4026 * structure provides space for one window handle -- if your
4028 * device needs several windows, you'll need to keep track of 4027 * device needs several windows, you'll need to keep track of
4029 * the handles in your private data structure, link->priv. 4028 * the handles in your private data structure, link->priv.
@@ -4031,10 +4030,10 @@ wv_pcmcia_config(dev_link_t * link)
4031 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 4030 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
4032 req.Base = req.Size = 0; 4031 req.Base = req.Size = 0;
4033 req.AccessSpeed = mem_speed; 4032 req.AccessSpeed = mem_speed;
4034 i = pcmcia_request_window(&link->handle, &req, &link->win); 4033 i = pcmcia_request_window(&link, &req, &link->win);
4035 if(i != CS_SUCCESS) 4034 if(i != CS_SUCCESS)
4036 { 4035 {
4037 cs_error(link->handle, RequestWindow, i); 4036 cs_error(link, RequestWindow, i);
4038 break; 4037 break;
4039 } 4038 }
4040 4039
@@ -4046,7 +4045,7 @@ wv_pcmcia_config(dev_link_t * link)
4046 i = pcmcia_map_mem_page(link->win, &mem); 4045 i = pcmcia_map_mem_page(link->win, &mem);
4047 if(i != CS_SUCCESS) 4046 if(i != CS_SUCCESS)
4048 { 4047 {
4049 cs_error(link->handle, MapMemPage, i); 4048 cs_error(link, MapMemPage, i);
4050 break; 4049 break;
4051 } 4050 }
4052 4051
@@ -4060,7 +4059,7 @@ wv_pcmcia_config(dev_link_t * link)
4060 lp->mem, dev->irq, (u_int) dev->base_addr); 4059 lp->mem, dev->irq, (u_int) dev->base_addr);
4061#endif 4060#endif
4062 4061
4063 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 4062 SET_NETDEV_DEV(dev, &handle_to_dev(link));
4064 i = register_netdev(dev); 4063 i = register_netdev(dev);
4065 if(i != 0) 4064 if(i != 0)
4066 { 4065 {
@@ -4096,7 +4095,7 @@ wv_pcmcia_config(dev_link_t * link)
4096 * still open, this will be postponed until it is closed. 4095 * still open, this will be postponed until it is closed.
4097 */ 4096 */
4098static void 4097static void
4099wv_pcmcia_release(dev_link_t *link) 4098wv_pcmcia_release(struct pcmcia_device *link)
4100{ 4099{
4101 struct net_device * dev = (struct net_device *) link->priv; 4100 struct net_device * dev = (struct net_device *) link->priv;
4102 net_local * lp = netdev_priv(dev); 4101 net_local * lp = netdev_priv(dev);
@@ -4106,7 +4105,7 @@ wv_pcmcia_release(dev_link_t *link)
4106#endif 4105#endif
4107 4106
4108 iounmap(lp->mem); 4107 iounmap(lp->mem);
4109 pcmcia_disable_device(link->handle); 4108 pcmcia_disable_device(link);
4110 4109
4111#ifdef DEBUG_CONFIG_TRACE 4110#ifdef DEBUG_CONFIG_TRACE
4112 printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name); 4111 printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
@@ -4473,7 +4472,7 @@ static int
4473wavelan_open(struct net_device * dev) 4472wavelan_open(struct net_device * dev)
4474{ 4473{
4475 net_local * lp = netdev_priv(dev); 4474 net_local * lp = netdev_priv(dev);
4476 dev_link_t * link = lp->link; 4475 struct pcmcia_device * link = lp->link;
4477 kio_addr_t base = dev->base_addr; 4476 kio_addr_t base = dev->base_addr;
4478 4477
4479#ifdef DEBUG_CALLBACK_TRACE 4478#ifdef DEBUG_CALLBACK_TRACE
@@ -4527,7 +4526,7 @@ wavelan_open(struct net_device * dev)
4527static int 4526static int
4528wavelan_close(struct net_device * dev) 4527wavelan_close(struct net_device * dev)
4529{ 4528{
4530 dev_link_t * link = ((net_local *)netdev_priv(dev))->link; 4529 struct pcmcia_device * link = ((net_local *)netdev_priv(dev))->link;
4531 kio_addr_t base = dev->base_addr; 4530 kio_addr_t base = dev->base_addr;
4532 4531
4533#ifdef DEBUG_CALLBACK_TRACE 4532#ifdef DEBUG_CALLBACK_TRACE
@@ -4673,10 +4672,8 @@ wavelan_attach(struct pcmcia_device *p_dev)
4673 * is released. 4672 * is released.
4674 */ 4673 */
4675static void 4674static void
4676wavelan_detach(struct pcmcia_device *p_dev) 4675wavelan_detach(struct pcmcia_device *link)
4677{ 4676{
4678 dev_link_t *link = dev_to_instance(p_dev);
4679
4680#ifdef DEBUG_CALLBACK_TRACE 4677#ifdef DEBUG_CALLBACK_TRACE
4681 printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); 4678 printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link);
4682#endif 4679#endif
@@ -4713,9 +4710,8 @@ wavelan_detach(struct pcmcia_device *p_dev)
4713#endif 4710#endif
4714} 4711}
4715 4712
4716static int wavelan_suspend(struct pcmcia_device *p_dev) 4713static int wavelan_suspend(struct pcmcia_device *link)
4717{ 4714{
4718 dev_link_t *link = dev_to_instance(p_dev);
4719 struct net_device * dev = (struct net_device *) link->priv; 4715 struct net_device * dev = (struct net_device *) link->priv;
4720 4716
4721 /* NB: wavelan_close will be called, but too late, so we are 4717 /* NB: wavelan_close will be called, but too late, so we are
@@ -4736,9 +4732,8 @@ static int wavelan_suspend(struct pcmcia_device *p_dev)
4736 return 0; 4732 return 0;
4737} 4733}
4738 4734
4739static int wavelan_resume(struct pcmcia_device *p_dev) 4735static int wavelan_resume(struct pcmcia_device *link)
4740{ 4736{
4741 dev_link_t *link = dev_to_instance(p_dev);
4742 struct net_device * dev = (struct net_device *) link->priv; 4737 struct net_device * dev = (struct net_device *) link->priv;
4743 4738
4744 link->state &= ~DEV_SUSPEND; 4739 link->state &= ~DEV_SUSPEND;
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index 451f6271dcbc..c65fe7a391ec 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -602,7 +602,7 @@ struct net_local
602 dev_node_t node; /* ???? What is this stuff ???? */ 602 dev_node_t node; /* ???? What is this stuff ???? */
603 struct net_device * dev; /* Reverse link... */ 603 struct net_device * dev; /* Reverse link... */
604 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ 604 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
605 dev_link_t * link; /* pcmcia structure */ 605 struct pcmcia_device * link; /* pcmcia structure */
606 en_stats stats; /* Ethernet interface statistics */ 606 en_stats stats; /* Ethernet interface statistics */
607 int nresets; /* Number of hw resets */ 607 int nresets; /* Number of hw resets */
608 u_char configured; /* If it is configured */ 608 u_char configured; /* If it is configured */
@@ -733,9 +733,9 @@ static int
733static inline void 733static inline void
734 wv_hw_reset(struct net_device *); /* Same, + start receiver unit */ 734 wv_hw_reset(struct net_device *); /* Same, + start receiver unit */
735static inline int 735static inline int
736 wv_pcmcia_config(dev_link_t *); /* Configure the pcmcia interface */ 736 wv_pcmcia_config(struct pcmcia_device *); /* Configure the pcmcia interface */
737static void 737static void
738 wv_pcmcia_release(dev_link_t *);/* Remove a device */ 738 wv_pcmcia_release(struct pcmcia_device *);/* Remove a device */
739/* ---------------------- INTERRUPT HANDLING ---------------------- */ 739/* ---------------------- INTERRUPT HANDLING ---------------------- */
740static irqreturn_t 740static irqreturn_t
741 wavelan_interrupt(int, /* Interrupt handler */ 741 wavelan_interrupt(int, /* Interrupt handler */
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 4b054f54e9d5..752d22260080 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -103,8 +103,8 @@ module_param(pc_debug, int, 0);
103 * release a socket, in response to card insertion and ejection events. They 103 * release a socket, in response to card insertion and ejection events. They
104 * are invoked from the wl24 event handler. 104 * are invoked from the wl24 event handler.
105 */ 105 */
106static void wl3501_config(dev_link_t *link); 106static void wl3501_config(struct pcmcia_device *link);
107static void wl3501_release(dev_link_t *link); 107static void wl3501_release(struct pcmcia_device *link);
108 108
109/* 109/*
110 * The dev_info variable is the "key" that is used to match up this 110 * The dev_info variable is the "key" that is used to match up this
@@ -1270,7 +1270,7 @@ static int wl3501_close(struct net_device *dev)
1270 struct wl3501_card *this = dev->priv; 1270 struct wl3501_card *this = dev->priv;
1271 int rc = -ENODEV; 1271 int rc = -ENODEV;
1272 unsigned long flags; 1272 unsigned long flags;
1273 dev_link_t *link; 1273 struct pcmcia_device *link;
1274 link = this->p_dev; 1274 link = this->p_dev;
1275 1275
1276 spin_lock_irqsave(&this->lock, flags); 1276 spin_lock_irqsave(&this->lock, flags);
@@ -1383,7 +1383,7 @@ static int wl3501_open(struct net_device *dev)
1383 int rc = -ENODEV; 1383 int rc = -ENODEV;
1384 struct wl3501_card *this = dev->priv; 1384 struct wl3501_card *this = dev->priv;
1385 unsigned long flags; 1385 unsigned long flags;
1386 dev_link_t *link; 1386 struct pcmcia_device *link;
1387 link = this->p_dev; 1387 link = this->p_dev;
1388 1388
1389 spin_lock_irqsave(&this->lock, flags); 1389 spin_lock_irqsave(&this->lock, flags);
@@ -1477,9 +1477,8 @@ static struct ethtool_ops ops = {
1477 * Services. If it has been released, all local data structures are freed. 1477 * Services. If it has been released, all local data structures are freed.
1478 * Otherwise, the structures will be freed when the device is released. 1478 * Otherwise, the structures will be freed when the device is released.
1479 */ 1479 */
1480static void wl3501_detach(struct pcmcia_device *p_dev) 1480static void wl3501_detach(struct pcmcia_device *link)
1481{ 1481{
1482 dev_link_t *link = dev_to_instance(p_dev);
1483 struct net_device *dev = link->priv; 1482 struct net_device *dev = link->priv;
1484 1483
1485 /* If the device is currently configured and active, we won't actually 1484 /* If the device is currently configured and active, we won't actually
@@ -1925,23 +1924,22 @@ static int wl3501_attach(struct pcmcia_device *p_dev)
1925{ 1924{
1926 struct net_device *dev; 1925 struct net_device *dev;
1927 struct wl3501_card *this; 1926 struct wl3501_card *this;
1928 dev_link_t *link = dev_to_instance(p_dev);
1929 1927
1930 /* The io structure describes IO port mapping */ 1928 /* The io structure describes IO port mapping */
1931 link->io.NumPorts1 = 16; 1929 p_dev->io.NumPorts1 = 16;
1932 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1930 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
1933 link->io.IOAddrLines = 5; 1931 p_dev->io.IOAddrLines = 5;
1934 1932
1935 /* Interrupt setup */ 1933 /* Interrupt setup */
1936 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 1934 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
1937 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 1935 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
1938 link->irq.Handler = wl3501_interrupt; 1936 p_dev->irq.Handler = wl3501_interrupt;
1939 1937
1940 /* General socket configuration */ 1938 /* General socket configuration */
1941 link->conf.Attributes = CONF_ENABLE_IRQ; 1939 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
1942 link->conf.IntType = INT_MEMORY_AND_IO; 1940 p_dev->conf.IntType = INT_MEMORY_AND_IO;
1943 link->conf.ConfigIndex = 1; 1941 p_dev->conf.ConfigIndex = 1;
1944 link->conf.Present = PRESENT_OPTION; 1942 p_dev->conf.Present = PRESENT_OPTION;
1945 1943
1946 dev = alloc_etherdev(sizeof(struct wl3501_card)); 1944 dev = alloc_etherdev(sizeof(struct wl3501_card));
1947 if (!dev) 1945 if (!dev)
@@ -1959,9 +1957,9 @@ static int wl3501_attach(struct pcmcia_device *p_dev)
1959 dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; 1957 dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def;
1960 SET_ETHTOOL_OPS(dev, &ops); 1958 SET_ETHTOOL_OPS(dev, &ops);
1961 netif_stop_queue(dev); 1959 netif_stop_queue(dev);
1962 link->priv = link->irq.Instance = dev; 1960 p_dev->priv = p_dev->irq.Instance = dev;
1963 1961
1964 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1962 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1965 wl3501_config(p_dev); 1963 wl3501_config(p_dev);
1966 1964
1967 return 0; 1965 return 0;
@@ -1980,11 +1978,10 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
1980 * received, to configure the PCMCIA socket, and to make the ethernet device 1978 * received, to configure the PCMCIA socket, and to make the ethernet device
1981 * available to the system. 1979 * available to the system.
1982 */ 1980 */
1983static void wl3501_config(dev_link_t *link) 1981static void wl3501_config(struct pcmcia_device *link)
1984{ 1982{
1985 tuple_t tuple; 1983 tuple_t tuple;
1986 cisparse_t parse; 1984 cisparse_t parse;
1987 client_handle_t handle = link->handle;
1988 struct net_device *dev = link->priv; 1985 struct net_device *dev = link->priv;
1989 int i = 0, j, last_fn, last_ret; 1986 int i = 0, j, last_fn, last_ret;
1990 unsigned char bf[64]; 1987 unsigned char bf[64];
@@ -1993,12 +1990,12 @@ static void wl3501_config(dev_link_t *link)
1993 /* This reads the card's CONFIG tuple to find its config registers. */ 1990 /* This reads the card's CONFIG tuple to find its config registers. */
1994 tuple.Attributes = 0; 1991 tuple.Attributes = 0;
1995 tuple.DesiredTuple = CISTPL_CONFIG; 1992 tuple.DesiredTuple = CISTPL_CONFIG;
1996 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 1993 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
1997 tuple.TupleData = bf; 1994 tuple.TupleData = bf;
1998 tuple.TupleDataMax = sizeof(bf); 1995 tuple.TupleDataMax = sizeof(bf);
1999 tuple.TupleOffset = 0; 1996 tuple.TupleOffset = 0;
2000 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 1997 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
2001 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 1998 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
2002 link->conf.ConfigBase = parse.config.base; 1999 link->conf.ConfigBase = parse.config.base;
2003 link->conf.Present = parse.config.rmask[0]; 2000 link->conf.Present = parse.config.rmask[0];
2004 2001
@@ -2014,28 +2011,28 @@ static void wl3501_config(dev_link_t *link)
2014 * 0x200-0x2ff, and so on, because this seems safer */ 2011 * 0x200-0x2ff, and so on, because this seems safer */
2015 link->io.BasePort1 = j; 2012 link->io.BasePort1 = j;
2016 link->io.BasePort2 = link->io.BasePort1 + 0x10; 2013 link->io.BasePort2 = link->io.BasePort1 + 0x10;
2017 i = pcmcia_request_io(link->handle, &link->io); 2014 i = pcmcia_request_io(link, &link->io);
2018 if (i == CS_SUCCESS) 2015 if (i == CS_SUCCESS)
2019 break; 2016 break;
2020 } 2017 }
2021 if (i != CS_SUCCESS) { 2018 if (i != CS_SUCCESS) {
2022 cs_error(link->handle, RequestIO, i); 2019 cs_error(link, RequestIO, i);
2023 goto failed; 2020 goto failed;
2024 } 2021 }
2025 2022
2026 /* Now allocate an interrupt line. Note that this does not actually 2023 /* Now allocate an interrupt line. Note that this does not actually
2027 * assign a handler to the interrupt. */ 2024 * assign a handler to the interrupt. */
2028 2025
2029 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 2026 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
2030 2027
2031 /* This actually configures the PCMCIA socket -- setting up the I/O 2028 /* This actually configures the PCMCIA socket -- setting up the I/O
2032 * windows and the interrupt mapping. */ 2029 * windows and the interrupt mapping. */
2033 2030
2034 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); 2031 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
2035 2032
2036 dev->irq = link->irq.AssignedIRQ; 2033 dev->irq = link->irq.AssignedIRQ;
2037 dev->base_addr = link->io.BasePort1; 2034 dev->base_addr = link->io.BasePort1;
2038 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 2035 SET_NETDEV_DEV(dev, &handle_to_dev(link));
2039 if (register_netdev(dev)) { 2036 if (register_netdev(dev)) {
2040 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); 2037 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n");
2041 goto failed; 2038 goto failed;
@@ -2087,7 +2084,7 @@ static void wl3501_config(dev_link_t *link)
2087 netif_start_queue(dev); 2084 netif_start_queue(dev);
2088 goto out; 2085 goto out;
2089cs_failed: 2086cs_failed:
2090 cs_error(link->handle, last_fn, last_ret); 2087 cs_error(link, last_fn, last_ret);
2091failed: 2088failed:
2092 wl3501_release(link); 2089 wl3501_release(link);
2093out: 2090out:
@@ -2102,7 +2099,7 @@ out:
2102 * and release the PCMCIA configuration. If the device is still open, this 2099 * and release the PCMCIA configuration. If the device is still open, this
2103 * will be postponed until it is closed. 2100 * will be postponed until it is closed.
2104 */ 2101 */
2105static void wl3501_release(dev_link_t *link) 2102static void wl3501_release(struct pcmcia_device *link)
2106{ 2103{
2107 struct net_device *dev = link->priv; 2104 struct net_device *dev = link->priv;
2108 2105
@@ -2110,12 +2107,11 @@ static void wl3501_release(dev_link_t *link)
2110 if (link->dev_node) 2107 if (link->dev_node)
2111 unregister_netdev(dev); 2108 unregister_netdev(dev);
2112 2109
2113 pcmcia_disable_device(link->handle); 2110 pcmcia_disable_device(link);
2114} 2111}
2115 2112
2116static int wl3501_suspend(struct pcmcia_device *p_dev) 2113static int wl3501_suspend(struct pcmcia_device *link)
2117{ 2114{
2118 dev_link_t *link = dev_to_instance(p_dev);
2119 struct net_device *dev = link->priv; 2115 struct net_device *dev = link->priv;
2120 2116
2121 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); 2117 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND);
@@ -2125,9 +2121,8 @@ static int wl3501_suspend(struct pcmcia_device *p_dev)
2125 return 0; 2121 return 0;
2126} 2122}
2127 2123
2128static int wl3501_resume(struct pcmcia_device *p_dev) 2124static int wl3501_resume(struct pcmcia_device *link)
2129{ 2125{
2130 dev_link_t *link = dev_to_instance(p_dev);
2131 struct net_device *dev = link->priv; 2126 struct net_device *dev = link->priv;
2132 2127
2133 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); 2128 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME);