aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/nmclan_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/nmclan_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/nmclan_cs.c')
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c61
1 files changed, 28 insertions, 33 deletions
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 */