diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-10-18 17:54:24 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-11-08 12:23:05 -0500 |
commit | dddfbd824b96a25da0b2f1cf35c0be33ef2422fe (patch) | |
tree | 0f48f2883bd00ec5f15d8d32a3c826a3184f47ba /drivers/net/pcmcia/fmvj18x_cs.c | |
parent | 91284224da5b15ec6c2b45e10fa5eccd1c92a204 (diff) |
pcmcia: convert net pcmcia drivers to use new CIS helpers
Use the new CIS helpers in net pcmcia drivers, which allows for
a few code cleanups.
This revision does not remove the phys_addr assignment in
3c589_cs.c -- a bug noted by Komuro <komurojun-mbn@nifty.com>
CC: David S. Miller <davem@davemloft.net>
CC: netdev@vger.kernel.org
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.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index c7a2bbfaf821..5b73b11411c8 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -350,32 +350,29 @@ static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, | |||
350 | return 0; /* strange, but that's what the code did already before... */ | 350 | return 0; /* strange, but that's what the code did already before... */ |
351 | } | 351 | } |
352 | 352 | ||
353 | |||
354 | static int fmvj18x_config(struct pcmcia_device *link) | 353 | static int fmvj18x_config(struct pcmcia_device *link) |
355 | { | 354 | { |
356 | struct net_device *dev = link->priv; | 355 | struct net_device *dev = link->priv; |
357 | local_info_t *lp = netdev_priv(dev); | 356 | local_info_t *lp = netdev_priv(dev); |
358 | tuple_t tuple; | ||
359 | u_short buf[32]; | ||
360 | int i, last_fn = RequestIO, last_ret = 0, ret; | 357 | int i, last_fn = RequestIO, last_ret = 0, ret; |
361 | unsigned int ioaddr; | 358 | unsigned int ioaddr; |
362 | cardtype_t cardtype; | 359 | cardtype_t cardtype; |
363 | char *card_name = "unknown"; | 360 | char *card_name = "unknown"; |
364 | u_char *node_id; | 361 | u8 *buf; |
362 | size_t len; | ||
363 | u_char buggybuf[32]; | ||
365 | 364 | ||
366 | DEBUG(0, "fmvj18x_config(0x%p)\n", link); | 365 | DEBUG(0, "fmvj18x_config(0x%p)\n", link); |
367 | 366 | ||
368 | tuple.TupleData = (u_char *)buf; | 367 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); |
369 | tuple.TupleDataMax = 64; | 368 | kfree(buf); |
370 | tuple.TupleOffset = 0; | 369 | |
371 | tuple.DesiredTuple = CISTPL_FUNCE; | 370 | if (len) { |
372 | tuple.TupleOffset = 0; | 371 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ |
373 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { | ||
374 | last_ret = pcmcia_loop_config(link, fmvj18x_ioprobe, NULL); | 372 | last_ret = pcmcia_loop_config(link, fmvj18x_ioprobe, NULL); |
375 | if (last_ret != 0) | 373 | if (last_ret != 0) |
376 | goto cs_failed; | 374 | goto cs_failed; |
377 | 375 | ||
378 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ | ||
379 | switch (link->manf_id) { | 376 | switch (link->manf_id) { |
380 | case MANFID_TDK: | 377 | case MANFID_TDK: |
381 | cardtype = TDK; | 378 | cardtype = TDK; |
@@ -482,21 +479,21 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
482 | case CONTEC: | 479 | case CONTEC: |
483 | case NEC: | 480 | case NEC: |
484 | case KME: | 481 | case KME: |
485 | tuple.DesiredTuple = CISTPL_FUNCE; | ||
486 | tuple.TupleOffset = 0; | ||
487 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
488 | tuple.TupleOffset = 0; | ||
489 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
490 | if (cardtype == MBH10304) { | 482 | if (cardtype == MBH10304) { |
491 | /* MBH10304's CIS_FUNCE is corrupted */ | ||
492 | node_id = &(tuple.TupleData[5]); | ||
493 | card_name = "FMV-J182"; | 483 | card_name = "FMV-J182"; |
494 | } else { | 484 | |
495 | while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) { | 485 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); |
496 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); | 486 | if (len < 11) { |
497 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 487 | kfree(buf); |
488 | goto failed; | ||
498 | } | 489 | } |
499 | node_id = &(tuple.TupleData[2]); | 490 | /* Read MACID from CIS */ |
491 | for (i = 5; i < 11; i++) | ||
492 | dev->dev_addr[i] = buf[i]; | ||
493 | kfree(buf); | ||
494 | } else { | ||
495 | if (pcmcia_get_mac_from_cis(link, dev)) | ||
496 | goto failed; | ||
500 | if( cardtype == TDK ) { | 497 | if( cardtype == TDK ) { |
501 | card_name = "TDK LAK-CD021"; | 498 | card_name = "TDK LAK-CD021"; |
502 | } else if( cardtype == LA501 ) { | 499 | } else if( cardtype == LA501 ) { |
@@ -509,9 +506,6 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
509 | card_name = "C-NET(PC)C"; | 506 | card_name = "C-NET(PC)C"; |
510 | } | 507 | } |
511 | } | 508 | } |
512 | /* Read MACID from CIS */ | ||
513 | for (i = 0; i < 6; i++) | ||
514 | dev->dev_addr[i] = node_id[i]; | ||
515 | break; | 509 | break; |
516 | case UNGERMANN: | 510 | case UNGERMANN: |
517 | /* Read MACID from register */ | 511 | /* Read MACID from register */ |
@@ -521,12 +515,12 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
521 | break; | 515 | break; |
522 | case XXX10304: | 516 | case XXX10304: |
523 | /* Read MACID from Buggy CIS */ | 517 | /* Read MACID from Buggy CIS */ |
524 | if (fmvj18x_get_hwinfo(link, tuple.TupleData) == -1) { | 518 | if (fmvj18x_get_hwinfo(link, buggybuf) == -1) { |
525 | printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n"); | 519 | printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n"); |
526 | goto failed; | 520 | goto failed; |
527 | } | 521 | } |
528 | for (i = 0 ; i < 6; i++) { | 522 | for (i = 0 ; i < 6; i++) { |
529 | dev->dev_addr[i] = tuple.TupleData[i]; | 523 | dev->dev_addr[i] = buggybuf[i]; |
530 | } | 524 | } |
531 | card_name = "FMV-J182"; | 525 | card_name = "FMV-J182"; |
532 | break; | 526 | break; |