aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/fmvj18x_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
commitfba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch)
tree5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/net/pcmcia/fmvj18x_cs.c
parentfd238232cd0ff4840ae6946bb338502154096d88 (diff)
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia/fmvj18x_cs.c')
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c97
1 files changed, 46 insertions, 51 deletions
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);