diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
commit | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch) | |
tree | 5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers | |
parent | fd238232cd0ff4840ae6946bb338502154096d88 (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')
47 files changed, 1193 insertions, 1406 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index b461411eab3e..e557f2359ccc 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -85,8 +85,8 @@ typedef struct bluecard_info_t { | |||
85 | } bluecard_info_t; | 85 | } bluecard_info_t; |
86 | 86 | ||
87 | 87 | ||
88 | static void bluecard_config(dev_link_t *link); | 88 | static void bluecard_config(struct pcmcia_device *link); |
89 | static void bluecard_release(dev_link_t *link); | 89 | static void bluecard_release(struct pcmcia_device *link); |
90 | 90 | ||
91 | static void bluecard_detach(struct pcmcia_device *p_dev); | 91 | static void bluecard_detach(struct pcmcia_device *p_dev); |
92 | 92 | ||
@@ -856,17 +856,16 @@ static int bluecard_close(bluecard_info_t *info) | |||
856 | return 0; | 856 | return 0; |
857 | } | 857 | } |
858 | 858 | ||
859 | static int bluecard_attach(struct pcmcia_device *p_dev) | 859 | static int bluecard_attach(struct pcmcia_device *link) |
860 | { | 860 | { |
861 | bluecard_info_t *info; | 861 | bluecard_info_t *info; |
862 | dev_link_t *link = dev_to_instance(p_dev); | ||
863 | 862 | ||
864 | /* Create new info device */ | 863 | /* Create new info device */ |
865 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 864 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
866 | if (!info) | 865 | if (!info) |
867 | return -ENOMEM; | 866 | return -ENOMEM; |
868 | 867 | ||
869 | info->p_dev = p_dev; | 868 | info->p_dev = link; |
870 | link->priv = info; | 869 | link->priv = info; |
871 | 870 | ||
872 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 871 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
@@ -887,9 +886,8 @@ static int bluecard_attach(struct pcmcia_device *p_dev) | |||
887 | } | 886 | } |
888 | 887 | ||
889 | 888 | ||
890 | static void bluecard_detach(struct pcmcia_device *p_dev) | 889 | static void bluecard_detach(struct pcmcia_device *link) |
891 | { | 890 | { |
892 | dev_link_t *link = dev_to_instance(p_dev); | ||
893 | bluecard_info_t *info = link->priv; | 891 | bluecard_info_t *info = link->priv; |
894 | 892 | ||
895 | if (link->state & DEV_CONFIG) | 893 | if (link->state & DEV_CONFIG) |
@@ -899,7 +897,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev) | |||
899 | } | 897 | } |
900 | 898 | ||
901 | 899 | ||
902 | static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 900 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
903 | { | 901 | { |
904 | int i; | 902 | int i; |
905 | 903 | ||
@@ -914,9 +912,8 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse | |||
914 | return pcmcia_parse_tuple(handle, tuple, parse); | 912 | return pcmcia_parse_tuple(handle, tuple, parse); |
915 | } | 913 | } |
916 | 914 | ||
917 | static void bluecard_config(dev_link_t *link) | 915 | static void bluecard_config(struct pcmcia_device *link) |
918 | { | 916 | { |
919 | client_handle_t handle = link->handle; | ||
920 | bluecard_info_t *info = link->priv; | 917 | bluecard_info_t *info = link->priv; |
921 | tuple_t tuple; | 918 | tuple_t tuple; |
922 | u_short buf[256]; | 919 | u_short buf[256]; |
@@ -930,7 +927,7 @@ static void bluecard_config(dev_link_t *link) | |||
930 | 927 | ||
931 | /* Get configuration register information */ | 928 | /* Get configuration register information */ |
932 | tuple.DesiredTuple = CISTPL_CONFIG; | 929 | tuple.DesiredTuple = CISTPL_CONFIG; |
933 | last_ret = first_tuple(handle, &tuple, &parse); | 930 | last_ret = first_tuple(link, &tuple, &parse); |
934 | if (last_ret != CS_SUCCESS) { | 931 | if (last_ret != CS_SUCCESS) { |
935 | last_fn = ParseTuple; | 932 | last_fn = ParseTuple; |
936 | goto cs_failed; | 933 | goto cs_failed; |
@@ -947,25 +944,25 @@ static void bluecard_config(dev_link_t *link) | |||
947 | 944 | ||
948 | for (n = 0; n < 0x400; n += 0x40) { | 945 | for (n = 0; n < 0x400; n += 0x40) { |
949 | link->io.BasePort1 = n ^ 0x300; | 946 | link->io.BasePort1 = n ^ 0x300; |
950 | i = pcmcia_request_io(link->handle, &link->io); | 947 | i = pcmcia_request_io(link, &link->io); |
951 | if (i == CS_SUCCESS) | 948 | if (i == CS_SUCCESS) |
952 | break; | 949 | break; |
953 | } | 950 | } |
954 | 951 | ||
955 | if (i != CS_SUCCESS) { | 952 | if (i != CS_SUCCESS) { |
956 | cs_error(link->handle, RequestIO, i); | 953 | cs_error(link, RequestIO, i); |
957 | goto failed; | 954 | goto failed; |
958 | } | 955 | } |
959 | 956 | ||
960 | i = pcmcia_request_irq(link->handle, &link->irq); | 957 | i = pcmcia_request_irq(link, &link->irq); |
961 | if (i != CS_SUCCESS) { | 958 | if (i != CS_SUCCESS) { |
962 | cs_error(link->handle, RequestIRQ, i); | 959 | cs_error(link, RequestIRQ, i); |
963 | link->irq.AssignedIRQ = 0; | 960 | link->irq.AssignedIRQ = 0; |
964 | } | 961 | } |
965 | 962 | ||
966 | i = pcmcia_request_configuration(link->handle, &link->conf); | 963 | i = pcmcia_request_configuration(link, &link->conf); |
967 | if (i != CS_SUCCESS) { | 964 | if (i != CS_SUCCESS) { |
968 | cs_error(link->handle, RequestConfiguration, i); | 965 | cs_error(link, RequestConfiguration, i); |
969 | goto failed; | 966 | goto failed; |
970 | } | 967 | } |
971 | 968 | ||
@@ -979,14 +976,14 @@ static void bluecard_config(dev_link_t *link) | |||
979 | return; | 976 | return; |
980 | 977 | ||
981 | cs_failed: | 978 | cs_failed: |
982 | cs_error(link->handle, last_fn, last_ret); | 979 | cs_error(link, last_fn, last_ret); |
983 | 980 | ||
984 | failed: | 981 | failed: |
985 | bluecard_release(link); | 982 | bluecard_release(link); |
986 | } | 983 | } |
987 | 984 | ||
988 | 985 | ||
989 | static void bluecard_release(dev_link_t *link) | 986 | static void bluecard_release(struct pcmcia_device *link) |
990 | { | 987 | { |
991 | bluecard_info_t *info = link->priv; | 988 | bluecard_info_t *info = link->priv; |
992 | 989 | ||
@@ -995,7 +992,7 @@ static void bluecard_release(dev_link_t *link) | |||
995 | 992 | ||
996 | del_timer(&(info->timer)); | 993 | del_timer(&(info->timer)); |
997 | 994 | ||
998 | pcmcia_disable_device(link->handle); | 995 | pcmcia_disable_device(link); |
999 | } | 996 | } |
1000 | 997 | ||
1001 | static struct pcmcia_device_id bluecard_ids[] = { | 998 | static struct pcmcia_device_id bluecard_ids[] = { |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 9192a754ebc0..7ea8fa350d26 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -88,8 +88,8 @@ typedef struct bt3c_info_t { | |||
88 | } bt3c_info_t; | 88 | } bt3c_info_t; |
89 | 89 | ||
90 | 90 | ||
91 | static void bt3c_config(dev_link_t *link); | 91 | static void bt3c_config(struct pcmcia_device *link); |
92 | static void bt3c_release(dev_link_t *link); | 92 | static void bt3c_release(struct pcmcia_device *link); |
93 | 93 | ||
94 | static void bt3c_detach(struct pcmcia_device *p_dev); | 94 | static void bt3c_detach(struct pcmcia_device *p_dev); |
95 | 95 | ||
@@ -645,17 +645,16 @@ static int bt3c_close(bt3c_info_t *info) | |||
645 | return 0; | 645 | return 0; |
646 | } | 646 | } |
647 | 647 | ||
648 | static int bt3c_attach(struct pcmcia_device *p_dev) | 648 | static int bt3c_attach(struct pcmcia_device *link) |
649 | { | 649 | { |
650 | bt3c_info_t *info; | 650 | bt3c_info_t *info; |
651 | dev_link_t *link = dev_to_instance(p_dev); | ||
652 | 651 | ||
653 | /* Create new info device */ | 652 | /* Create new info device */ |
654 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 653 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
655 | if (!info) | 654 | if (!info) |
656 | return -ENOMEM; | 655 | return -ENOMEM; |
657 | 656 | ||
658 | info->p_dev = p_dev; | 657 | info->p_dev = link; |
659 | link->priv = info; | 658 | link->priv = info; |
660 | 659 | ||
661 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 660 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
@@ -676,9 +675,8 @@ static int bt3c_attach(struct pcmcia_device *p_dev) | |||
676 | } | 675 | } |
677 | 676 | ||
678 | 677 | ||
679 | static void bt3c_detach(struct pcmcia_device *p_dev) | 678 | static void bt3c_detach(struct pcmcia_device *link) |
680 | { | 679 | { |
681 | dev_link_t *link = dev_to_instance(p_dev); | ||
682 | bt3c_info_t *info = link->priv; | 680 | bt3c_info_t *info = link->priv; |
683 | 681 | ||
684 | if (link->state & DEV_CONFIG) | 682 | if (link->state & DEV_CONFIG) |
@@ -687,7 +685,7 @@ static void bt3c_detach(struct pcmcia_device *p_dev) | |||
687 | kfree(info); | 685 | kfree(info); |
688 | } | 686 | } |
689 | 687 | ||
690 | static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 688 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
691 | { | 689 | { |
692 | int i; | 690 | int i; |
693 | 691 | ||
@@ -698,24 +696,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | |||
698 | return pcmcia_parse_tuple(handle, tuple, parse); | 696 | return pcmcia_parse_tuple(handle, tuple, parse); |
699 | } | 697 | } |
700 | 698 | ||
701 | static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 699 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
702 | { | 700 | { |
703 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) | 701 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) |
704 | return CS_NO_MORE_ITEMS; | 702 | return CS_NO_MORE_ITEMS; |
705 | return get_tuple(handle, tuple, parse); | 703 | return get_tuple(handle, tuple, parse); |
706 | } | 704 | } |
707 | 705 | ||
708 | static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 706 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
709 | { | 707 | { |
710 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) | 708 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) |
711 | return CS_NO_MORE_ITEMS; | 709 | return CS_NO_MORE_ITEMS; |
712 | return get_tuple(handle, tuple, parse); | 710 | return get_tuple(handle, tuple, parse); |
713 | } | 711 | } |
714 | 712 | ||
715 | static void bt3c_config(dev_link_t *link) | 713 | static void bt3c_config(struct pcmcia_device *link) |
716 | { | 714 | { |
717 | static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 715 | static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
718 | client_handle_t handle = link->handle; | ||
719 | bt3c_info_t *info = link->priv; | 716 | bt3c_info_t *info = link->priv; |
720 | tuple_t tuple; | 717 | tuple_t tuple; |
721 | u_short buf[256]; | 718 | u_short buf[256]; |
@@ -730,7 +727,7 @@ static void bt3c_config(dev_link_t *link) | |||
730 | 727 | ||
731 | /* Get configuration register information */ | 728 | /* Get configuration register information */ |
732 | tuple.DesiredTuple = CISTPL_CONFIG; | 729 | tuple.DesiredTuple = CISTPL_CONFIG; |
733 | last_ret = first_tuple(handle, &tuple, &parse); | 730 | last_ret = first_tuple(link, &tuple, &parse); |
734 | if (last_ret != CS_SUCCESS) { | 731 | if (last_ret != CS_SUCCESS) { |
735 | last_fn = ParseTuple; | 732 | last_fn = ParseTuple; |
736 | goto cs_failed; | 733 | goto cs_failed; |
@@ -749,7 +746,7 @@ static void bt3c_config(dev_link_t *link) | |||
749 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 746 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
750 | /* Two tries: without IO aliases, then with aliases */ | 747 | /* Two tries: without IO aliases, then with aliases */ |
751 | for (try = 0; try < 2; try++) { | 748 | for (try = 0; try < 2; try++) { |
752 | i = first_tuple(handle, &tuple, &parse); | 749 | i = first_tuple(link, &tuple, &parse); |
753 | while (i != CS_NO_MORE_ITEMS) { | 750 | while (i != CS_NO_MORE_ITEMS) { |
754 | if (i != CS_SUCCESS) | 751 | if (i != CS_SUCCESS) |
755 | goto next_entry; | 752 | goto next_entry; |
@@ -759,49 +756,49 @@ static void bt3c_config(dev_link_t *link) | |||
759 | link->conf.ConfigIndex = cf->index; | 756 | link->conf.ConfigIndex = cf->index; |
760 | link->io.BasePort1 = cf->io.win[0].base; | 757 | link->io.BasePort1 = cf->io.win[0].base; |
761 | link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | 758 | link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; |
762 | i = pcmcia_request_io(link->handle, &link->io); | 759 | i = pcmcia_request_io(link, &link->io); |
763 | if (i == CS_SUCCESS) | 760 | if (i == CS_SUCCESS) |
764 | goto found_port; | 761 | goto found_port; |
765 | } | 762 | } |
766 | next_entry: | 763 | next_entry: |
767 | i = next_tuple(handle, &tuple, &parse); | 764 | i = next_tuple(link, &tuple, &parse); |
768 | } | 765 | } |
769 | } | 766 | } |
770 | 767 | ||
771 | /* Second pass: try to find an entry that isn't picky about | 768 | /* Second pass: try to find an entry that isn't picky about |
772 | its base address, then try to grab any standard serial port | 769 | its base address, then try to grab any standard serial port |
773 | address, and finally try to get any free port. */ | 770 | address, and finally try to get any free port. */ |
774 | i = first_tuple(handle, &tuple, &parse); | 771 | i = first_tuple(link, &tuple, &parse); |
775 | while (i != CS_NO_MORE_ITEMS) { | 772 | while (i != CS_NO_MORE_ITEMS) { |
776 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 773 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
777 | link->conf.ConfigIndex = cf->index; | 774 | link->conf.ConfigIndex = cf->index; |
778 | for (j = 0; j < 5; j++) { | 775 | for (j = 0; j < 5; j++) { |
779 | link->io.BasePort1 = base[j]; | 776 | link->io.BasePort1 = base[j]; |
780 | link->io.IOAddrLines = base[j] ? 16 : 3; | 777 | link->io.IOAddrLines = base[j] ? 16 : 3; |
781 | i = pcmcia_request_io(link->handle, &link->io); | 778 | i = pcmcia_request_io(link, &link->io); |
782 | if (i == CS_SUCCESS) | 779 | if (i == CS_SUCCESS) |
783 | goto found_port; | 780 | goto found_port; |
784 | } | 781 | } |
785 | } | 782 | } |
786 | i = next_tuple(handle, &tuple, &parse); | 783 | i = next_tuple(link, &tuple, &parse); |
787 | } | 784 | } |
788 | 785 | ||
789 | found_port: | 786 | found_port: |
790 | if (i != CS_SUCCESS) { | 787 | if (i != CS_SUCCESS) { |
791 | BT_ERR("No usable port range found"); | 788 | BT_ERR("No usable port range found"); |
792 | cs_error(link->handle, RequestIO, i); | 789 | cs_error(link, RequestIO, i); |
793 | goto failed; | 790 | goto failed; |
794 | } | 791 | } |
795 | 792 | ||
796 | i = pcmcia_request_irq(link->handle, &link->irq); | 793 | i = pcmcia_request_irq(link, &link->irq); |
797 | if (i != CS_SUCCESS) { | 794 | if (i != CS_SUCCESS) { |
798 | cs_error(link->handle, RequestIRQ, i); | 795 | cs_error(link, RequestIRQ, i); |
799 | link->irq.AssignedIRQ = 0; | 796 | link->irq.AssignedIRQ = 0; |
800 | } | 797 | } |
801 | 798 | ||
802 | i = pcmcia_request_configuration(link->handle, &link->conf); | 799 | i = pcmcia_request_configuration(link, &link->conf); |
803 | if (i != CS_SUCCESS) { | 800 | if (i != CS_SUCCESS) { |
804 | cs_error(link->handle, RequestConfiguration, i); | 801 | cs_error(link, RequestConfiguration, i); |
805 | goto failed; | 802 | goto failed; |
806 | } | 803 | } |
807 | 804 | ||
@@ -815,21 +812,21 @@ found_port: | |||
815 | return; | 812 | return; |
816 | 813 | ||
817 | cs_failed: | 814 | cs_failed: |
818 | cs_error(link->handle, last_fn, last_ret); | 815 | cs_error(link, last_fn, last_ret); |
819 | 816 | ||
820 | failed: | 817 | failed: |
821 | bt3c_release(link); | 818 | bt3c_release(link); |
822 | } | 819 | } |
823 | 820 | ||
824 | 821 | ||
825 | static void bt3c_release(dev_link_t *link) | 822 | static void bt3c_release(struct pcmcia_device *link) |
826 | { | 823 | { |
827 | bt3c_info_t *info = link->priv; | 824 | bt3c_info_t *info = link->priv; |
828 | 825 | ||
829 | if (link->state & DEV_PRESENT) | 826 | if (link->state & DEV_PRESENT) |
830 | bt3c_close(info); | 827 | bt3c_close(info); |
831 | 828 | ||
832 | pcmcia_disable_device(link->handle); | 829 | pcmcia_disable_device(link); |
833 | } | 830 | } |
834 | 831 | ||
835 | 832 | ||
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index cfe1d74a9185..594839061360 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -84,8 +84,8 @@ typedef struct btuart_info_t { | |||
84 | } btuart_info_t; | 84 | } btuart_info_t; |
85 | 85 | ||
86 | 86 | ||
87 | static void btuart_config(dev_link_t *link); | 87 | static void btuart_config(struct pcmcia_device *link); |
88 | static void btuart_release(dev_link_t *link); | 88 | static void btuart_release(struct pcmcia_device *link); |
89 | 89 | ||
90 | static void btuart_detach(struct pcmcia_device *p_dev); | 90 | static void btuart_detach(struct pcmcia_device *p_dev); |
91 | 91 | ||
@@ -576,17 +576,16 @@ static int btuart_close(btuart_info_t *info) | |||
576 | return 0; | 576 | return 0; |
577 | } | 577 | } |
578 | 578 | ||
579 | static int btuart_attach(struct pcmcia_device *p_dev) | 579 | static int btuart_attach(struct pcmcia_device *link) |
580 | { | 580 | { |
581 | btuart_info_t *info; | 581 | btuart_info_t *info; |
582 | dev_link_t *link = dev_to_instance(p_dev); | ||
583 | 582 | ||
584 | /* Create new info device */ | 583 | /* Create new info device */ |
585 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 584 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
586 | if (!info) | 585 | if (!info) |
587 | return -ENOMEM; | 586 | return -ENOMEM; |
588 | 587 | ||
589 | info->p_dev = p_dev; | 588 | info->p_dev = link; |
590 | link->priv = info; | 589 | link->priv = info; |
591 | 590 | ||
592 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 591 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
@@ -607,9 +606,8 @@ static int btuart_attach(struct pcmcia_device *p_dev) | |||
607 | } | 606 | } |
608 | 607 | ||
609 | 608 | ||
610 | static void btuart_detach(struct pcmcia_device *p_dev) | 609 | static void btuart_detach(struct pcmcia_device *link) |
611 | { | 610 | { |
612 | dev_link_t *link = dev_to_instance(p_dev); | ||
613 | btuart_info_t *info = link->priv; | 611 | btuart_info_t *info = link->priv; |
614 | 612 | ||
615 | if (link->state & DEV_CONFIG) | 613 | if (link->state & DEV_CONFIG) |
@@ -618,7 +616,7 @@ static void btuart_detach(struct pcmcia_device *p_dev) | |||
618 | kfree(info); | 616 | kfree(info); |
619 | } | 617 | } |
620 | 618 | ||
621 | static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 619 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
622 | { | 620 | { |
623 | int i; | 621 | int i; |
624 | 622 | ||
@@ -629,24 +627,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | |||
629 | return pcmcia_parse_tuple(handle, tuple, parse); | 627 | return pcmcia_parse_tuple(handle, tuple, parse); |
630 | } | 628 | } |
631 | 629 | ||
632 | static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 630 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
633 | { | 631 | { |
634 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) | 632 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) |
635 | return CS_NO_MORE_ITEMS; | 633 | return CS_NO_MORE_ITEMS; |
636 | return get_tuple(handle, tuple, parse); | 634 | return get_tuple(handle, tuple, parse); |
637 | } | 635 | } |
638 | 636 | ||
639 | static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 637 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
640 | { | 638 | { |
641 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) | 639 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) |
642 | return CS_NO_MORE_ITEMS; | 640 | return CS_NO_MORE_ITEMS; |
643 | return get_tuple(handle, tuple, parse); | 641 | return get_tuple(handle, tuple, parse); |
644 | } | 642 | } |
645 | 643 | ||
646 | static void btuart_config(dev_link_t *link) | 644 | static void btuart_config(struct pcmcia_device *link) |
647 | { | 645 | { |
648 | static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 646 | static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
649 | client_handle_t handle = link->handle; | ||
650 | btuart_info_t *info = link->priv; | 647 | btuart_info_t *info = link->priv; |
651 | tuple_t tuple; | 648 | tuple_t tuple; |
652 | u_short buf[256]; | 649 | u_short buf[256]; |
@@ -661,7 +658,7 @@ static void btuart_config(dev_link_t *link) | |||
661 | 658 | ||
662 | /* Get configuration register information */ | 659 | /* Get configuration register information */ |
663 | tuple.DesiredTuple = CISTPL_CONFIG; | 660 | tuple.DesiredTuple = CISTPL_CONFIG; |
664 | last_ret = first_tuple(handle, &tuple, &parse); | 661 | last_ret = first_tuple(link, &tuple, &parse); |
665 | if (last_ret != CS_SUCCESS) { | 662 | if (last_ret != CS_SUCCESS) { |
666 | last_fn = ParseTuple; | 663 | last_fn = ParseTuple; |
667 | goto cs_failed; | 664 | goto cs_failed; |
@@ -680,7 +677,7 @@ static void btuart_config(dev_link_t *link) | |||
680 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 677 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
681 | /* Two tries: without IO aliases, then with aliases */ | 678 | /* Two tries: without IO aliases, then with aliases */ |
682 | for (try = 0; try < 2; try++) { | 679 | for (try = 0; try < 2; try++) { |
683 | i = first_tuple(handle, &tuple, &parse); | 680 | i = first_tuple(link, &tuple, &parse); |
684 | while (i != CS_NO_MORE_ITEMS) { | 681 | while (i != CS_NO_MORE_ITEMS) { |
685 | if (i != CS_SUCCESS) | 682 | if (i != CS_SUCCESS) |
686 | goto next_entry; | 683 | goto next_entry; |
@@ -690,19 +687,19 @@ static void btuart_config(dev_link_t *link) | |||
690 | link->conf.ConfigIndex = cf->index; | 687 | link->conf.ConfigIndex = cf->index; |
691 | link->io.BasePort1 = cf->io.win[0].base; | 688 | link->io.BasePort1 = cf->io.win[0].base; |
692 | link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | 689 | link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; |
693 | i = pcmcia_request_io(link->handle, &link->io); | 690 | i = pcmcia_request_io(link, &link->io); |
694 | if (i == CS_SUCCESS) | 691 | if (i == CS_SUCCESS) |
695 | goto found_port; | 692 | goto found_port; |
696 | } | 693 | } |
697 | next_entry: | 694 | next_entry: |
698 | i = next_tuple(handle, &tuple, &parse); | 695 | i = next_tuple(link, &tuple, &parse); |
699 | } | 696 | } |
700 | } | 697 | } |
701 | 698 | ||
702 | /* Second pass: try to find an entry that isn't picky about | 699 | /* Second pass: try to find an entry that isn't picky about |
703 | its base address, then try to grab any standard serial port | 700 | its base address, then try to grab any standard serial port |
704 | address, and finally try to get any free port. */ | 701 | address, and finally try to get any free port. */ |
705 | i = first_tuple(handle, &tuple, &parse); | 702 | i = first_tuple(link, &tuple, &parse); |
706 | while (i != CS_NO_MORE_ITEMS) { | 703 | while (i != CS_NO_MORE_ITEMS) { |
707 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) | 704 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) |
708 | && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 705 | && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
@@ -710,30 +707,30 @@ next_entry: | |||
710 | for (j = 0; j < 5; j++) { | 707 | for (j = 0; j < 5; j++) { |
711 | link->io.BasePort1 = base[j]; | 708 | link->io.BasePort1 = base[j]; |
712 | link->io.IOAddrLines = base[j] ? 16 : 3; | 709 | link->io.IOAddrLines = base[j] ? 16 : 3; |
713 | i = pcmcia_request_io(link->handle, &link->io); | 710 | i = pcmcia_request_io(link, &link->io); |
714 | if (i == CS_SUCCESS) | 711 | if (i == CS_SUCCESS) |
715 | goto found_port; | 712 | goto found_port; |
716 | } | 713 | } |
717 | } | 714 | } |
718 | i = next_tuple(handle, &tuple, &parse); | 715 | i = next_tuple(link, &tuple, &parse); |
719 | } | 716 | } |
720 | 717 | ||
721 | found_port: | 718 | found_port: |
722 | if (i != CS_SUCCESS) { | 719 | if (i != CS_SUCCESS) { |
723 | BT_ERR("No usable port range found"); | 720 | BT_ERR("No usable port range found"); |
724 | cs_error(link->handle, RequestIO, i); | 721 | cs_error(link, RequestIO, i); |
725 | goto failed; | 722 | goto failed; |
726 | } | 723 | } |
727 | 724 | ||
728 | i = pcmcia_request_irq(link->handle, &link->irq); | 725 | i = pcmcia_request_irq(link, &link->irq); |
729 | if (i != CS_SUCCESS) { | 726 | if (i != CS_SUCCESS) { |
730 | cs_error(link->handle, RequestIRQ, i); | 727 | cs_error(link, RequestIRQ, i); |
731 | link->irq.AssignedIRQ = 0; | 728 | link->irq.AssignedIRQ = 0; |
732 | } | 729 | } |
733 | 730 | ||
734 | i = pcmcia_request_configuration(link->handle, &link->conf); | 731 | i = pcmcia_request_configuration(link, &link->conf); |
735 | if (i != CS_SUCCESS) { | 732 | if (i != CS_SUCCESS) { |
736 | cs_error(link->handle, RequestConfiguration, i); | 733 | cs_error(link, RequestConfiguration, i); |
737 | goto failed; | 734 | goto failed; |
738 | } | 735 | } |
739 | 736 | ||
@@ -747,21 +744,21 @@ found_port: | |||
747 | return; | 744 | return; |
748 | 745 | ||
749 | cs_failed: | 746 | cs_failed: |
750 | cs_error(link->handle, last_fn, last_ret); | 747 | cs_error(link, last_fn, last_ret); |
751 | 748 | ||
752 | failed: | 749 | failed: |
753 | btuart_release(link); | 750 | btuart_release(link); |
754 | } | 751 | } |
755 | 752 | ||
756 | 753 | ||
757 | static void btuart_release(dev_link_t *link) | 754 | static void btuart_release(struct pcmcia_device *link) |
758 | { | 755 | { |
759 | btuart_info_t *info = link->priv; | 756 | btuart_info_t *info = link->priv; |
760 | 757 | ||
761 | if (link->state & DEV_PRESENT) | 758 | if (link->state & DEV_PRESENT) |
762 | btuart_close(info); | 759 | btuart_close(info); |
763 | 760 | ||
764 | pcmcia_disable_device(link->handle); | 761 | pcmcia_disable_device(link); |
765 | } | 762 | } |
766 | 763 | ||
767 | static struct pcmcia_device_id btuart_ids[] = { | 764 | static struct pcmcia_device_id btuart_ids[] = { |
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 389a68256fe4..416433b4a348 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -87,8 +87,8 @@ typedef struct dtl1_info_t { | |||
87 | } dtl1_info_t; | 87 | } dtl1_info_t; |
88 | 88 | ||
89 | 89 | ||
90 | static void dtl1_config(dev_link_t *link); | 90 | static void dtl1_config(struct pcmcia_device *link); |
91 | static void dtl1_release(dev_link_t *link); | 91 | static void dtl1_release(struct pcmcia_device *link); |
92 | 92 | ||
93 | static void dtl1_detach(struct pcmcia_device *p_dev); | 93 | static void dtl1_detach(struct pcmcia_device *p_dev); |
94 | 94 | ||
@@ -555,17 +555,16 @@ static int dtl1_close(dtl1_info_t *info) | |||
555 | return 0; | 555 | return 0; |
556 | } | 556 | } |
557 | 557 | ||
558 | static int dtl1_attach(struct pcmcia_device *p_dev) | 558 | static int dtl1_attach(struct pcmcia_device *link) |
559 | { | 559 | { |
560 | dtl1_info_t *info; | 560 | dtl1_info_t *info; |
561 | dev_link_t *link = dev_to_instance(p_dev); | ||
562 | 561 | ||
563 | /* Create new info device */ | 562 | /* Create new info device */ |
564 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 563 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
565 | if (!info) | 564 | if (!info) |
566 | return -ENOMEM; | 565 | return -ENOMEM; |
567 | 566 | ||
568 | info->p_dev = p_dev; | 567 | info->p_dev = link; |
569 | link->priv = info; | 568 | link->priv = info; |
570 | 569 | ||
571 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 570 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
@@ -586,9 +585,8 @@ static int dtl1_attach(struct pcmcia_device *p_dev) | |||
586 | } | 585 | } |
587 | 586 | ||
588 | 587 | ||
589 | static void dtl1_detach(struct pcmcia_device *p_dev) | 588 | static void dtl1_detach(struct pcmcia_device *link) |
590 | { | 589 | { |
591 | dev_link_t *link = dev_to_instance(p_dev); | ||
592 | dtl1_info_t *info = link->priv; | 590 | dtl1_info_t *info = link->priv; |
593 | 591 | ||
594 | if (link->state & DEV_CONFIG) | 592 | if (link->state & DEV_CONFIG) |
@@ -597,7 +595,7 @@ static void dtl1_detach(struct pcmcia_device *p_dev) | |||
597 | kfree(info); | 595 | kfree(info); |
598 | } | 596 | } |
599 | 597 | ||
600 | static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 598 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
601 | { | 599 | { |
602 | int i; | 600 | int i; |
603 | 601 | ||
@@ -608,23 +606,22 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | |||
608 | return pcmcia_parse_tuple(handle, tuple, parse); | 606 | return pcmcia_parse_tuple(handle, tuple, parse); |
609 | } | 607 | } |
610 | 608 | ||
611 | static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 609 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
612 | { | 610 | { |
613 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) | 611 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) |
614 | return CS_NO_MORE_ITEMS; | 612 | return CS_NO_MORE_ITEMS; |
615 | return get_tuple(handle, tuple, parse); | 613 | return get_tuple(handle, tuple, parse); |
616 | } | 614 | } |
617 | 615 | ||
618 | static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 616 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) |
619 | { | 617 | { |
620 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) | 618 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) |
621 | return CS_NO_MORE_ITEMS; | 619 | return CS_NO_MORE_ITEMS; |
622 | return get_tuple(handle, tuple, parse); | 620 | return get_tuple(handle, tuple, parse); |
623 | } | 621 | } |
624 | 622 | ||
625 | static void dtl1_config(dev_link_t *link) | 623 | static void dtl1_config(struct pcmcia_device *link) |
626 | { | 624 | { |
627 | client_handle_t handle = link->handle; | ||
628 | dtl1_info_t *info = link->priv; | 625 | dtl1_info_t *info = link->priv; |
629 | tuple_t tuple; | 626 | tuple_t tuple; |
630 | u_short buf[256]; | 627 | u_short buf[256]; |
@@ -639,7 +636,7 @@ static void dtl1_config(dev_link_t *link) | |||
639 | 636 | ||
640 | /* Get configuration register information */ | 637 | /* Get configuration register information */ |
641 | tuple.DesiredTuple = CISTPL_CONFIG; | 638 | tuple.DesiredTuple = CISTPL_CONFIG; |
642 | last_ret = first_tuple(handle, &tuple, &parse); | 639 | last_ret = first_tuple(link, &tuple, &parse); |
643 | if (last_ret != CS_SUCCESS) { | 640 | if (last_ret != CS_SUCCESS) { |
644 | last_fn = ParseTuple; | 641 | last_fn = ParseTuple; |
645 | goto cs_failed; | 642 | goto cs_failed; |
@@ -658,34 +655,34 @@ static void dtl1_config(dev_link_t *link) | |||
658 | 655 | ||
659 | /* Look for a generic full-sized window */ | 656 | /* Look for a generic full-sized window */ |
660 | link->io.NumPorts1 = 8; | 657 | link->io.NumPorts1 = 8; |
661 | i = first_tuple(handle, &tuple, &parse); | 658 | i = first_tuple(link, &tuple, &parse); |
662 | while (i != CS_NO_MORE_ITEMS) { | 659 | while (i != CS_NO_MORE_ITEMS) { |
663 | if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { | 660 | if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { |
664 | link->conf.ConfigIndex = cf->index; | 661 | link->conf.ConfigIndex = cf->index; |
665 | link->io.BasePort1 = cf->io.win[0].base; | 662 | link->io.BasePort1 = cf->io.win[0].base; |
666 | link->io.NumPorts1 = cf->io.win[0].len; /*yo */ | 663 | link->io.NumPorts1 = cf->io.win[0].len; /*yo */ |
667 | link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | 664 | link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; |
668 | i = pcmcia_request_io(link->handle, &link->io); | 665 | i = pcmcia_request_io(link, &link->io); |
669 | if (i == CS_SUCCESS) | 666 | if (i == CS_SUCCESS) |
670 | break; | 667 | break; |
671 | } | 668 | } |
672 | i = next_tuple(handle, &tuple, &parse); | 669 | i = next_tuple(link, &tuple, &parse); |
673 | } | 670 | } |
674 | 671 | ||
675 | if (i != CS_SUCCESS) { | 672 | if (i != CS_SUCCESS) { |
676 | cs_error(link->handle, RequestIO, i); | 673 | cs_error(link, RequestIO, i); |
677 | goto failed; | 674 | goto failed; |
678 | } | 675 | } |
679 | 676 | ||
680 | i = pcmcia_request_irq(link->handle, &link->irq); | 677 | i = pcmcia_request_irq(link, &link->irq); |
681 | if (i != CS_SUCCESS) { | 678 | if (i != CS_SUCCESS) { |
682 | cs_error(link->handle, RequestIRQ, i); | 679 | cs_error(link, RequestIRQ, i); |
683 | link->irq.AssignedIRQ = 0; | 680 | link->irq.AssignedIRQ = 0; |
684 | } | 681 | } |
685 | 682 | ||
686 | i = pcmcia_request_configuration(link->handle, &link->conf); | 683 | i = pcmcia_request_configuration(link, &link->conf); |
687 | if (i != CS_SUCCESS) { | 684 | if (i != CS_SUCCESS) { |
688 | cs_error(link->handle, RequestConfiguration, i); | 685 | cs_error(link, RequestConfiguration, i); |
689 | goto failed; | 686 | goto failed; |
690 | } | 687 | } |
691 | 688 | ||
@@ -699,21 +696,21 @@ static void dtl1_config(dev_link_t *link) | |||
699 | return; | 696 | return; |
700 | 697 | ||
701 | cs_failed: | 698 | cs_failed: |
702 | cs_error(link->handle, last_fn, last_ret); | 699 | cs_error(link, last_fn, last_ret); |
703 | 700 | ||
704 | failed: | 701 | failed: |
705 | dtl1_release(link); | 702 | dtl1_release(link); |
706 | } | 703 | } |
707 | 704 | ||
708 | 705 | ||
709 | static void dtl1_release(dev_link_t *link) | 706 | static void dtl1_release(struct pcmcia_device *link) |
710 | { | 707 | { |
711 | dtl1_info_t *info = link->priv; | 708 | dtl1_info_t *info = link->priv; |
712 | 709 | ||
713 | if (link->state & DEV_PRESENT) | 710 | if (link->state & DEV_PRESENT) |
714 | dtl1_close(info); | 711 | dtl1_close(info); |
715 | 712 | ||
716 | pcmcia_disable_device(link->handle); | 713 | pcmcia_disable_device(link); |
717 | } | 714 | } |
718 | 715 | ||
719 | 716 | ||
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 3e6d6e0bb6ee..79b8ad0e32df 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -67,7 +67,7 @@ static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; | |||
67 | #define T_100MSEC msecs_to_jiffies(100) | 67 | #define T_100MSEC msecs_to_jiffies(100) |
68 | #define T_500MSEC msecs_to_jiffies(500) | 68 | #define T_500MSEC msecs_to_jiffies(500) |
69 | 69 | ||
70 | static void cm4000_release(dev_link_t *link); | 70 | static void cm4000_release(struct pcmcia_device *link); |
71 | 71 | ||
72 | static int major; /* major number we get from the kernel */ | 72 | static int major; /* major number we get from the kernel */ |
73 | 73 | ||
@@ -149,14 +149,14 @@ struct cm4000_dev { | |||
149 | #define ZERO_DEV(dev) \ | 149 | #define ZERO_DEV(dev) \ |
150 | memset(&dev->atr_csum,0, \ | 150 | memset(&dev->atr_csum,0, \ |
151 | sizeof(struct cm4000_dev) - \ | 151 | sizeof(struct cm4000_dev) - \ |
152 | /*link*/ sizeof(dev_link_t) - \ | 152 | /*link*/ sizeof(struct pcmcia_device) - \ |
153 | /*node*/ sizeof(dev_node_t) - \ | 153 | /*node*/ sizeof(dev_node_t) - \ |
154 | /*atr*/ MAX_ATR*sizeof(char) - \ | 154 | /*atr*/ MAX_ATR*sizeof(char) - \ |
155 | /*rbuf*/ 512*sizeof(char) - \ | 155 | /*rbuf*/ 512*sizeof(char) - \ |
156 | /*sbuf*/ 512*sizeof(char) - \ | 156 | /*sbuf*/ 512*sizeof(char) - \ |
157 | /*queue*/ 4*sizeof(wait_queue_head_t)) | 157 | /*queue*/ 4*sizeof(wait_queue_head_t)) |
158 | 158 | ||
159 | static dev_link_t *dev_table[CM4000_MAX_DEV]; | 159 | static struct pcmcia_device *dev_table[CM4000_MAX_DEV]; |
160 | static struct class *cmm_class; | 160 | static struct class *cmm_class; |
161 | 161 | ||
162 | /* This table doesn't use spaces after the comma between fields and thus | 162 | /* This table doesn't use spaces after the comma between fields and thus |
@@ -1441,7 +1441,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
1441 | { | 1441 | { |
1442 | struct cm4000_dev *dev = filp->private_data; | 1442 | struct cm4000_dev *dev = filp->private_data; |
1443 | ioaddr_t iobase = dev->p_dev->io.BasePort1; | 1443 | ioaddr_t iobase = dev->p_dev->io.BasePort1; |
1444 | dev_link_t *link; | 1444 | struct pcmcia_device *link; |
1445 | int size; | 1445 | int size; |
1446 | int rc; | 1446 | int rc; |
1447 | void __user *argp = (void __user *)arg; | 1447 | void __user *argp = (void __user *)arg; |
@@ -1660,7 +1660,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
1660 | static int cmm_open(struct inode *inode, struct file *filp) | 1660 | static int cmm_open(struct inode *inode, struct file *filp) |
1661 | { | 1661 | { |
1662 | struct cm4000_dev *dev; | 1662 | struct cm4000_dev *dev; |
1663 | dev_link_t *link; | 1663 | struct pcmcia_device *link; |
1664 | int rc, minor = iminor(inode); | 1664 | int rc, minor = iminor(inode); |
1665 | 1665 | ||
1666 | if (minor >= CM4000_MAX_DEV) | 1666 | if (minor >= CM4000_MAX_DEV) |
@@ -1709,7 +1709,7 @@ static int cmm_open(struct inode *inode, struct file *filp) | |||
1709 | static int cmm_close(struct inode *inode, struct file *filp) | 1709 | static int cmm_close(struct inode *inode, struct file *filp) |
1710 | { | 1710 | { |
1711 | struct cm4000_dev *dev; | 1711 | struct cm4000_dev *dev; |
1712 | dev_link_t *link; | 1712 | struct pcmcia_device *link; |
1713 | int minor = iminor(inode); | 1713 | int minor = iminor(inode); |
1714 | 1714 | ||
1715 | if (minor >= CM4000_MAX_DEV) | 1715 | if (minor >= CM4000_MAX_DEV) |
@@ -1735,7 +1735,7 @@ static int cmm_close(struct inode *inode, struct file *filp) | |||
1735 | return 0; | 1735 | return 0; |
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | static void cmm_cm4000_release(dev_link_t * link) | 1738 | static void cmm_cm4000_release(struct pcmcia_device * link) |
1739 | { | 1739 | { |
1740 | struct cm4000_dev *dev = link->priv; | 1740 | struct cm4000_dev *dev = link->priv; |
1741 | 1741 | ||
@@ -1759,9 +1759,8 @@ static void cmm_cm4000_release(dev_link_t * link) | |||
1759 | 1759 | ||
1760 | /*==== Interface to PCMCIA Layer =======================================*/ | 1760 | /*==== Interface to PCMCIA Layer =======================================*/ |
1761 | 1761 | ||
1762 | static void cm4000_config(dev_link_t * link, int devno) | 1762 | static void cm4000_config(struct pcmcia_device * link, int devno) |
1763 | { | 1763 | { |
1764 | client_handle_t handle = link->handle; | ||
1765 | struct cm4000_dev *dev; | 1764 | struct cm4000_dev *dev; |
1766 | tuple_t tuple; | 1765 | tuple_t tuple; |
1767 | cisparse_t parse; | 1766 | cisparse_t parse; |
@@ -1776,16 +1775,16 @@ static void cm4000_config(dev_link_t * link, int devno) | |||
1776 | tuple.TupleDataMax = sizeof(buf); | 1775 | tuple.TupleDataMax = sizeof(buf); |
1777 | tuple.TupleOffset = 0; | 1776 | tuple.TupleOffset = 0; |
1778 | 1777 | ||
1779 | if ((fail_rc = pcmcia_get_first_tuple(handle, &tuple)) != CS_SUCCESS) { | 1778 | if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) { |
1780 | fail_fn = GetFirstTuple; | 1779 | fail_fn = GetFirstTuple; |
1781 | goto cs_failed; | 1780 | goto cs_failed; |
1782 | } | 1781 | } |
1783 | if ((fail_rc = pcmcia_get_tuple_data(handle, &tuple)) != CS_SUCCESS) { | 1782 | if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) { |
1784 | fail_fn = GetTupleData; | 1783 | fail_fn = GetTupleData; |
1785 | goto cs_failed; | 1784 | goto cs_failed; |
1786 | } | 1785 | } |
1787 | if ((fail_rc = | 1786 | if ((fail_rc = |
1788 | pcmcia_parse_tuple(handle, &tuple, &parse)) != CS_SUCCESS) { | 1787 | pcmcia_parse_tuple(link, &tuple, &parse)) != CS_SUCCESS) { |
1789 | fail_fn = ParseTuple; | 1788 | fail_fn = ParseTuple; |
1790 | goto cs_failed; | 1789 | goto cs_failed; |
1791 | } | 1790 | } |
@@ -1798,13 +1797,13 @@ static void cm4000_config(dev_link_t * link, int devno) | |||
1798 | link->io.NumPorts2 = 0; | 1797 | link->io.NumPorts2 = 0; |
1799 | link->io.Attributes2 = 0; | 1798 | link->io.Attributes2 = 0; |
1800 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 1799 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
1801 | for (rc = pcmcia_get_first_tuple(handle, &tuple); | 1800 | for (rc = pcmcia_get_first_tuple(link, &tuple); |
1802 | rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(handle, &tuple)) { | 1801 | rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(link, &tuple)) { |
1803 | 1802 | ||
1804 | rc = pcmcia_get_tuple_data(handle, &tuple); | 1803 | rc = pcmcia_get_tuple_data(link, &tuple); |
1805 | if (rc != CS_SUCCESS) | 1804 | if (rc != CS_SUCCESS) |
1806 | continue; | 1805 | continue; |
1807 | rc = pcmcia_parse_tuple(handle, &tuple, &parse); | 1806 | rc = pcmcia_parse_tuple(link, &tuple, &parse); |
1808 | if (rc != CS_SUCCESS) | 1807 | if (rc != CS_SUCCESS) |
1809 | continue; | 1808 | continue; |
1810 | 1809 | ||
@@ -1824,7 +1823,7 @@ static void cm4000_config(dev_link_t * link, int devno) | |||
1824 | link->io.IOAddrLines = parse.cftable_entry.io.flags | 1823 | link->io.IOAddrLines = parse.cftable_entry.io.flags |
1825 | & CISTPL_IO_LINES_MASK; | 1824 | & CISTPL_IO_LINES_MASK; |
1826 | 1825 | ||
1827 | rc = pcmcia_request_io(handle, &link->io); | 1826 | rc = pcmcia_request_io(link, &link->io); |
1828 | if (rc == CS_SUCCESS) | 1827 | if (rc == CS_SUCCESS) |
1829 | break; /* we are done */ | 1828 | break; /* we are done */ |
1830 | } | 1829 | } |
@@ -1834,7 +1833,7 @@ static void cm4000_config(dev_link_t * link, int devno) | |||
1834 | link->conf.IntType = 00000002; | 1833 | link->conf.IntType = 00000002; |
1835 | 1834 | ||
1836 | if ((fail_rc = | 1835 | if ((fail_rc = |
1837 | pcmcia_request_configuration(handle, &link->conf)) != CS_SUCCESS) { | 1836 | pcmcia_request_configuration(link, &link->conf)) != CS_SUCCESS) { |
1838 | fail_fn = RequestConfiguration; | 1837 | fail_fn = RequestConfiguration; |
1839 | goto cs_release; | 1838 | goto cs_release; |
1840 | } | 1839 | } |
@@ -1850,16 +1849,15 @@ static void cm4000_config(dev_link_t * link, int devno) | |||
1850 | return; | 1849 | return; |
1851 | 1850 | ||
1852 | cs_failed: | 1851 | cs_failed: |
1853 | cs_error(handle, fail_fn, fail_rc); | 1852 | cs_error(link, fail_fn, fail_rc); |
1854 | cs_release: | 1853 | cs_release: |
1855 | cm4000_release(link); | 1854 | cm4000_release(link); |
1856 | 1855 | ||
1857 | link->state &= ~DEV_CONFIG_PENDING; | 1856 | link->state &= ~DEV_CONFIG_PENDING; |
1858 | } | 1857 | } |
1859 | 1858 | ||
1860 | static int cm4000_suspend(struct pcmcia_device *p_dev) | 1859 | static int cm4000_suspend(struct pcmcia_device *link) |
1861 | { | 1860 | { |
1862 | dev_link_t *link = dev_to_instance(p_dev); | ||
1863 | struct cm4000_dev *dev; | 1861 | struct cm4000_dev *dev; |
1864 | 1862 | ||
1865 | dev = link->priv; | 1863 | dev = link->priv; |
@@ -1868,9 +1866,8 @@ static int cm4000_suspend(struct pcmcia_device *p_dev) | |||
1868 | return 0; | 1866 | return 0; |
1869 | } | 1867 | } |
1870 | 1868 | ||
1871 | static int cm4000_resume(struct pcmcia_device *p_dev) | 1869 | static int cm4000_resume(struct pcmcia_device *link) |
1872 | { | 1870 | { |
1873 | dev_link_t *link = dev_to_instance(p_dev); | ||
1874 | struct cm4000_dev *dev; | 1871 | struct cm4000_dev *dev; |
1875 | 1872 | ||
1876 | dev = link->priv; | 1873 | dev = link->priv; |
@@ -1880,17 +1877,16 @@ static int cm4000_resume(struct pcmcia_device *p_dev) | |||
1880 | return 0; | 1877 | return 0; |
1881 | } | 1878 | } |
1882 | 1879 | ||
1883 | static void cm4000_release(dev_link_t *link) | 1880 | static void cm4000_release(struct pcmcia_device *link) |
1884 | { | 1881 | { |
1885 | cmm_cm4000_release(link->priv); /* delay release until device closed */ | 1882 | cmm_cm4000_release(link->priv); /* delay release until device closed */ |
1886 | pcmcia_disable_device(link->handle); | 1883 | pcmcia_disable_device(link); |
1887 | } | 1884 | } |
1888 | 1885 | ||
1889 | static int cm4000_attach(struct pcmcia_device *p_dev) | 1886 | static int cm4000_attach(struct pcmcia_device *link) |
1890 | { | 1887 | { |
1891 | struct cm4000_dev *dev; | 1888 | struct cm4000_dev *dev; |
1892 | int i; | 1889 | int i; |
1893 | dev_link_t *link = dev_to_instance(p_dev); | ||
1894 | 1890 | ||
1895 | for (i = 0; i < CM4000_MAX_DEV; i++) | 1891 | for (i = 0; i < CM4000_MAX_DEV; i++) |
1896 | if (dev_table[i] == NULL) | 1892 | if (dev_table[i] == NULL) |
@@ -1906,7 +1902,7 @@ static int cm4000_attach(struct pcmcia_device *p_dev) | |||
1906 | if (dev == NULL) | 1902 | if (dev == NULL) |
1907 | return -ENOMEM; | 1903 | return -ENOMEM; |
1908 | 1904 | ||
1909 | dev->p_dev = p_dev; | 1905 | dev->p_dev = link; |
1910 | link->priv = dev; | 1906 | link->priv = dev; |
1911 | link->conf.IntType = INT_MEMORY_AND_IO; | 1907 | link->conf.IntType = INT_MEMORY_AND_IO; |
1912 | dev_table[i] = link; | 1908 | dev_table[i] = link; |
@@ -1925,9 +1921,8 @@ static int cm4000_attach(struct pcmcia_device *p_dev) | |||
1925 | return 0; | 1921 | return 0; |
1926 | } | 1922 | } |
1927 | 1923 | ||
1928 | static void cm4000_detach(struct pcmcia_device *p_dev) | 1924 | static void cm4000_detach(struct pcmcia_device *link) |
1929 | { | 1925 | { |
1930 | dev_link_t *link = dev_to_instance(p_dev); | ||
1931 | struct cm4000_dev *dev = link->priv; | 1926 | struct cm4000_dev *dev = link->priv; |
1932 | int devno; | 1927 | int devno; |
1933 | 1928 | ||
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 97e32e7f84dc..8334226e103c 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -65,7 +65,7 @@ static char *version = | |||
65 | /* how often to poll for fifo status change */ | 65 | /* how often to poll for fifo status change */ |
66 | #define POLL_PERIOD msecs_to_jiffies(10) | 66 | #define POLL_PERIOD msecs_to_jiffies(10) |
67 | 67 | ||
68 | static void reader_release(dev_link_t *link); | 68 | static void reader_release(struct pcmcia_device *link); |
69 | 69 | ||
70 | static int major; | 70 | static int major; |
71 | static struct class *cmx_class; | 71 | static struct class *cmx_class; |
@@ -87,7 +87,7 @@ struct reader_dev { | |||
87 | struct timer_list poll_timer; | 87 | struct timer_list poll_timer; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static dev_link_t *dev_table[CM_MAX_DEV]; | 90 | static struct pcmcia_device *dev_table[CM_MAX_DEV]; |
91 | 91 | ||
92 | #ifndef PCMCIA_DEBUG | 92 | #ifndef PCMCIA_DEBUG |
93 | #define xoutb outb | 93 | #define xoutb outb |
@@ -445,7 +445,7 @@ static unsigned int cm4040_poll(struct file *filp, poll_table *wait) | |||
445 | static int cm4040_open(struct inode *inode, struct file *filp) | 445 | static int cm4040_open(struct inode *inode, struct file *filp) |
446 | { | 446 | { |
447 | struct reader_dev *dev; | 447 | struct reader_dev *dev; |
448 | dev_link_t *link; | 448 | struct pcmcia_device *link; |
449 | int minor = iminor(inode); | 449 | int minor = iminor(inode); |
450 | 450 | ||
451 | if (minor >= CM_MAX_DEV) | 451 | if (minor >= CM_MAX_DEV) |
@@ -478,7 +478,7 @@ static int cm4040_open(struct inode *inode, struct file *filp) | |||
478 | static int cm4040_close(struct inode *inode, struct file *filp) | 478 | static int cm4040_close(struct inode *inode, struct file *filp) |
479 | { | 479 | { |
480 | struct reader_dev *dev = filp->private_data; | 480 | struct reader_dev *dev = filp->private_data; |
481 | dev_link_t *link; | 481 | struct pcmcia_device *link; |
482 | int minor = iminor(inode); | 482 | int minor = iminor(inode); |
483 | 483 | ||
484 | DEBUGP(2, dev, "-> cm4040_close(maj/min=%d.%d)\n", imajor(inode), | 484 | DEBUGP(2, dev, "-> cm4040_close(maj/min=%d.%d)\n", imajor(inode), |
@@ -500,7 +500,7 @@ static int cm4040_close(struct inode *inode, struct file *filp) | |||
500 | return 0; | 500 | return 0; |
501 | } | 501 | } |
502 | 502 | ||
503 | static void cm4040_reader_release(dev_link_t *link) | 503 | static void cm4040_reader_release(struct pcmcia_device *link) |
504 | { | 504 | { |
505 | struct reader_dev *dev = link->priv; | 505 | struct reader_dev *dev = link->priv; |
506 | 506 | ||
@@ -514,9 +514,8 @@ static void cm4040_reader_release(dev_link_t *link) | |||
514 | return; | 514 | return; |
515 | } | 515 | } |
516 | 516 | ||
517 | static void reader_config(dev_link_t *link, int devno) | 517 | static void reader_config(struct pcmcia_device *link, int devno) |
518 | { | 518 | { |
519 | client_handle_t handle; | ||
520 | struct reader_dev *dev; | 519 | struct reader_dev *dev; |
521 | tuple_t tuple; | 520 | tuple_t tuple; |
522 | cisparse_t parse; | 521 | cisparse_t parse; |
@@ -524,23 +523,21 @@ static void reader_config(dev_link_t *link, int devno) | |||
524 | int fail_fn, fail_rc; | 523 | int fail_fn, fail_rc; |
525 | int rc; | 524 | int rc; |
526 | 525 | ||
527 | handle = link->handle; | ||
528 | |||
529 | tuple.DesiredTuple = CISTPL_CONFIG; | 526 | tuple.DesiredTuple = CISTPL_CONFIG; |
530 | tuple.Attributes = 0; | 527 | tuple.Attributes = 0; |
531 | tuple.TupleData = buf; | 528 | tuple.TupleData = buf; |
532 | tuple.TupleDataMax = sizeof(buf); | 529 | tuple.TupleDataMax = sizeof(buf); |
533 | tuple.TupleOffset = 0; | 530 | tuple.TupleOffset = 0; |
534 | 531 | ||
535 | if ((fail_rc = pcmcia_get_first_tuple(handle, &tuple)) != CS_SUCCESS) { | 532 | if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) { |
536 | fail_fn = GetFirstTuple; | 533 | fail_fn = GetFirstTuple; |
537 | goto cs_failed; | 534 | goto cs_failed; |
538 | } | 535 | } |
539 | if ((fail_rc = pcmcia_get_tuple_data(handle, &tuple)) != CS_SUCCESS) { | 536 | if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) { |
540 | fail_fn = GetTupleData; | 537 | fail_fn = GetTupleData; |
541 | goto cs_failed; | 538 | goto cs_failed; |
542 | } | 539 | } |
543 | if ((fail_rc = pcmcia_parse_tuple(handle, &tuple, &parse)) | 540 | if ((fail_rc = pcmcia_parse_tuple(link, &tuple, &parse)) |
544 | != CS_SUCCESS) { | 541 | != CS_SUCCESS) { |
545 | fail_fn = ParseTuple; | 542 | fail_fn = ParseTuple; |
546 | goto cs_failed; | 543 | goto cs_failed; |
@@ -554,13 +551,13 @@ static void reader_config(dev_link_t *link, int devno) | |||
554 | link->io.NumPorts2 = 0; | 551 | link->io.NumPorts2 = 0; |
555 | link->io.Attributes2 = 0; | 552 | link->io.Attributes2 = 0; |
556 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 553 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
557 | for (rc = pcmcia_get_first_tuple(handle, &tuple); | 554 | for (rc = pcmcia_get_first_tuple(link, &tuple); |
558 | rc == CS_SUCCESS; | 555 | rc == CS_SUCCESS; |
559 | rc = pcmcia_get_next_tuple(handle, &tuple)) { | 556 | rc = pcmcia_get_next_tuple(link, &tuple)) { |
560 | rc = pcmcia_get_tuple_data(handle, &tuple); | 557 | rc = pcmcia_get_tuple_data(link, &tuple); |
561 | if (rc != CS_SUCCESS) | 558 | if (rc != CS_SUCCESS) |
562 | continue; | 559 | continue; |
563 | rc = pcmcia_parse_tuple(handle, &tuple, &parse); | 560 | rc = pcmcia_parse_tuple(link, &tuple, &parse); |
564 | if (rc != CS_SUCCESS) | 561 | if (rc != CS_SUCCESS) |
565 | continue; | 562 | continue; |
566 | 563 | ||
@@ -578,13 +575,13 @@ static void reader_config(dev_link_t *link, int devno) | |||
578 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 575 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
579 | link->io.IOAddrLines = parse.cftable_entry.io.flags | 576 | link->io.IOAddrLines = parse.cftable_entry.io.flags |
580 | & CISTPL_IO_LINES_MASK; | 577 | & CISTPL_IO_LINES_MASK; |
581 | rc = pcmcia_request_io(handle, &link->io); | 578 | rc = pcmcia_request_io(link, &link->io); |
582 | 579 | ||
583 | dev_printk(KERN_INFO, &handle_to_dev(handle), "foo"); | 580 | dev_printk(KERN_INFO, &handle_to_dev(link), "foo"); |
584 | if (rc == CS_SUCCESS) | 581 | if (rc == CS_SUCCESS) |
585 | break; | 582 | break; |
586 | else | 583 | else |
587 | dev_printk(KERN_INFO, &handle_to_dev(handle), | 584 | dev_printk(KERN_INFO, &handle_to_dev(link), |
588 | "pcmcia_request_io failed 0x%x\n", rc); | 585 | "pcmcia_request_io failed 0x%x\n", rc); |
589 | } | 586 | } |
590 | if (rc != CS_SUCCESS) | 587 | if (rc != CS_SUCCESS) |
@@ -592,10 +589,10 @@ static void reader_config(dev_link_t *link, int devno) | |||
592 | 589 | ||
593 | link->conf.IntType = 00000002; | 590 | link->conf.IntType = 00000002; |
594 | 591 | ||
595 | if ((fail_rc = pcmcia_request_configuration(handle,&link->conf)) | 592 | if ((fail_rc = pcmcia_request_configuration(link,&link->conf)) |
596 | !=CS_SUCCESS) { | 593 | !=CS_SUCCESS) { |
597 | fail_fn = RequestConfiguration; | 594 | fail_fn = RequestConfiguration; |
598 | dev_printk(KERN_INFO, &handle_to_dev(handle), | 595 | dev_printk(KERN_INFO, &handle_to_dev(link), |
599 | "pcmcia_request_configuration failed 0x%x\n", | 596 | "pcmcia_request_configuration failed 0x%x\n", |
600 | fail_rc); | 597 | fail_rc); |
601 | goto cs_release; | 598 | goto cs_release; |
@@ -616,23 +613,22 @@ static void reader_config(dev_link_t *link, int devno) | |||
616 | return; | 613 | return; |
617 | 614 | ||
618 | cs_failed: | 615 | cs_failed: |
619 | cs_error(handle, fail_fn, fail_rc); | 616 | cs_error(link, fail_fn, fail_rc); |
620 | cs_release: | 617 | cs_release: |
621 | reader_release(link); | 618 | reader_release(link); |
622 | link->state &= ~DEV_CONFIG_PENDING; | 619 | link->state &= ~DEV_CONFIG_PENDING; |
623 | } | 620 | } |
624 | 621 | ||
625 | static void reader_release(dev_link_t *link) | 622 | static void reader_release(struct pcmcia_device *link) |
626 | { | 623 | { |
627 | cm4040_reader_release(link->priv); | 624 | cm4040_reader_release(link->priv); |
628 | pcmcia_disable_device(link->handle); | 625 | pcmcia_disable_device(link); |
629 | } | 626 | } |
630 | 627 | ||
631 | static int reader_attach(struct pcmcia_device *p_dev) | 628 | static int reader_attach(struct pcmcia_device *link) |
632 | { | 629 | { |
633 | struct reader_dev *dev; | 630 | struct reader_dev *dev; |
634 | int i; | 631 | int i; |
635 | dev_link_t *link = dev_to_instance(p_dev); | ||
636 | 632 | ||
637 | for (i = 0; i < CM_MAX_DEV; i++) { | 633 | for (i = 0; i < CM_MAX_DEV; i++) { |
638 | if (dev_table[i] == NULL) | 634 | if (dev_table[i] == NULL) |
@@ -650,7 +646,7 @@ static int reader_attach(struct pcmcia_device *p_dev) | |||
650 | dev->buffer_status = 0; | 646 | dev->buffer_status = 0; |
651 | 647 | ||
652 | link->priv = dev; | 648 | link->priv = dev; |
653 | dev->p_dev = p_dev; | 649 | dev->p_dev = link; |
654 | 650 | ||
655 | link->conf.IntType = INT_MEMORY_AND_IO; | 651 | link->conf.IntType = INT_MEMORY_AND_IO; |
656 | dev_table[i] = link; | 652 | dev_table[i] = link; |
@@ -671,9 +667,8 @@ static int reader_attach(struct pcmcia_device *p_dev) | |||
671 | return 0; | 667 | return 0; |
672 | } | 668 | } |
673 | 669 | ||
674 | static void reader_detach(struct pcmcia_device *p_dev) | 670 | static void reader_detach(struct pcmcia_device *link) |
675 | { | 671 | { |
676 | dev_link_t *link = dev_to_instance(p_dev); | ||
677 | struct reader_dev *dev = link->priv; | 672 | struct reader_dev *dev = link->priv; |
678 | int devno; | 673 | int devno; |
679 | 674 | ||
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 7b1e055184d1..9bfd90e5d6b7 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -484,7 +484,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout); | |||
484 | 484 | ||
485 | /* PCMCIA prototypes */ | 485 | /* PCMCIA prototypes */ |
486 | 486 | ||
487 | static void mgslpc_config(dev_link_t *link); | 487 | static void mgslpc_config(struct pcmcia_device *link); |
488 | static void mgslpc_release(u_long arg); | 488 | static void mgslpc_release(u_long arg); |
489 | static void mgslpc_detach(struct pcmcia_device *p_dev); | 489 | static void mgslpc_detach(struct pcmcia_device *p_dev); |
490 | 490 | ||
@@ -533,10 +533,9 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | static int mgslpc_attach(struct pcmcia_device *p_dev) | 536 | static int mgslpc_attach(struct pcmcia_device *link) |
537 | { | 537 | { |
538 | MGSLPC_INFO *info; | 538 | MGSLPC_INFO *info; |
539 | dev_link_t *link = dev_to_instance(p_dev); | ||
540 | 539 | ||
541 | if (debug_level >= DEBUG_LEVEL_INFO) | 540 | if (debug_level >= DEBUG_LEVEL_INFO) |
542 | printk("mgslpc_attach\n"); | 541 | printk("mgslpc_attach\n"); |
@@ -565,10 +564,10 @@ static int mgslpc_attach(struct pcmcia_device *p_dev) | |||
565 | info->imrb_value = 0xffff; | 564 | info->imrb_value = 0xffff; |
566 | info->pim_value = 0xff; | 565 | info->pim_value = 0xff; |
567 | 566 | ||
568 | info->p_dev = p_dev; | 567 | info->p_dev = link; |
569 | link->priv = info; | 568 | link->priv = info; |
570 | 569 | ||
571 | /* Initialize the dev_link_t structure */ | 570 | /* Initialize the struct pcmcia_device structure */ |
572 | 571 | ||
573 | /* Interrupt setup */ | 572 | /* Interrupt setup */ |
574 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 573 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
@@ -592,9 +591,8 @@ static int mgslpc_attach(struct pcmcia_device *p_dev) | |||
592 | #define CS_CHECK(fn, ret) \ | 591 | #define CS_CHECK(fn, ret) \ |
593 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 592 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
594 | 593 | ||
595 | static void mgslpc_config(dev_link_t *link) | 594 | static void mgslpc_config(struct pcmcia_device *link) |
596 | { | 595 | { |
597 | client_handle_t handle = link->handle; | ||
598 | MGSLPC_INFO *info = link->priv; | 596 | MGSLPC_INFO *info = link->priv; |
599 | tuple_t tuple; | 597 | tuple_t tuple; |
600 | cisparse_t parse; | 598 | cisparse_t parse; |
@@ -612,9 +610,9 @@ static void mgslpc_config(dev_link_t *link) | |||
612 | tuple.TupleData = buf; | 610 | tuple.TupleData = buf; |
613 | tuple.TupleDataMax = sizeof(buf); | 611 | tuple.TupleDataMax = sizeof(buf); |
614 | tuple.TupleOffset = 0; | 612 | tuple.TupleOffset = 0; |
615 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 613 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
616 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 614 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
617 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 615 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
618 | link->conf.ConfigBase = parse.config.base; | 616 | link->conf.ConfigBase = parse.config.base; |
619 | link->conf.Present = parse.config.rmask[0]; | 617 | link->conf.Present = parse.config.rmask[0]; |
620 | 618 | ||
@@ -624,11 +622,11 @@ static void mgslpc_config(dev_link_t *link) | |||
624 | /* get CIS configuration entry */ | 622 | /* get CIS configuration entry */ |
625 | 623 | ||
626 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 624 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
627 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 625 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
628 | 626 | ||
629 | cfg = &(parse.cftable_entry); | 627 | cfg = &(parse.cftable_entry); |
630 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 628 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
631 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 629 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
632 | 630 | ||
633 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; | 631 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; |
634 | if (cfg->index == 0) | 632 | if (cfg->index == 0) |
@@ -649,7 +647,7 @@ static void mgslpc_config(dev_link_t *link) | |||
649 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 647 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; |
650 | link->io.BasePort1 = io->win[0].base; | 648 | link->io.BasePort1 = io->win[0].base; |
651 | link->io.NumPorts1 = io->win[0].len; | 649 | link->io.NumPorts1 = io->win[0].len; |
652 | CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); | 650 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); |
653 | } | 651 | } |
654 | 652 | ||
655 | link->conf.Attributes = CONF_ENABLE_IRQ; | 653 | link->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -660,9 +658,9 @@ static void mgslpc_config(dev_link_t *link) | |||
660 | link->irq.Attributes |= IRQ_HANDLE_PRESENT; | 658 | link->irq.Attributes |= IRQ_HANDLE_PRESENT; |
661 | link->irq.Handler = mgslpc_isr; | 659 | link->irq.Handler = mgslpc_isr; |
662 | link->irq.Instance = info; | 660 | link->irq.Instance = info; |
663 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | 661 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
664 | 662 | ||
665 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | 663 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
666 | 664 | ||
667 | info->io_base = link->io.BasePort1; | 665 | info->io_base = link->io.BasePort1; |
668 | info->irq_level = link->irq.AssignedIRQ; | 666 | info->irq_level = link->irq.AssignedIRQ; |
@@ -685,7 +683,7 @@ static void mgslpc_config(dev_link_t *link) | |||
685 | return; | 683 | return; |
686 | 684 | ||
687 | cs_failed: | 685 | cs_failed: |
688 | cs_error(link->handle, last_fn, last_ret); | 686 | cs_error(link, last_fn, last_ret); |
689 | mgslpc_release((u_long)link); | 687 | mgslpc_release((u_long)link); |
690 | } | 688 | } |
691 | 689 | ||
@@ -695,18 +693,16 @@ cs_failed: | |||
695 | */ | 693 | */ |
696 | static void mgslpc_release(u_long arg) | 694 | static void mgslpc_release(u_long arg) |
697 | { | 695 | { |
698 | dev_link_t *link = (dev_link_t *)arg; | 696 | struct pcmcia_device *link = (struct pcmcia_device *)arg; |
699 | 697 | ||
700 | if (debug_level >= DEBUG_LEVEL_INFO) | 698 | if (debug_level >= DEBUG_LEVEL_INFO) |
701 | printk("mgslpc_release(0x%p)\n", link); | 699 | printk("mgslpc_release(0x%p)\n", link); |
702 | 700 | ||
703 | pcmcia_disable_device(link->handle); | 701 | pcmcia_disable_device(link); |
704 | } | 702 | } |
705 | 703 | ||
706 | static void mgslpc_detach(struct pcmcia_device *p_dev) | 704 | static void mgslpc_detach(struct pcmcia_device *link) |
707 | { | 705 | { |
708 | dev_link_t *link = dev_to_instance(p_dev); | ||
709 | |||
710 | if (debug_level >= DEBUG_LEVEL_INFO) | 706 | if (debug_level >= DEBUG_LEVEL_INFO) |
711 | printk("mgslpc_detach(0x%p)\n", link); | 707 | printk("mgslpc_detach(0x%p)\n", link); |
712 | 708 | ||
@@ -718,9 +714,8 @@ static void mgslpc_detach(struct pcmcia_device *p_dev) | |||
718 | mgslpc_remove_device((MGSLPC_INFO *)link->priv); | 714 | mgslpc_remove_device((MGSLPC_INFO *)link->priv); |
719 | } | 715 | } |
720 | 716 | ||
721 | static int mgslpc_suspend(struct pcmcia_device *dev) | 717 | static int mgslpc_suspend(struct pcmcia_device *link) |
722 | { | 718 | { |
723 | dev_link_t *link = dev_to_instance(dev); | ||
724 | MGSLPC_INFO *info = link->priv; | 719 | MGSLPC_INFO *info = link->priv; |
725 | 720 | ||
726 | info->stop = 1; | 721 | info->stop = 1; |
@@ -728,9 +723,8 @@ static int mgslpc_suspend(struct pcmcia_device *dev) | |||
728 | return 0; | 723 | return 0; |
729 | } | 724 | } |
730 | 725 | ||
731 | static int mgslpc_resume(struct pcmcia_device *dev) | 726 | static int mgslpc_resume(struct pcmcia_device *link) |
732 | { | 727 | { |
733 | dev_link_t *link = dev_to_instance(dev); | ||
734 | MGSLPC_INFO *info = link->priv; | 728 | MGSLPC_INFO *info = link->priv; |
735 | 729 | ||
736 | info->stop = 0; | 730 | info->stop = 0; |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 70bb1b8bab09..58690c1ff6ba 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -87,8 +87,8 @@ typedef struct ide_info_t { | |||
87 | int hd; | 87 | int hd; |
88 | } ide_info_t; | 88 | } ide_info_t; |
89 | 89 | ||
90 | static void ide_release(dev_link_t *); | 90 | static void ide_release(struct pcmcia_device *); |
91 | static void ide_config(dev_link_t *); | 91 | static void ide_config(struct pcmcia_device *); |
92 | 92 | ||
93 | static void ide_detach(struct pcmcia_device *p_dev); | 93 | static void ide_detach(struct pcmcia_device *p_dev); |
94 | 94 | ||
@@ -103,10 +103,9 @@ static void ide_detach(struct pcmcia_device *p_dev); | |||
103 | 103 | ||
104 | ======================================================================*/ | 104 | ======================================================================*/ |
105 | 105 | ||
106 | static int ide_attach(struct pcmcia_device *p_dev) | 106 | static int ide_attach(struct pcmcia_device *link) |
107 | { | 107 | { |
108 | ide_info_t *info; | 108 | ide_info_t *info; |
109 | dev_link_t *link = dev_to_instance(p_dev); | ||
110 | 109 | ||
111 | DEBUG(0, "ide_attach()\n"); | 110 | DEBUG(0, "ide_attach()\n"); |
112 | 111 | ||
@@ -115,7 +114,7 @@ static int ide_attach(struct pcmcia_device *p_dev) | |||
115 | if (!info) | 114 | if (!info) |
116 | return -ENOMEM; | 115 | return -ENOMEM; |
117 | 116 | ||
118 | info->p_dev = p_dev; | 117 | info->p_dev = link; |
119 | link->priv = info; | 118 | link->priv = info; |
120 | 119 | ||
121 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 120 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
@@ -141,10 +140,8 @@ static int ide_attach(struct pcmcia_device *p_dev) | |||
141 | 140 | ||
142 | ======================================================================*/ | 141 | ======================================================================*/ |
143 | 142 | ||
144 | static void ide_detach(struct pcmcia_device *p_dev) | 143 | static void ide_detach(struct pcmcia_device *link) |
145 | { | 144 | { |
146 | dev_link_t *link = dev_to_instance(p_dev); | ||
147 | |||
148 | DEBUG(0, "ide_detach(0x%p)\n", link); | 145 | DEBUG(0, "ide_detach(0x%p)\n", link); |
149 | 146 | ||
150 | if (link->state & DEV_CONFIG) | 147 | if (link->state & DEV_CONFIG) |
@@ -175,9 +172,8 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq | |||
175 | #define CS_CHECK(fn, ret) \ | 172 | #define CS_CHECK(fn, ret) \ |
176 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 173 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
177 | 174 | ||
178 | static void ide_config(dev_link_t *link) | 175 | static void ide_config(struct pcmcia_device *link) |
179 | { | 176 | { |
180 | client_handle_t handle = link->handle; | ||
181 | ide_info_t *info = link->priv; | 177 | ide_info_t *info = link->priv; |
182 | tuple_t tuple; | 178 | tuple_t tuple; |
183 | struct { | 179 | struct { |
@@ -201,16 +197,16 @@ static void ide_config(dev_link_t *link) | |||
201 | tuple.TupleDataMax = 255; | 197 | tuple.TupleDataMax = 255; |
202 | tuple.Attributes = 0; | 198 | tuple.Attributes = 0; |
203 | tuple.DesiredTuple = CISTPL_CONFIG; | 199 | tuple.DesiredTuple = CISTPL_CONFIG; |
204 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 200 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
205 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 201 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
206 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &stk->parse)); | 202 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &stk->parse)); |
207 | link->conf.ConfigBase = stk->parse.config.base; | 203 | link->conf.ConfigBase = stk->parse.config.base; |
208 | link->conf.Present = stk->parse.config.rmask[0]; | 204 | link->conf.Present = stk->parse.config.rmask[0]; |
209 | 205 | ||
210 | tuple.DesiredTuple = CISTPL_MANFID; | 206 | tuple.DesiredTuple = CISTPL_MANFID; |
211 | if (!pcmcia_get_first_tuple(handle, &tuple) && | 207 | if (!pcmcia_get_first_tuple(link, &tuple) && |
212 | !pcmcia_get_tuple_data(handle, &tuple) && | 208 | !pcmcia_get_tuple_data(link, &tuple) && |
213 | !pcmcia_parse_tuple(handle, &tuple, &stk->parse)) | 209 | !pcmcia_parse_tuple(link, &tuple, &stk->parse)) |
214 | is_kme = ((stk->parse.manfid.manf == MANFID_KME) && | 210 | is_kme = ((stk->parse.manfid.manf == MANFID_KME) && |
215 | ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || | 211 | ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || |
216 | (stk->parse.manfid.card == PRODID_KME_KXLC005_B))); | 212 | (stk->parse.manfid.card == PRODID_KME_KXLC005_B))); |
@@ -219,15 +215,15 @@ static void ide_config(dev_link_t *link) | |||
219 | link->state |= DEV_CONFIG; | 215 | link->state |= DEV_CONFIG; |
220 | 216 | ||
221 | /* Not sure if this is right... look up the current Vcc */ | 217 | /* Not sure if this is right... look up the current Vcc */ |
222 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &stk->conf)); | 218 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); |
223 | 219 | ||
224 | pass = io_base = ctl_base = 0; | 220 | pass = io_base = ctl_base = 0; |
225 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 221 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
226 | tuple.Attributes = 0; | 222 | tuple.Attributes = 0; |
227 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 223 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
228 | while (1) { | 224 | while (1) { |
229 | if (pcmcia_get_tuple_data(handle, &tuple) != 0) goto next_entry; | 225 | if (pcmcia_get_tuple_data(link, &tuple) != 0) goto next_entry; |
230 | if (pcmcia_parse_tuple(handle, &tuple, &stk->parse) != 0) goto next_entry; | 226 | if (pcmcia_parse_tuple(link, &tuple, &stk->parse) != 0) goto next_entry; |
231 | 227 | ||
232 | /* Check for matching Vcc, unless we're desperate */ | 228 | /* Check for matching Vcc, unless we're desperate */ |
233 | if (!pass) { | 229 | if (!pass) { |
@@ -258,14 +254,14 @@ static void ide_config(dev_link_t *link) | |||
258 | link->io.NumPorts1 = 8; | 254 | link->io.NumPorts1 = 8; |
259 | link->io.BasePort2 = io->win[1].base; | 255 | link->io.BasePort2 = io->win[1].base; |
260 | link->io.NumPorts2 = (is_kme) ? 2 : 1; | 256 | link->io.NumPorts2 = (is_kme) ? 2 : 1; |
261 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 257 | if (pcmcia_request_io(link, &link->io) != 0) |
262 | goto next_entry; | 258 | goto next_entry; |
263 | io_base = link->io.BasePort1; | 259 | io_base = link->io.BasePort1; |
264 | ctl_base = link->io.BasePort2; | 260 | ctl_base = link->io.BasePort2; |
265 | } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { | 261 | } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { |
266 | link->io.NumPorts1 = io->win[0].len; | 262 | link->io.NumPorts1 = io->win[0].len; |
267 | link->io.NumPorts2 = 0; | 263 | link->io.NumPorts2 = 0; |
268 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 264 | if (pcmcia_request_io(link, &link->io) != 0) |
269 | goto next_entry; | 265 | goto next_entry; |
270 | io_base = link->io.BasePort1; | 266 | io_base = link->io.BasePort1; |
271 | ctl_base = link->io.BasePort1 + 0x0e; | 267 | ctl_base = link->io.BasePort1 + 0x0e; |
@@ -278,16 +274,16 @@ static void ide_config(dev_link_t *link) | |||
278 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 274 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) |
279 | memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); | 275 | memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); |
280 | if (pass) { | 276 | if (pass) { |
281 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 277 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
282 | } else if (pcmcia_get_next_tuple(handle, &tuple) != 0) { | 278 | } else if (pcmcia_get_next_tuple(link, &tuple) != 0) { |
283 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 279 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
284 | memset(&stk->dflt, 0, sizeof(stk->dflt)); | 280 | memset(&stk->dflt, 0, sizeof(stk->dflt)); |
285 | pass++; | 281 | pass++; |
286 | } | 282 | } |
287 | } | 283 | } |
288 | 284 | ||
289 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 285 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
290 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 286 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
291 | 287 | ||
292 | /* disable drive interrupts during IDE probe */ | 288 | /* disable drive interrupts during IDE probe */ |
293 | outb(0x02, ctl_base); | 289 | outb(0x02, ctl_base); |
@@ -298,12 +294,12 @@ static void ide_config(dev_link_t *link) | |||
298 | 294 | ||
299 | /* retry registration in case device is still spinning up */ | 295 | /* retry registration in case device is still spinning up */ |
300 | for (hd = -1, i = 0; i < 10; i++) { | 296 | for (hd = -1, i = 0; i < 10; i++) { |
301 | hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, handle); | 297 | hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); |
302 | if (hd >= 0) break; | 298 | if (hd >= 0) break; |
303 | if (link->io.NumPorts1 == 0x20) { | 299 | if (link->io.NumPorts1 == 0x20) { |
304 | outb(0x02, ctl_base + 0x10); | 300 | outb(0x02, ctl_base + 0x10); |
305 | hd = idecs_register(io_base + 0x10, ctl_base + 0x10, | 301 | hd = idecs_register(io_base + 0x10, ctl_base + 0x10, |
306 | link->irq.AssignedIRQ, handle); | 302 | link->irq.AssignedIRQ, link); |
307 | if (hd >= 0) { | 303 | if (hd >= 0) { |
308 | io_base += 0x10; | 304 | io_base += 0x10; |
309 | ctl_base += 0x10; | 305 | ctl_base += 0x10; |
@@ -338,7 +334,7 @@ err_mem: | |||
338 | goto failed; | 334 | goto failed; |
339 | 335 | ||
340 | cs_failed: | 336 | cs_failed: |
341 | cs_error(link->handle, last_fn, last_ret); | 337 | cs_error(link, last_fn, last_ret); |
342 | failed: | 338 | failed: |
343 | kfree(stk); | 339 | kfree(stk); |
344 | ide_release(link); | 340 | ide_release(link); |
@@ -353,7 +349,7 @@ failed: | |||
353 | 349 | ||
354 | ======================================================================*/ | 350 | ======================================================================*/ |
355 | 351 | ||
356 | void ide_release(dev_link_t *link) | 352 | void ide_release(struct pcmcia_device *link) |
357 | { | 353 | { |
358 | ide_info_t *info = link->priv; | 354 | ide_info_t *info = link->priv; |
359 | 355 | ||
@@ -366,7 +362,7 @@ void ide_release(dev_link_t *link) | |||
366 | } | 362 | } |
367 | info->ndev = 0; | 363 | info->ndev = 0; |
368 | 364 | ||
369 | pcmcia_disable_device(link->handle); | 365 | pcmcia_disable_device(link); |
370 | } /* ide_release */ | 366 | } /* ide_release */ |
371 | 367 | ||
372 | 368 | ||
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 3b7461ece505..c9c794e2926d 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -51,8 +51,8 @@ MODULE_LICENSE("GPL"); | |||
51 | handler. | 51 | handler. |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static void avmcs_config(dev_link_t *link); | 54 | static void avmcs_config(struct pcmcia_device *link); |
55 | static void avmcs_release(dev_link_t *link); | 55 | static void avmcs_release(struct pcmcia_device *link); |
56 | 56 | ||
57 | /* | 57 | /* |
58 | The attach() and detach() entry points are used to create and destroy | 58 | The attach() and detach() entry points are used to create and destroy |
@@ -65,10 +65,10 @@ static void avmcs_detach(struct pcmcia_device *p_dev); | |||
65 | /* | 65 | /* |
66 | A linked list of "instances" of the skeleton device. Each actual | 66 | A linked list of "instances" of the skeleton device. Each actual |
67 | PCMCIA card corresponds to one device instance, and is described | 67 | PCMCIA card corresponds to one device instance, and is described |
68 | by one dev_link_t structure (defined in ds.h). | 68 | by one struct pcmcia_device structure (defined in ds.h). |
69 | 69 | ||
70 | You may not want to use a linked list for this -- for example, the | 70 | You may not want to use a linked list for this -- for example, the |
71 | memory card driver uses an array of dev_link_t pointers, where minor | 71 | memory card driver uses an array of struct pcmcia_device pointers, where minor |
72 | device numbers are used to derive the corresponding array index. | 72 | device numbers are used to derive the corresponding array index. |
73 | */ | 73 | */ |
74 | 74 | ||
@@ -78,7 +78,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev); | |||
78 | example, ethernet cards, modems). In other cases, there may be | 78 | example, ethernet cards, modems). In other cases, there may be |
79 | many actual or logical devices (SCSI adapters, memory cards with | 79 | many actual or logical devices (SCSI adapters, memory cards with |
80 | multiple partitions). The dev_node_t structures need to be kept | 80 | multiple partitions). The dev_node_t structures need to be kept |
81 | in a linked list starting at the 'dev' field of a dev_link_t | 81 | in a linked list starting at the 'dev' field of a struct pcmcia_device |
82 | structure. We allocate them in the card's private data structure, | 82 | structure. We allocate them in the card's private data structure, |
83 | because they generally can't be allocated dynamically. | 83 | because they generally can't be allocated dynamically. |
84 | */ | 84 | */ |
@@ -145,10 +145,8 @@ static int avmcs_attach(struct pcmcia_device *p_dev) | |||
145 | 145 | ||
146 | ======================================================================*/ | 146 | ======================================================================*/ |
147 | 147 | ||
148 | static void avmcs_detach(struct pcmcia_device *p_dev) | 148 | static void avmcs_detach(struct pcmcia_device *link) |
149 | { | 149 | { |
150 | dev_link_t *link = dev_to_instance(p_dev); | ||
151 | |||
152 | if (link->state & DEV_CONFIG) | 150 | if (link->state & DEV_CONFIG) |
153 | avmcs_release(link); | 151 | avmcs_release(link); |
154 | 152 | ||
@@ -163,7 +161,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev) | |||
163 | 161 | ||
164 | ======================================================================*/ | 162 | ======================================================================*/ |
165 | 163 | ||
166 | static int get_tuple(client_handle_t handle, tuple_t *tuple, | 164 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
167 | cisparse_t *parse) | 165 | cisparse_t *parse) |
168 | { | 166 | { |
169 | int i = pcmcia_get_tuple_data(handle, tuple); | 167 | int i = pcmcia_get_tuple_data(handle, tuple); |
@@ -171,7 +169,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, | |||
171 | return pcmcia_parse_tuple(handle, tuple, parse); | 169 | return pcmcia_parse_tuple(handle, tuple, parse); |
172 | } | 170 | } |
173 | 171 | ||
174 | static int first_tuple(client_handle_t handle, tuple_t *tuple, | 172 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
175 | cisparse_t *parse) | 173 | cisparse_t *parse) |
176 | { | 174 | { |
177 | int i = pcmcia_get_first_tuple(handle, tuple); | 175 | int i = pcmcia_get_first_tuple(handle, tuple); |
@@ -179,7 +177,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, | |||
179 | return get_tuple(handle, tuple, parse); | 177 | return get_tuple(handle, tuple, parse); |
180 | } | 178 | } |
181 | 179 | ||
182 | static int next_tuple(client_handle_t handle, tuple_t *tuple, | 180 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
183 | cisparse_t *parse) | 181 | cisparse_t *parse) |
184 | { | 182 | { |
185 | int i = pcmcia_get_next_tuple(handle, tuple); | 183 | int i = pcmcia_get_next_tuple(handle, tuple); |
@@ -187,9 +185,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, | |||
187 | return get_tuple(handle, tuple, parse); | 185 | return get_tuple(handle, tuple, parse); |
188 | } | 186 | } |
189 | 187 | ||
190 | static void avmcs_config(dev_link_t *link) | 188 | static void avmcs_config(struct pcmcia_device *link) |
191 | { | 189 | { |
192 | client_handle_t handle; | ||
193 | tuple_t tuple; | 190 | tuple_t tuple; |
194 | cisparse_t parse; | 191 | cisparse_t parse; |
195 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 192 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; |
@@ -199,8 +196,7 @@ static void avmcs_config(dev_link_t *link) | |||
199 | char devname[128]; | 196 | char devname[128]; |
200 | int cardtype; | 197 | int cardtype; |
201 | int (*addcard)(unsigned int port, unsigned irq); | 198 | int (*addcard)(unsigned int port, unsigned irq); |
202 | 199 | ||
203 | handle = link->handle; | ||
204 | dev = link->priv; | 200 | dev = link->priv; |
205 | 201 | ||
206 | /* | 202 | /* |
@@ -209,19 +205,19 @@ static void avmcs_config(dev_link_t *link) | |||
209 | */ | 205 | */ |
210 | do { | 206 | do { |
211 | tuple.DesiredTuple = CISTPL_CONFIG; | 207 | tuple.DesiredTuple = CISTPL_CONFIG; |
212 | i = pcmcia_get_first_tuple(handle, &tuple); | 208 | i = pcmcia_get_first_tuple(link, &tuple); |
213 | if (i != CS_SUCCESS) break; | 209 | if (i != CS_SUCCESS) break; |
214 | tuple.TupleData = buf; | 210 | tuple.TupleData = buf; |
215 | tuple.TupleDataMax = 64; | 211 | tuple.TupleDataMax = 64; |
216 | tuple.TupleOffset = 0; | 212 | tuple.TupleOffset = 0; |
217 | i = pcmcia_get_tuple_data(handle, &tuple); | 213 | i = pcmcia_get_tuple_data(link, &tuple); |
218 | if (i != CS_SUCCESS) break; | 214 | if (i != CS_SUCCESS) break; |
219 | i = pcmcia_parse_tuple(handle, &tuple, &parse); | 215 | i = pcmcia_parse_tuple(link, &tuple, &parse); |
220 | if (i != CS_SUCCESS) break; | 216 | if (i != CS_SUCCESS) break; |
221 | link->conf.ConfigBase = parse.config.base; | 217 | link->conf.ConfigBase = parse.config.base; |
222 | } while (0); | 218 | } while (0); |
223 | if (i != CS_SUCCESS) { | 219 | if (i != CS_SUCCESS) { |
224 | cs_error(link->handle, ParseTuple, i); | 220 | cs_error(link, ParseTuple, i); |
225 | link->state &= ~DEV_CONFIG_PENDING; | 221 | link->state &= ~DEV_CONFIG_PENDING; |
226 | return; | 222 | return; |
227 | } | 223 | } |
@@ -238,7 +234,7 @@ static void avmcs_config(dev_link_t *link) | |||
238 | tuple.DesiredTuple = CISTPL_VERS_1; | 234 | tuple.DesiredTuple = CISTPL_VERS_1; |
239 | 235 | ||
240 | devname[0] = 0; | 236 | devname[0] = 0; |
241 | if( !first_tuple(handle, &tuple, &parse) && parse.version_1.ns > 1 ) { | 237 | if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) { |
242 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], | 238 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], |
243 | sizeof(devname)); | 239 | sizeof(devname)); |
244 | } | 240 | } |
@@ -249,7 +245,7 @@ static void avmcs_config(dev_link_t *link) | |||
249 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 245 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
250 | tuple.Attributes = 0; | 246 | tuple.Attributes = 0; |
251 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 247 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
252 | i = first_tuple(handle, &tuple, &parse); | 248 | i = first_tuple(link, &tuple, &parse); |
253 | while (i == CS_SUCCESS) { | 249 | while (i == CS_SUCCESS) { |
254 | if (cf->io.nwin > 0) { | 250 | if (cf->io.nwin > 0) { |
255 | link->conf.ConfigIndex = cf->index; | 251 | link->conf.ConfigIndex = cf->index; |
@@ -259,36 +255,36 @@ static void avmcs_config(dev_link_t *link) | |||
259 | printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", | 255 | printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", |
260 | link->io.BasePort1, | 256 | link->io.BasePort1, |
261 | link->io.BasePort1+link->io.NumPorts1-1); | 257 | link->io.BasePort1+link->io.NumPorts1-1); |
262 | i = pcmcia_request_io(link->handle, &link->io); | 258 | i = pcmcia_request_io(link, &link->io); |
263 | if (i == CS_SUCCESS) goto found_port; | 259 | if (i == CS_SUCCESS) goto found_port; |
264 | } | 260 | } |
265 | i = next_tuple(handle, &tuple, &parse); | 261 | i = next_tuple(link, &tuple, &parse); |
266 | } | 262 | } |
267 | 263 | ||
268 | found_port: | 264 | found_port: |
269 | if (i != CS_SUCCESS) { | 265 | if (i != CS_SUCCESS) { |
270 | cs_error(link->handle, RequestIO, i); | 266 | cs_error(link, RequestIO, i); |
271 | break; | 267 | break; |
272 | } | 268 | } |
273 | 269 | ||
274 | /* | 270 | /* |
275 | * allocate an interrupt line | 271 | * allocate an interrupt line |
276 | */ | 272 | */ |
277 | i = pcmcia_request_irq(link->handle, &link->irq); | 273 | i = pcmcia_request_irq(link, &link->irq); |
278 | if (i != CS_SUCCESS) { | 274 | if (i != CS_SUCCESS) { |
279 | cs_error(link->handle, RequestIRQ, i); | 275 | cs_error(link, RequestIRQ, i); |
280 | /* undo */ | 276 | /* undo */ |
281 | pcmcia_disable_device(link->handle); | 277 | pcmcia_disable_device(link); |
282 | break; | 278 | break; |
283 | } | 279 | } |
284 | 280 | ||
285 | /* | 281 | /* |
286 | * configure the PCMCIA socket | 282 | * configure the PCMCIA socket |
287 | */ | 283 | */ |
288 | i = pcmcia_request_configuration(link->handle, &link->conf); | 284 | i = pcmcia_request_configuration(link, &link->conf); |
289 | if (i != CS_SUCCESS) { | 285 | if (i != CS_SUCCESS) { |
290 | cs_error(link->handle, RequestConfiguration, i); | 286 | cs_error(link, RequestConfiguration, i); |
291 | pcmcia_disable_device(link->handle); | 287 | pcmcia_disable_device(link); |
292 | break; | 288 | break; |
293 | } | 289 | } |
294 | 290 | ||
@@ -351,10 +347,10 @@ found_port: | |||
351 | 347 | ||
352 | ======================================================================*/ | 348 | ======================================================================*/ |
353 | 349 | ||
354 | static void avmcs_release(dev_link_t *link) | 350 | static void avmcs_release(struct pcmcia_device *link) |
355 | { | 351 | { |
356 | b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ); | 352 | b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ); |
357 | pcmcia_disable_device(link->handle); | 353 | pcmcia_disable_device(link); |
358 | } /* avmcs_release */ | 354 | } /* avmcs_release */ |
359 | 355 | ||
360 | 356 | ||
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index f7143fe1a2e7..ff6b0e185bc4 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -67,8 +67,8 @@ module_param(isdnprot, int, 0); | |||
67 | handler. | 67 | handler. |
68 | */ | 68 | */ |
69 | 69 | ||
70 | static void avma1cs_config(dev_link_t *link); | 70 | static void avma1cs_config(struct pcmcia_device *link); |
71 | static void avma1cs_release(dev_link_t *link); | 71 | static void avma1cs_release(struct pcmcia_device *link); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | The attach() and detach() entry points are used to create and destroy | 74 | The attach() and detach() entry points are used to create and destroy |
@@ -82,10 +82,10 @@ static void avma1cs_detach(struct pcmcia_device *p_dev); | |||
82 | /* | 82 | /* |
83 | A linked list of "instances" of the skeleton device. Each actual | 83 | A linked list of "instances" of the skeleton device. Each actual |
84 | PCMCIA card corresponds to one device instance, and is described | 84 | PCMCIA card corresponds to one device instance, and is described |
85 | by one dev_link_t structure (defined in ds.h). | 85 | by one struct pcmcia_device structure (defined in ds.h). |
86 | 86 | ||
87 | You may not want to use a linked list for this -- for example, the | 87 | You may not want to use a linked list for this -- for example, the |
88 | memory card driver uses an array of dev_link_t pointers, where minor | 88 | memory card driver uses an array of struct pcmcia_device pointers, where minor |
89 | device numbers are used to derive the corresponding array index. | 89 | device numbers are used to derive the corresponding array index. |
90 | */ | 90 | */ |
91 | 91 | ||
@@ -95,7 +95,7 @@ static void avma1cs_detach(struct pcmcia_device *p_dev); | |||
95 | example, ethernet cards, modems). In other cases, there may be | 95 | example, ethernet cards, modems). In other cases, there may be |
96 | many actual or logical devices (SCSI adapters, memory cards with | 96 | many actual or logical devices (SCSI adapters, memory cards with |
97 | multiple partitions). The dev_node_t structures need to be kept | 97 | multiple partitions). The dev_node_t structures need to be kept |
98 | in a linked list starting at the 'dev' field of a dev_link_t | 98 | in a linked list starting at the 'dev' field of a struct pcmcia_device |
99 | structure. We allocate them in the card's private data structure, | 99 | structure. We allocate them in the card's private data structure, |
100 | because they generally can't be allocated dynamically. | 100 | because they generally can't be allocated dynamically. |
101 | */ | 101 | */ |
@@ -164,10 +164,8 @@ static int avma1cs_attach(struct pcmcia_device *p_dev) | |||
164 | 164 | ||
165 | ======================================================================*/ | 165 | ======================================================================*/ |
166 | 166 | ||
167 | static void avma1cs_detach(struct pcmcia_device *p_dev) | 167 | static void avma1cs_detach(struct pcmcia_device *link) |
168 | { | 168 | { |
169 | dev_link_t *link = dev_to_instance(p_dev); | ||
170 | |||
171 | DEBUG(0, "avma1cs_detach(0x%p)\n", link); | 169 | DEBUG(0, "avma1cs_detach(0x%p)\n", link); |
172 | 170 | ||
173 | if (link->state & DEV_CONFIG) | 171 | if (link->state & DEV_CONFIG) |
@@ -184,7 +182,7 @@ static void avma1cs_detach(struct pcmcia_device *p_dev) | |||
184 | 182 | ||
185 | ======================================================================*/ | 183 | ======================================================================*/ |
186 | 184 | ||
187 | static int get_tuple(client_handle_t handle, tuple_t *tuple, | 185 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
188 | cisparse_t *parse) | 186 | cisparse_t *parse) |
189 | { | 187 | { |
190 | int i = pcmcia_get_tuple_data(handle, tuple); | 188 | int i = pcmcia_get_tuple_data(handle, tuple); |
@@ -192,7 +190,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, | |||
192 | return pcmcia_parse_tuple(handle, tuple, parse); | 190 | return pcmcia_parse_tuple(handle, tuple, parse); |
193 | } | 191 | } |
194 | 192 | ||
195 | static int first_tuple(client_handle_t handle, tuple_t *tuple, | 193 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
196 | cisparse_t *parse) | 194 | cisparse_t *parse) |
197 | { | 195 | { |
198 | int i = pcmcia_get_first_tuple(handle, tuple); | 196 | int i = pcmcia_get_first_tuple(handle, tuple); |
@@ -200,7 +198,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, | |||
200 | return get_tuple(handle, tuple, parse); | 198 | return get_tuple(handle, tuple, parse); |
201 | } | 199 | } |
202 | 200 | ||
203 | static int next_tuple(client_handle_t handle, tuple_t *tuple, | 201 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
204 | cisparse_t *parse) | 202 | cisparse_t *parse) |
205 | { | 203 | { |
206 | int i = pcmcia_get_next_tuple(handle, tuple); | 204 | int i = pcmcia_get_next_tuple(handle, tuple); |
@@ -208,9 +206,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, | |||
208 | return get_tuple(handle, tuple, parse); | 206 | return get_tuple(handle, tuple, parse); |
209 | } | 207 | } |
210 | 208 | ||
211 | static void avma1cs_config(dev_link_t *link) | 209 | static void avma1cs_config(struct pcmcia_device *link) |
212 | { | 210 | { |
213 | client_handle_t handle; | ||
214 | tuple_t tuple; | 211 | tuple_t tuple; |
215 | cisparse_t parse; | 212 | cisparse_t parse; |
216 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 213 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; |
@@ -220,8 +217,7 @@ static void avma1cs_config(dev_link_t *link) | |||
220 | char devname[128]; | 217 | char devname[128]; |
221 | IsdnCard_t icard; | 218 | IsdnCard_t icard; |
222 | int busy = 0; | 219 | int busy = 0; |
223 | 220 | ||
224 | handle = link->handle; | ||
225 | dev = link->priv; | 221 | dev = link->priv; |
226 | 222 | ||
227 | DEBUG(0, "avma1cs_config(0x%p)\n", link); | 223 | DEBUG(0, "avma1cs_config(0x%p)\n", link); |
@@ -232,19 +228,19 @@ static void avma1cs_config(dev_link_t *link) | |||
232 | */ | 228 | */ |
233 | do { | 229 | do { |
234 | tuple.DesiredTuple = CISTPL_CONFIG; | 230 | tuple.DesiredTuple = CISTPL_CONFIG; |
235 | i = pcmcia_get_first_tuple(handle, &tuple); | 231 | i = pcmcia_get_first_tuple(link, &tuple); |
236 | if (i != CS_SUCCESS) break; | 232 | if (i != CS_SUCCESS) break; |
237 | tuple.TupleData = buf; | 233 | tuple.TupleData = buf; |
238 | tuple.TupleDataMax = 64; | 234 | tuple.TupleDataMax = 64; |
239 | tuple.TupleOffset = 0; | 235 | tuple.TupleOffset = 0; |
240 | i = pcmcia_get_tuple_data(handle, &tuple); | 236 | i = pcmcia_get_tuple_data(link, &tuple); |
241 | if (i != CS_SUCCESS) break; | 237 | if (i != CS_SUCCESS) break; |
242 | i = pcmcia_parse_tuple(handle, &tuple, &parse); | 238 | i = pcmcia_parse_tuple(link, &tuple, &parse); |
243 | if (i != CS_SUCCESS) break; | 239 | if (i != CS_SUCCESS) break; |
244 | link->conf.ConfigBase = parse.config.base; | 240 | link->conf.ConfigBase = parse.config.base; |
245 | } while (0); | 241 | } while (0); |
246 | if (i != CS_SUCCESS) { | 242 | if (i != CS_SUCCESS) { |
247 | cs_error(link->handle, ParseTuple, i); | 243 | cs_error(link, ParseTuple, i); |
248 | link->state &= ~DEV_CONFIG_PENDING; | 244 | link->state &= ~DEV_CONFIG_PENDING; |
249 | return; | 245 | return; |
250 | } | 246 | } |
@@ -261,7 +257,7 @@ static void avma1cs_config(dev_link_t *link) | |||
261 | tuple.DesiredTuple = CISTPL_VERS_1; | 257 | tuple.DesiredTuple = CISTPL_VERS_1; |
262 | 258 | ||
263 | devname[0] = 0; | 259 | devname[0] = 0; |
264 | if( !first_tuple(handle, &tuple, &parse) && parse.version_1.ns > 1 ) { | 260 | if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) { |
265 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], | 261 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], |
266 | sizeof(devname)); | 262 | sizeof(devname)); |
267 | } | 263 | } |
@@ -272,7 +268,7 @@ static void avma1cs_config(dev_link_t *link) | |||
272 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 268 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
273 | tuple.Attributes = 0; | 269 | tuple.Attributes = 0; |
274 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 270 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
275 | i = first_tuple(handle, &tuple, &parse); | 271 | i = first_tuple(link, &tuple, &parse); |
276 | while (i == CS_SUCCESS) { | 272 | while (i == CS_SUCCESS) { |
277 | if (cf->io.nwin > 0) { | 273 | if (cf->io.nwin > 0) { |
278 | link->conf.ConfigIndex = cf->index; | 274 | link->conf.ConfigIndex = cf->index; |
@@ -282,36 +278,36 @@ static void avma1cs_config(dev_link_t *link) | |||
282 | printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", | 278 | printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", |
283 | link->io.BasePort1, | 279 | link->io.BasePort1, |
284 | link->io.BasePort1+link->io.NumPorts1 - 1); | 280 | link->io.BasePort1+link->io.NumPorts1 - 1); |
285 | i = pcmcia_request_io(link->handle, &link->io); | 281 | i = pcmcia_request_io(link, &link->io); |
286 | if (i == CS_SUCCESS) goto found_port; | 282 | if (i == CS_SUCCESS) goto found_port; |
287 | } | 283 | } |
288 | i = next_tuple(handle, &tuple, &parse); | 284 | i = next_tuple(link, &tuple, &parse); |
289 | } | 285 | } |
290 | 286 | ||
291 | found_port: | 287 | found_port: |
292 | if (i != CS_SUCCESS) { | 288 | if (i != CS_SUCCESS) { |
293 | cs_error(link->handle, RequestIO, i); | 289 | cs_error(link, RequestIO, i); |
294 | break; | 290 | break; |
295 | } | 291 | } |
296 | 292 | ||
297 | /* | 293 | /* |
298 | * allocate an interrupt line | 294 | * allocate an interrupt line |
299 | */ | 295 | */ |
300 | i = pcmcia_request_irq(link->handle, &link->irq); | 296 | i = pcmcia_request_irq(link, &link->irq); |
301 | if (i != CS_SUCCESS) { | 297 | if (i != CS_SUCCESS) { |
302 | cs_error(link->handle, RequestIRQ, i); | 298 | cs_error(link, RequestIRQ, i); |
303 | /* undo */ | 299 | /* undo */ |
304 | pcmcia_disable_device(link->handle); | 300 | pcmcia_disable_device(link); |
305 | break; | 301 | break; |
306 | } | 302 | } |
307 | 303 | ||
308 | /* | 304 | /* |
309 | * configure the PCMCIA socket | 305 | * configure the PCMCIA socket |
310 | */ | 306 | */ |
311 | i = pcmcia_request_configuration(link->handle, &link->conf); | 307 | i = pcmcia_request_configuration(link, &link->conf); |
312 | if (i != CS_SUCCESS) { | 308 | if (i != CS_SUCCESS) { |
313 | cs_error(link->handle, RequestConfiguration, i); | 309 | cs_error(link, RequestConfiguration, i); |
314 | pcmcia_disable_device(link->handle); | 310 | pcmcia_disable_device(link); |
315 | break; | 311 | break; |
316 | } | 312 | } |
317 | 313 | ||
@@ -358,7 +354,7 @@ found_port: | |||
358 | 354 | ||
359 | ======================================================================*/ | 355 | ======================================================================*/ |
360 | 356 | ||
361 | static void avma1cs_release(dev_link_t *link) | 357 | static void avma1cs_release(struct pcmcia_device *link) |
362 | { | 358 | { |
363 | local_info_t *local = link->priv; | 359 | local_info_t *local = link->priv; |
364 | 360 | ||
@@ -367,7 +363,7 @@ static void avma1cs_release(dev_link_t *link) | |||
367 | /* now unregister function with hisax */ | 363 | /* now unregister function with hisax */ |
368 | HiSax_closecard(local->node.minor); | 364 | HiSax_closecard(local->node.minor); |
369 | 365 | ||
370 | pcmcia_disable_device(link->handle); | 366 | pcmcia_disable_device(link); |
371 | } /* avma1cs_release */ | 367 | } /* avma1cs_release */ |
372 | 368 | ||
373 | 369 | ||
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index bcda675e9103..7a42bd43162f 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -94,8 +94,8 @@ module_param(protocol, int, 0); | |||
94 | handler. | 94 | handler. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | static void elsa_cs_config(dev_link_t *link); | 97 | static void elsa_cs_config(struct pcmcia_device *link); |
98 | static void elsa_cs_release(dev_link_t *link); | 98 | static void elsa_cs_release(struct pcmcia_device *link); |
99 | 99 | ||
100 | /* | 100 | /* |
101 | The attach() and detach() entry points are used to create and destroy | 101 | The attach() and detach() entry points are used to create and destroy |
@@ -111,7 +111,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev); | |||
111 | example, ethernet cards, modems). In other cases, there may be | 111 | example, ethernet cards, modems). In other cases, there may be |
112 | many actual or logical devices (SCSI adapters, memory cards with | 112 | many actual or logical devices (SCSI adapters, memory cards with |
113 | multiple partitions). The dev_node_t structures need to be kept | 113 | multiple partitions). The dev_node_t structures need to be kept |
114 | in a linked list starting at the 'dev' field of a dev_link_t | 114 | in a linked list starting at the 'dev' field of a struct pcmcia_device |
115 | structure. We allocate them in the card's private data structure, | 115 | structure. We allocate them in the card's private data structure, |
116 | because they generally shouldn't be allocated dynamically. | 116 | because they generally shouldn't be allocated dynamically. |
117 | In this case, we also provide a flag to indicate if a device is | 117 | In this case, we also provide a flag to indicate if a device is |
@@ -139,10 +139,9 @@ typedef struct local_info_t { | |||
139 | 139 | ||
140 | ======================================================================*/ | 140 | ======================================================================*/ |
141 | 141 | ||
142 | static int elsa_cs_attach(struct pcmcia_device *p_dev) | 142 | static int elsa_cs_attach(struct pcmcia_device *link) |
143 | { | 143 | { |
144 | local_info_t *local; | 144 | local_info_t *local; |
145 | dev_link_t *link = dev_to_instance(p_dev); | ||
146 | 145 | ||
147 | DEBUG(0, "elsa_cs_attach()\n"); | 146 | DEBUG(0, "elsa_cs_attach()\n"); |
148 | 147 | ||
@@ -151,7 +150,7 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev) | |||
151 | if (!local) return -ENOMEM; | 150 | if (!local) return -ENOMEM; |
152 | memset(local, 0, sizeof(local_info_t)); | 151 | memset(local, 0, sizeof(local_info_t)); |
153 | 152 | ||
154 | local->p_dev = p_dev; | 153 | local->p_dev = link; |
155 | link->priv = local; | 154 | link->priv = local; |
156 | 155 | ||
157 | local->cardnr = -1; | 156 | local->cardnr = -1; |
@@ -190,9 +189,8 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev) | |||
190 | 189 | ||
191 | ======================================================================*/ | 190 | ======================================================================*/ |
192 | 191 | ||
193 | static void elsa_cs_detach(struct pcmcia_device *p_dev) | 192 | static void elsa_cs_detach(struct pcmcia_device *link) |
194 | { | 193 | { |
195 | dev_link_t *link = dev_to_instance(p_dev); | ||
196 | local_info_t *info = link->priv; | 194 | local_info_t *info = link->priv; |
197 | 195 | ||
198 | DEBUG(0, "elsa_cs_detach(0x%p)\n", link); | 196 | DEBUG(0, "elsa_cs_detach(0x%p)\n", link); |
@@ -213,7 +211,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev) | |||
213 | device available to the system. | 211 | device available to the system. |
214 | 212 | ||
215 | ======================================================================*/ | 213 | ======================================================================*/ |
216 | static int get_tuple(client_handle_t handle, tuple_t *tuple, | 214 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
217 | cisparse_t *parse) | 215 | cisparse_t *parse) |
218 | { | 216 | { |
219 | int i = pcmcia_get_tuple_data(handle, tuple); | 217 | int i = pcmcia_get_tuple_data(handle, tuple); |
@@ -221,7 +219,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, | |||
221 | return pcmcia_parse_tuple(handle, tuple, parse); | 219 | return pcmcia_parse_tuple(handle, tuple, parse); |
222 | } | 220 | } |
223 | 221 | ||
224 | static int first_tuple(client_handle_t handle, tuple_t *tuple, | 222 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
225 | cisparse_t *parse) | 223 | cisparse_t *parse) |
226 | { | 224 | { |
227 | int i = pcmcia_get_first_tuple(handle, tuple); | 225 | int i = pcmcia_get_first_tuple(handle, tuple); |
@@ -229,7 +227,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, | |||
229 | return get_tuple(handle, tuple, parse); | 227 | return get_tuple(handle, tuple, parse); |
230 | } | 228 | } |
231 | 229 | ||
232 | static int next_tuple(client_handle_t handle, tuple_t *tuple, | 230 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
233 | cisparse_t *parse) | 231 | cisparse_t *parse) |
234 | { | 232 | { |
235 | int i = pcmcia_get_next_tuple(handle, tuple); | 233 | int i = pcmcia_get_next_tuple(handle, tuple); |
@@ -237,9 +235,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, | |||
237 | return get_tuple(handle, tuple, parse); | 235 | return get_tuple(handle, tuple, parse); |
238 | } | 236 | } |
239 | 237 | ||
240 | static void elsa_cs_config(dev_link_t *link) | 238 | static void elsa_cs_config(struct pcmcia_device *link) |
241 | { | 239 | { |
242 | client_handle_t handle; | ||
243 | tuple_t tuple; | 240 | tuple_t tuple; |
244 | cisparse_t parse; | 241 | cisparse_t parse; |
245 | local_info_t *dev; | 242 | local_info_t *dev; |
@@ -249,7 +246,6 @@ static void elsa_cs_config(dev_link_t *link) | |||
249 | IsdnCard_t icard; | 246 | IsdnCard_t icard; |
250 | 247 | ||
251 | DEBUG(0, "elsa_config(0x%p)\n", link); | 248 | DEBUG(0, "elsa_config(0x%p)\n", link); |
252 | handle = link->handle; | ||
253 | dev = link->priv; | 249 | dev = link->priv; |
254 | 250 | ||
255 | /* | 251 | /* |
@@ -261,7 +257,7 @@ static void elsa_cs_config(dev_link_t *link) | |||
261 | tuple.TupleDataMax = 255; | 257 | tuple.TupleDataMax = 255; |
262 | tuple.TupleOffset = 0; | 258 | tuple.TupleOffset = 0; |
263 | tuple.Attributes = 0; | 259 | tuple.Attributes = 0; |
264 | i = first_tuple(handle, &tuple, &parse); | 260 | i = first_tuple(link, &tuple, &parse); |
265 | if (i != CS_SUCCESS) { | 261 | if (i != CS_SUCCESS) { |
266 | last_fn = ParseTuple; | 262 | last_fn = ParseTuple; |
267 | goto cs_failed; | 263 | goto cs_failed; |
@@ -276,25 +272,25 @@ static void elsa_cs_config(dev_link_t *link) | |||
276 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 272 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
277 | tuple.Attributes = 0; | 273 | tuple.Attributes = 0; |
278 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 274 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
279 | i = first_tuple(handle, &tuple, &parse); | 275 | i = first_tuple(link, &tuple, &parse); |
280 | while (i == CS_SUCCESS) { | 276 | while (i == CS_SUCCESS) { |
281 | if ( (cf->io.nwin > 0) && cf->io.win[0].base) { | 277 | if ( (cf->io.nwin > 0) && cf->io.win[0].base) { |
282 | printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); | 278 | printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); |
283 | link->conf.ConfigIndex = cf->index; | 279 | link->conf.ConfigIndex = cf->index; |
284 | link->io.BasePort1 = cf->io.win[0].base; | 280 | link->io.BasePort1 = cf->io.win[0].base; |
285 | i = pcmcia_request_io(link->handle, &link->io); | 281 | i = pcmcia_request_io(link, &link->io); |
286 | if (i == CS_SUCCESS) break; | 282 | if (i == CS_SUCCESS) break; |
287 | } else { | 283 | } else { |
288 | printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); | 284 | printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); |
289 | link->conf.ConfigIndex = cf->index; | 285 | link->conf.ConfigIndex = cf->index; |
290 | for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { | 286 | for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { |
291 | link->io.BasePort1 = j; | 287 | link->io.BasePort1 = j; |
292 | i = pcmcia_request_io(link->handle, &link->io); | 288 | i = pcmcia_request_io(link, &link->io); |
293 | if (i == CS_SUCCESS) break; | 289 | if (i == CS_SUCCESS) break; |
294 | } | 290 | } |
295 | break; | 291 | break; |
296 | } | 292 | } |
297 | i = next_tuple(handle, &tuple, &parse); | 293 | i = next_tuple(link, &tuple, &parse); |
298 | } | 294 | } |
299 | 295 | ||
300 | if (i != CS_SUCCESS) { | 296 | if (i != CS_SUCCESS) { |
@@ -302,14 +298,14 @@ static void elsa_cs_config(dev_link_t *link) | |||
302 | goto cs_failed; | 298 | goto cs_failed; |
303 | } | 299 | } |
304 | 300 | ||
305 | i = pcmcia_request_irq(link->handle, &link->irq); | 301 | i = pcmcia_request_irq(link, &link->irq); |
306 | if (i != CS_SUCCESS) { | 302 | if (i != CS_SUCCESS) { |
307 | link->irq.AssignedIRQ = 0; | 303 | link->irq.AssignedIRQ = 0; |
308 | last_fn = RequestIRQ; | 304 | last_fn = RequestIRQ; |
309 | goto cs_failed; | 305 | goto cs_failed; |
310 | } | 306 | } |
311 | 307 | ||
312 | i = pcmcia_request_configuration(link->handle, &link->conf); | 308 | i = pcmcia_request_configuration(link, &link->conf); |
313 | if (i != CS_SUCCESS) { | 309 | if (i != CS_SUCCESS) { |
314 | last_fn = RequestConfiguration; | 310 | last_fn = RequestConfiguration; |
315 | goto cs_failed; | 311 | goto cs_failed; |
@@ -352,7 +348,7 @@ static void elsa_cs_config(dev_link_t *link) | |||
352 | 348 | ||
353 | return; | 349 | return; |
354 | cs_failed: | 350 | cs_failed: |
355 | cs_error(link->handle, last_fn, i); | 351 | cs_error(link, last_fn, i); |
356 | elsa_cs_release(link); | 352 | elsa_cs_release(link); |
357 | } /* elsa_cs_config */ | 353 | } /* elsa_cs_config */ |
358 | 354 | ||
@@ -364,7 +360,7 @@ cs_failed: | |||
364 | 360 | ||
365 | ======================================================================*/ | 361 | ======================================================================*/ |
366 | 362 | ||
367 | static void elsa_cs_release(dev_link_t *link) | 363 | static void elsa_cs_release(struct pcmcia_device *link) |
368 | { | 364 | { |
369 | local_info_t *local = link->priv; | 365 | local_info_t *local = link->priv; |
370 | 366 | ||
@@ -377,12 +373,11 @@ static void elsa_cs_release(dev_link_t *link) | |||
377 | } | 373 | } |
378 | } | 374 | } |
379 | 375 | ||
380 | pcmcia_disable_device(link->handle); | 376 | pcmcia_disable_device(link); |
381 | } /* elsa_cs_release */ | 377 | } /* elsa_cs_release */ |
382 | 378 | ||
383 | static int elsa_suspend(struct pcmcia_device *p_dev) | 379 | static int elsa_suspend(struct pcmcia_device *link) |
384 | { | 380 | { |
385 | dev_link_t *link = dev_to_instance(p_dev); | ||
386 | local_info_t *dev = link->priv; | 381 | local_info_t *dev = link->priv; |
387 | 382 | ||
388 | dev->busy = 1; | 383 | dev->busy = 1; |
@@ -390,9 +385,8 @@ static int elsa_suspend(struct pcmcia_device *p_dev) | |||
390 | return 0; | 385 | return 0; |
391 | } | 386 | } |
392 | 387 | ||
393 | static int elsa_resume(struct pcmcia_device *p_dev) | 388 | static int elsa_resume(struct pcmcia_device *link) |
394 | { | 389 | { |
395 | dev_link_t *link = dev_to_instance(p_dev); | ||
396 | local_info_t *dev = link->priv; | 390 | local_info_t *dev = link->priv; |
397 | 391 | ||
398 | dev->busy = 0; | 392 | dev->busy = 0; |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 6025722001fa..2af48a684654 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -95,8 +95,8 @@ module_param(protocol, int, 0); | |||
95 | event handler. | 95 | event handler. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | static void sedlbauer_config(dev_link_t *link); | 98 | static void sedlbauer_config(struct pcmcia_device *link); |
99 | static void sedlbauer_release(dev_link_t *link); | 99 | static void sedlbauer_release(struct pcmcia_device *link); |
100 | 100 | ||
101 | /* | 101 | /* |
102 | The attach() and detach() entry points are used to create and destroy | 102 | The attach() and detach() entry points are used to create and destroy |
@@ -119,7 +119,7 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev); | |||
119 | example, ethernet cards, modems). In other cases, there may be | 119 | example, ethernet cards, modems). In other cases, there may be |
120 | many actual or logical devices (SCSI adapters, memory cards with | 120 | many actual or logical devices (SCSI adapters, memory cards with |
121 | multiple partitions). The dev_node_t structures need to be kept | 121 | multiple partitions). The dev_node_t structures need to be kept |
122 | in a linked list starting at the 'dev' field of a dev_link_t | 122 | in a linked list starting at the 'dev' field of a struct pcmcia_device |
123 | structure. We allocate them in the card's private data structure, | 123 | structure. We allocate them in the card's private data structure, |
124 | because they generally shouldn't be allocated dynamically. | 124 | because they generally shouldn't be allocated dynamically. |
125 | 125 | ||
@@ -148,11 +148,10 @@ typedef struct local_info_t { | |||
148 | 148 | ||
149 | ======================================================================*/ | 149 | ======================================================================*/ |
150 | 150 | ||
151 | static int sedlbauer_attach(struct pcmcia_device *p_dev) | 151 | static int sedlbauer_attach(struct pcmcia_device *link) |
152 | { | 152 | { |
153 | local_info_t *local; | 153 | local_info_t *local; |
154 | dev_link_t *link = dev_to_instance(p_dev); | 154 | |
155 | |||
156 | DEBUG(0, "sedlbauer_attach()\n"); | 155 | DEBUG(0, "sedlbauer_attach()\n"); |
157 | 156 | ||
158 | /* Allocate space for private device-specific data */ | 157 | /* Allocate space for private device-specific data */ |
@@ -161,7 +160,7 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev) | |||
161 | memset(local, 0, sizeof(local_info_t)); | 160 | memset(local, 0, sizeof(local_info_t)); |
162 | local->cardnr = -1; | 161 | local->cardnr = -1; |
163 | 162 | ||
164 | local->p_dev = p_dev; | 163 | local->p_dev = link; |
165 | link->priv = local; | 164 | link->priv = local; |
166 | 165 | ||
167 | /* Interrupt setup */ | 166 | /* Interrupt setup */ |
@@ -202,10 +201,8 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev) | |||
202 | 201 | ||
203 | ======================================================================*/ | 202 | ======================================================================*/ |
204 | 203 | ||
205 | static void sedlbauer_detach(struct pcmcia_device *p_dev) | 204 | static void sedlbauer_detach(struct pcmcia_device *link) |
206 | { | 205 | { |
207 | dev_link_t *link = dev_to_instance(p_dev); | ||
208 | |||
209 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); | 206 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); |
210 | 207 | ||
211 | if (link->state & DEV_CONFIG) { | 208 | if (link->state & DEV_CONFIG) { |
@@ -227,9 +224,8 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev) | |||
227 | #define CS_CHECK(fn, ret) \ | 224 | #define CS_CHECK(fn, ret) \ |
228 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 225 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
229 | 226 | ||
230 | static void sedlbauer_config(dev_link_t *link) | 227 | static void sedlbauer_config(struct pcmcia_device *link) |
231 | { | 228 | { |
232 | client_handle_t handle = link->handle; | ||
233 | local_info_t *dev = link->priv; | 229 | local_info_t *dev = link->priv; |
234 | tuple_t tuple; | 230 | tuple_t tuple; |
235 | cisparse_t parse; | 231 | cisparse_t parse; |
@@ -251,16 +247,16 @@ static void sedlbauer_config(dev_link_t *link) | |||
251 | tuple.TupleData = buf; | 247 | tuple.TupleData = buf; |
252 | tuple.TupleDataMax = sizeof(buf); | 248 | tuple.TupleDataMax = sizeof(buf); |
253 | tuple.TupleOffset = 0; | 249 | tuple.TupleOffset = 0; |
254 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 250 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
255 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 251 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
256 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 252 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
257 | link->conf.ConfigBase = parse.config.base; | 253 | link->conf.ConfigBase = parse.config.base; |
258 | link->conf.Present = parse.config.rmask[0]; | 254 | link->conf.Present = parse.config.rmask[0]; |
259 | 255 | ||
260 | /* Configure card */ | 256 | /* Configure card */ |
261 | link->state |= DEV_CONFIG; | 257 | link->state |= DEV_CONFIG; |
262 | 258 | ||
263 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); | 259 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); |
264 | 260 | ||
265 | /* | 261 | /* |
266 | In this loop, we scan the CIS for configuration table entries, | 262 | In this loop, we scan the CIS for configuration table entries, |
@@ -275,12 +271,12 @@ static void sedlbauer_config(dev_link_t *link) | |||
275 | will only use the CIS to fill in implementation-defined details. | 271 | will only use the CIS to fill in implementation-defined details. |
276 | */ | 272 | */ |
277 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 273 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
278 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 274 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
279 | while (1) { | 275 | while (1) { |
280 | cistpl_cftable_entry_t dflt = { 0 }; | 276 | cistpl_cftable_entry_t dflt = { 0 }; |
281 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 277 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); |
282 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 278 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
283 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 279 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
284 | goto next_entry; | 280 | goto next_entry; |
285 | 281 | ||
286 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; | 282 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; |
@@ -334,13 +330,13 @@ static void sedlbauer_config(dev_link_t *link) | |||
334 | link->io.NumPorts2 = io->win[1].len; | 330 | link->io.NumPorts2 = io->win[1].len; |
335 | } | 331 | } |
336 | /* This reserves IO space but doesn't actually enable it */ | 332 | /* This reserves IO space but doesn't actually enable it */ |
337 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 333 | if (pcmcia_request_io(link, &link->io) != 0) |
338 | goto next_entry; | 334 | goto next_entry; |
339 | } | 335 | } |
340 | 336 | ||
341 | /* | 337 | /* |
342 | Now set up a common memory window, if needed. There is room | 338 | Now set up a common memory window, if needed. There is room |
343 | in the dev_link_t structure for one memory window handle, | 339 | in the struct pcmcia_device structure for one memory window handle, |
344 | but if the base addresses need to be saved, or if multiple | 340 | but if the base addresses need to be saved, or if multiple |
345 | windows are needed, the info should go in the private data | 341 | windows are needed, the info should go in the private data |
346 | structure for this device. | 342 | structure for this device. |
@@ -361,7 +357,7 @@ static void sedlbauer_config(dev_link_t *link) | |||
361 | req.Size = 0x1000; | 357 | req.Size = 0x1000; |
362 | */ | 358 | */ |
363 | req.AccessSpeed = 0; | 359 | req.AccessSpeed = 0; |
364 | if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) | 360 | if (pcmcia_request_window(&link, &req, &link->win) != 0) |
365 | goto next_entry; | 361 | goto next_entry; |
366 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; | 362 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; |
367 | if (pcmcia_map_mem_page(link->win, &map) != 0) | 363 | if (pcmcia_map_mem_page(link->win, &map) != 0) |
@@ -371,7 +367,7 @@ static void sedlbauer_config(dev_link_t *link) | |||
371 | break; | 367 | break; |
372 | 368 | ||
373 | next_entry: | 369 | next_entry: |
374 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 370 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
375 | } | 371 | } |
376 | 372 | ||
377 | /* | 373 | /* |
@@ -380,14 +376,14 @@ static void sedlbauer_config(dev_link_t *link) | |||
380 | irq structure is initialized. | 376 | irq structure is initialized. |
381 | */ | 377 | */ |
382 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 378 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
383 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | 379 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
384 | 380 | ||
385 | /* | 381 | /* |
386 | This actually configures the PCMCIA socket -- setting up | 382 | This actually configures the PCMCIA socket -- setting up |
387 | the I/O windows and the interrupt mapping, and putting the | 383 | the I/O windows and the interrupt mapping, and putting the |
388 | card and host interface into "Memory and IO" mode. | 384 | card and host interface into "Memory and IO" mode. |
389 | */ | 385 | */ |
390 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | 386 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
391 | 387 | ||
392 | /* | 388 | /* |
393 | At this point, the dev_node_t structure(s) need to be | 389 | At this point, the dev_node_t structure(s) need to be |
@@ -433,7 +429,7 @@ static void sedlbauer_config(dev_link_t *link) | |||
433 | return; | 429 | return; |
434 | 430 | ||
435 | cs_failed: | 431 | cs_failed: |
436 | cs_error(link->handle, last_fn, last_ret); | 432 | cs_error(link, last_fn, last_ret); |
437 | sedlbauer_release(link); | 433 | sedlbauer_release(link); |
438 | 434 | ||
439 | } /* sedlbauer_config */ | 435 | } /* sedlbauer_config */ |
@@ -446,7 +442,7 @@ cs_failed: | |||
446 | 442 | ||
447 | ======================================================================*/ | 443 | ======================================================================*/ |
448 | 444 | ||
449 | static void sedlbauer_release(dev_link_t *link) | 445 | static void sedlbauer_release(struct pcmcia_device *link) |
450 | { | 446 | { |
451 | local_info_t *local = link->priv; | 447 | local_info_t *local = link->priv; |
452 | DEBUG(0, "sedlbauer_release(0x%p)\n", link); | 448 | DEBUG(0, "sedlbauer_release(0x%p)\n", link); |
@@ -458,12 +454,11 @@ static void sedlbauer_release(dev_link_t *link) | |||
458 | } | 454 | } |
459 | } | 455 | } |
460 | 456 | ||
461 | pcmcia_disable_device(link->handle); | 457 | pcmcia_disable_device(link); |
462 | } /* sedlbauer_release */ | 458 | } /* sedlbauer_release */ |
463 | 459 | ||
464 | static int sedlbauer_suspend(struct pcmcia_device *p_dev) | 460 | static int sedlbauer_suspend(struct pcmcia_device *link) |
465 | { | 461 | { |
466 | dev_link_t *link = dev_to_instance(p_dev); | ||
467 | local_info_t *dev = link->priv; | 462 | local_info_t *dev = link->priv; |
468 | 463 | ||
469 | dev->stop = 1; | 464 | dev->stop = 1; |
@@ -471,9 +466,8 @@ static int sedlbauer_suspend(struct pcmcia_device *p_dev) | |||
471 | return 0; | 466 | return 0; |
472 | } | 467 | } |
473 | 468 | ||
474 | static int sedlbauer_resume(struct pcmcia_device *p_dev) | 469 | static int sedlbauer_resume(struct pcmcia_device *link) |
475 | { | 470 | { |
476 | dev_link_t *link = dev_to_instance(p_dev); | ||
477 | local_info_t *dev = link->priv; | 471 | local_info_t *dev = link->priv; |
478 | 472 | ||
479 | dev->stop = 0; | 473 | dev->stop = 0; |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index ea16ebfc028a..698e9ec95f0b 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -75,8 +75,8 @@ module_param(protocol, int, 0); | |||
75 | handler. | 75 | handler. |
76 | */ | 76 | */ |
77 | 77 | ||
78 | static void teles_cs_config(dev_link_t *link); | 78 | static void teles_cs_config(struct pcmcia_device *link); |
79 | static void teles_cs_release(dev_link_t *link); | 79 | static void teles_cs_release(struct pcmcia_device *link); |
80 | 80 | ||
81 | /* | 81 | /* |
82 | The attach() and detach() entry points are used to create and destroy | 82 | The attach() and detach() entry points are used to create and destroy |
@@ -89,10 +89,10 @@ static void teles_detach(struct pcmcia_device *p_dev); | |||
89 | /* | 89 | /* |
90 | A linked list of "instances" of the teles_cs device. Each actual | 90 | A linked list of "instances" of the teles_cs device. Each actual |
91 | PCMCIA card corresponds to one device instance, and is described | 91 | PCMCIA card corresponds to one device instance, and is described |
92 | by one dev_link_t structure (defined in ds.h). | 92 | by one struct pcmcia_device structure (defined in ds.h). |
93 | 93 | ||
94 | You may not want to use a linked list for this -- for example, the | 94 | You may not want to use a linked list for this -- for example, the |
95 | memory card driver uses an array of dev_link_t pointers, where minor | 95 | memory card driver uses an array of struct pcmcia_device pointers, where minor |
96 | device numbers are used to derive the corresponding array index. | 96 | device numbers are used to derive the corresponding array index. |
97 | */ | 97 | */ |
98 | 98 | ||
@@ -102,7 +102,7 @@ static void teles_detach(struct pcmcia_device *p_dev); | |||
102 | example, ethernet cards, modems). In other cases, there may be | 102 | example, ethernet cards, modems). In other cases, there may be |
103 | many actual or logical devices (SCSI adapters, memory cards with | 103 | many actual or logical devices (SCSI adapters, memory cards with |
104 | multiple partitions). The dev_node_t structures need to be kept | 104 | multiple partitions). The dev_node_t structures need to be kept |
105 | in a linked list starting at the 'dev' field of a dev_link_t | 105 | in a linked list starting at the 'dev' field of a struct pcmcia_device |
106 | structure. We allocate them in the card's private data structure, | 106 | structure. We allocate them in the card's private data structure, |
107 | because they generally shouldn't be allocated dynamically. | 107 | because they generally shouldn't be allocated dynamically. |
108 | In this case, we also provide a flag to indicate if a device is | 108 | In this case, we also provide a flag to indicate if a device is |
@@ -130,10 +130,9 @@ typedef struct local_info_t { | |||
130 | 130 | ||
131 | ======================================================================*/ | 131 | ======================================================================*/ |
132 | 132 | ||
133 | static int teles_attach(struct pcmcia_device *p_dev) | 133 | static int teles_attach(struct pcmcia_device *link) |
134 | { | 134 | { |
135 | local_info_t *local; | 135 | local_info_t *local; |
136 | dev_link_t *link = dev_to_instance(p_dev); | ||
137 | 136 | ||
138 | DEBUG(0, "teles_attach()\n"); | 137 | DEBUG(0, "teles_attach()\n"); |
139 | 138 | ||
@@ -143,7 +142,7 @@ static int teles_attach(struct pcmcia_device *p_dev) | |||
143 | memset(local, 0, sizeof(local_info_t)); | 142 | memset(local, 0, sizeof(local_info_t)); |
144 | local->cardnr = -1; | 143 | local->cardnr = -1; |
145 | 144 | ||
146 | local->p_dev = p_dev; | 145 | local->p_dev = link; |
147 | link->priv = local; | 146 | link->priv = local; |
148 | 147 | ||
149 | /* Interrupt setup */ | 148 | /* Interrupt setup */ |
@@ -180,9 +179,8 @@ static int teles_attach(struct pcmcia_device *p_dev) | |||
180 | 179 | ||
181 | ======================================================================*/ | 180 | ======================================================================*/ |
182 | 181 | ||
183 | static void teles_detach(struct pcmcia_device *p_dev) | 182 | static void teles_detach(struct pcmcia_device *link) |
184 | { | 183 | { |
185 | dev_link_t *link = dev_to_instance(p_dev); | ||
186 | local_info_t *info = link->priv; | 184 | local_info_t *info = link->priv; |
187 | 185 | ||
188 | DEBUG(0, "teles_detach(0x%p)\n", link); | 186 | DEBUG(0, "teles_detach(0x%p)\n", link); |
@@ -203,7 +201,7 @@ static void teles_detach(struct pcmcia_device *p_dev) | |||
203 | device available to the system. | 201 | device available to the system. |
204 | 202 | ||
205 | ======================================================================*/ | 203 | ======================================================================*/ |
206 | static int get_tuple(client_handle_t handle, tuple_t *tuple, | 204 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
207 | cisparse_t *parse) | 205 | cisparse_t *parse) |
208 | { | 206 | { |
209 | int i = pcmcia_get_tuple_data(handle, tuple); | 207 | int i = pcmcia_get_tuple_data(handle, tuple); |
@@ -211,7 +209,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, | |||
211 | return pcmcia_parse_tuple(handle, tuple, parse); | 209 | return pcmcia_parse_tuple(handle, tuple, parse); |
212 | } | 210 | } |
213 | 211 | ||
214 | static int first_tuple(client_handle_t handle, tuple_t *tuple, | 212 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
215 | cisparse_t *parse) | 213 | cisparse_t *parse) |
216 | { | 214 | { |
217 | int i = pcmcia_get_first_tuple(handle, tuple); | 215 | int i = pcmcia_get_first_tuple(handle, tuple); |
@@ -219,7 +217,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, | |||
219 | return get_tuple(handle, tuple, parse); | 217 | return get_tuple(handle, tuple, parse); |
220 | } | 218 | } |
221 | 219 | ||
222 | static int next_tuple(client_handle_t handle, tuple_t *tuple, | 220 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
223 | cisparse_t *parse) | 221 | cisparse_t *parse) |
224 | { | 222 | { |
225 | int i = pcmcia_get_next_tuple(handle, tuple); | 223 | int i = pcmcia_get_next_tuple(handle, tuple); |
@@ -227,9 +225,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, | |||
227 | return get_tuple(handle, tuple, parse); | 225 | return get_tuple(handle, tuple, parse); |
228 | } | 226 | } |
229 | 227 | ||
230 | static void teles_cs_config(dev_link_t *link) | 228 | static void teles_cs_config(struct pcmcia_device *link) |
231 | { | 229 | { |
232 | client_handle_t handle; | ||
233 | tuple_t tuple; | 230 | tuple_t tuple; |
234 | cisparse_t parse; | 231 | cisparse_t parse; |
235 | local_info_t *dev; | 232 | local_info_t *dev; |
@@ -239,7 +236,6 @@ static void teles_cs_config(dev_link_t *link) | |||
239 | IsdnCard_t icard; | 236 | IsdnCard_t icard; |
240 | 237 | ||
241 | DEBUG(0, "teles_config(0x%p)\n", link); | 238 | DEBUG(0, "teles_config(0x%p)\n", link); |
242 | handle = link->handle; | ||
243 | dev = link->priv; | 239 | dev = link->priv; |
244 | 240 | ||
245 | /* | 241 | /* |
@@ -251,7 +247,7 @@ static void teles_cs_config(dev_link_t *link) | |||
251 | tuple.TupleDataMax = 255; | 247 | tuple.TupleDataMax = 255; |
252 | tuple.TupleOffset = 0; | 248 | tuple.TupleOffset = 0; |
253 | tuple.Attributes = 0; | 249 | tuple.Attributes = 0; |
254 | i = first_tuple(handle, &tuple, &parse); | 250 | i = first_tuple(link, &tuple, &parse); |
255 | if (i != CS_SUCCESS) { | 251 | if (i != CS_SUCCESS) { |
256 | last_fn = ParseTuple; | 252 | last_fn = ParseTuple; |
257 | goto cs_failed; | 253 | goto cs_failed; |
@@ -266,25 +262,25 @@ static void teles_cs_config(dev_link_t *link) | |||
266 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 262 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
267 | tuple.Attributes = 0; | 263 | tuple.Attributes = 0; |
268 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 264 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
269 | i = first_tuple(handle, &tuple, &parse); | 265 | i = first_tuple(link, &tuple, &parse); |
270 | while (i == CS_SUCCESS) { | 266 | while (i == CS_SUCCESS) { |
271 | if ( (cf->io.nwin > 0) && cf->io.win[0].base) { | 267 | if ( (cf->io.nwin > 0) && cf->io.win[0].base) { |
272 | printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); | 268 | printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); |
273 | link->conf.ConfigIndex = cf->index; | 269 | link->conf.ConfigIndex = cf->index; |
274 | link->io.BasePort1 = cf->io.win[0].base; | 270 | link->io.BasePort1 = cf->io.win[0].base; |
275 | i = pcmcia_request_io(link->handle, &link->io); | 271 | i = pcmcia_request_io(link, &link->io); |
276 | if (i == CS_SUCCESS) break; | 272 | if (i == CS_SUCCESS) break; |
277 | } else { | 273 | } else { |
278 | printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); | 274 | printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); |
279 | link->conf.ConfigIndex = cf->index; | 275 | link->conf.ConfigIndex = cf->index; |
280 | for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { | 276 | for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { |
281 | link->io.BasePort1 = j; | 277 | link->io.BasePort1 = j; |
282 | i = pcmcia_request_io(link->handle, &link->io); | 278 | i = pcmcia_request_io(link, &link->io); |
283 | if (i == CS_SUCCESS) break; | 279 | if (i == CS_SUCCESS) break; |
284 | } | 280 | } |
285 | break; | 281 | break; |
286 | } | 282 | } |
287 | i = next_tuple(handle, &tuple, &parse); | 283 | i = next_tuple(link, &tuple, &parse); |
288 | } | 284 | } |
289 | 285 | ||
290 | if (i != CS_SUCCESS) { | 286 | if (i != CS_SUCCESS) { |
@@ -292,14 +288,14 @@ static void teles_cs_config(dev_link_t *link) | |||
292 | goto cs_failed; | 288 | goto cs_failed; |
293 | } | 289 | } |
294 | 290 | ||
295 | i = pcmcia_request_irq(link->handle, &link->irq); | 291 | i = pcmcia_request_irq(link, &link->irq); |
296 | if (i != CS_SUCCESS) { | 292 | if (i != CS_SUCCESS) { |
297 | link->irq.AssignedIRQ = 0; | 293 | link->irq.AssignedIRQ = 0; |
298 | last_fn = RequestIRQ; | 294 | last_fn = RequestIRQ; |
299 | goto cs_failed; | 295 | goto cs_failed; |
300 | } | 296 | } |
301 | 297 | ||
302 | i = pcmcia_request_configuration(link->handle, &link->conf); | 298 | i = pcmcia_request_configuration(link, &link->conf); |
303 | if (i != CS_SUCCESS) { | 299 | if (i != CS_SUCCESS) { |
304 | last_fn = RequestConfiguration; | 300 | last_fn = RequestConfiguration; |
305 | goto cs_failed; | 301 | goto cs_failed; |
@@ -342,7 +338,7 @@ static void teles_cs_config(dev_link_t *link) | |||
342 | 338 | ||
343 | return; | 339 | return; |
344 | cs_failed: | 340 | cs_failed: |
345 | cs_error(link->handle, last_fn, i); | 341 | cs_error(link, last_fn, i); |
346 | teles_cs_release(link); | 342 | teles_cs_release(link); |
347 | } /* teles_cs_config */ | 343 | } /* teles_cs_config */ |
348 | 344 | ||
@@ -354,7 +350,7 @@ cs_failed: | |||
354 | 350 | ||
355 | ======================================================================*/ | 351 | ======================================================================*/ |
356 | 352 | ||
357 | static void teles_cs_release(dev_link_t *link) | 353 | static void teles_cs_release(struct pcmcia_device *link) |
358 | { | 354 | { |
359 | local_info_t *local = link->priv; | 355 | local_info_t *local = link->priv; |
360 | 356 | ||
@@ -367,12 +363,11 @@ static void teles_cs_release(dev_link_t *link) | |||
367 | } | 363 | } |
368 | } | 364 | } |
369 | 365 | ||
370 | pcmcia_disable_device(link->handle); | 366 | pcmcia_disable_device(link); |
371 | } /* teles_cs_release */ | 367 | } /* teles_cs_release */ |
372 | 368 | ||
373 | static int teles_suspend(struct pcmcia_device *p_dev) | 369 | static int teles_suspend(struct pcmcia_device *link) |
374 | { | 370 | { |
375 | dev_link_t *link = dev_to_instance(p_dev); | ||
376 | local_info_t *dev = link->priv; | 371 | local_info_t *dev = link->priv; |
377 | 372 | ||
378 | dev->busy = 1; | 373 | dev->busy = 1; |
@@ -380,9 +375,8 @@ static int teles_suspend(struct pcmcia_device *p_dev) | |||
380 | return 0; | 375 | return 0; |
381 | } | 376 | } |
382 | 377 | ||
383 | static int teles_resume(struct pcmcia_device *p_dev) | 378 | static int teles_resume(struct pcmcia_device *link) |
384 | { | 379 | { |
385 | dev_link_t *link = dev_to_instance(p_dev); | ||
386 | local_info_t *dev = link->priv; | 380 | local_info_t *dev = link->priv; |
387 | 381 | ||
388 | dev->busy = 0; | 382 | dev->busy = 0; |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 8259dca97e20..e9086f0cb2fa 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -122,7 +122,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) | |||
122 | dev->offset, mrq.CardOffset); | 122 | dev->offset, mrq.CardOffset); |
123 | mrq.Page = 0; | 123 | mrq.Page = 0; |
124 | if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { | 124 | if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { |
125 | cs_error(dev->p_dev->handle, MapMemPage, ret); | 125 | cs_error(dev->p_dev, MapMemPage, ret); |
126 | return NULL; | 126 | return NULL; |
127 | } | 127 | } |
128 | dev->offset = mrq.CardOffset; | 128 | dev->offset = mrq.CardOffset; |
@@ -319,7 +319,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f | |||
319 | static void pcmciamtd_set_vpp(struct map_info *map, int on) | 319 | static void pcmciamtd_set_vpp(struct map_info *map, int on) |
320 | { | 320 | { |
321 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 321 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
322 | dev_link_t *link = dev->p_dev; | 322 | struct pcmcia_device *link = dev->p_dev; |
323 | modconf_t mod; | 323 | modconf_t mod; |
324 | int ret; | 324 | int ret; |
325 | 325 | ||
@@ -328,9 +328,9 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
328 | mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; | 328 | mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; |
329 | 329 | ||
330 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); | 330 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); |
331 | ret = pcmcia_modify_configuration(link->handle, &mod); | 331 | ret = pcmcia_modify_configuration(link, &mod); |
332 | if(ret != CS_SUCCESS) { | 332 | if(ret != CS_SUCCESS) { |
333 | cs_error(link->handle, ModifyConfiguration, ret); | 333 | cs_error(link, ModifyConfiguration, ret); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
@@ -340,7 +340,7 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
340 | * still open, this will be postponed until it is closed. | 340 | * still open, this will be postponed until it is closed. |
341 | */ | 341 | */ |
342 | 342 | ||
343 | static void pcmciamtd_release(dev_link_t *link) | 343 | static void pcmciamtd_release(struct pcmcia_device *link) |
344 | { | 344 | { |
345 | struct pcmciamtd_dev *dev = link->priv; | 345 | struct pcmciamtd_dev *dev = link->priv; |
346 | 346 | ||
@@ -353,11 +353,11 @@ static void pcmciamtd_release(dev_link_t *link) | |||
353 | } | 353 | } |
354 | pcmcia_release_window(link->win); | 354 | pcmcia_release_window(link->win); |
355 | } | 355 | } |
356 | pcmcia_disable_device(link->handle); | 356 | pcmcia_disable_device(link); |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_name) | 360 | static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name) |
361 | { | 361 | { |
362 | int rc; | 362 | int rc; |
363 | tuple_t tuple; | 363 | tuple_t tuple; |
@@ -370,16 +370,16 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ | |||
370 | tuple.TupleOffset = 0; | 370 | tuple.TupleOffset = 0; |
371 | tuple.DesiredTuple = RETURN_FIRST_TUPLE; | 371 | tuple.DesiredTuple = RETURN_FIRST_TUPLE; |
372 | 372 | ||
373 | rc = pcmcia_get_first_tuple(link->handle, &tuple); | 373 | rc = pcmcia_get_first_tuple(link, &tuple); |
374 | while(rc == CS_SUCCESS) { | 374 | while(rc == CS_SUCCESS) { |
375 | rc = pcmcia_get_tuple_data(link->handle, &tuple); | 375 | rc = pcmcia_get_tuple_data(link, &tuple); |
376 | if(rc != CS_SUCCESS) { | 376 | if(rc != CS_SUCCESS) { |
377 | cs_error(link->handle, GetTupleData, rc); | 377 | cs_error(link, GetTupleData, rc); |
378 | break; | 378 | break; |
379 | } | 379 | } |
380 | rc = pcmcia_parse_tuple(link->handle, &tuple, &parse); | 380 | rc = pcmcia_parse_tuple(link, &tuple, &parse); |
381 | if(rc != CS_SUCCESS) { | 381 | if(rc != CS_SUCCESS) { |
382 | cs_error(link->handle, ParseTuple, rc); | 382 | cs_error(link, ParseTuple, rc); |
383 | break; | 383 | break; |
384 | } | 384 | } |
385 | 385 | ||
@@ -450,7 +450,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ | |||
450 | DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); | 450 | DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); |
451 | } | 451 | } |
452 | 452 | ||
453 | rc = pcmcia_get_next_tuple(link->handle, &tuple); | 453 | rc = pcmcia_get_next_tuple(link, &tuple); |
454 | } | 454 | } |
455 | if(!dev->pcmcia_map.size) | 455 | if(!dev->pcmcia_map.size) |
456 | dev->pcmcia_map.size = MAX_PCMCIA_ADDR; | 456 | dev->pcmcia_map.size = MAX_PCMCIA_ADDR; |
@@ -487,7 +487,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ | |||
487 | #define CS_CHECK(fn, ret) \ | 487 | #define CS_CHECK(fn, ret) \ |
488 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 488 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
489 | 489 | ||
490 | static void pcmciamtd_config(dev_link_t *link) | 490 | static void pcmciamtd_config(struct pcmcia_device *link) |
491 | { | 491 | { |
492 | struct pcmciamtd_dev *dev = link->priv; | 492 | struct pcmciamtd_dev *dev = link->priv; |
493 | struct mtd_info *mtd = NULL; | 493 | struct mtd_info *mtd = NULL; |
@@ -507,9 +507,9 @@ static void pcmciamtd_config(dev_link_t *link) | |||
507 | link->state |= DEV_CONFIG; | 507 | link->state |= DEV_CONFIG; |
508 | 508 | ||
509 | DEBUG(2, "Validating CIS"); | 509 | DEBUG(2, "Validating CIS"); |
510 | ret = pcmcia_validate_cis(link->handle, &cisinfo); | 510 | ret = pcmcia_validate_cis(link, &cisinfo); |
511 | if(ret != CS_SUCCESS) { | 511 | if(ret != CS_SUCCESS) { |
512 | cs_error(link->handle, GetTupleData, ret); | 512 | cs_error(link, GetTupleData, ret); |
513 | } else { | 513 | } else { |
514 | DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains); | 514 | DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains); |
515 | } | 515 | } |
@@ -537,7 +537,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
537 | req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; | 537 | req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; |
538 | req.Base = 0; | 538 | req.Base = 0; |
539 | req.AccessSpeed = mem_speed; | 539 | req.AccessSpeed = mem_speed; |
540 | link->win = (window_handle_t)link->handle; | 540 | link->win = (window_handle_t)link; |
541 | req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; | 541 | req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; |
542 | dev->win_size = 0; | 542 | dev->win_size = 0; |
543 | 543 | ||
@@ -545,7 +545,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
545 | int ret; | 545 | int ret; |
546 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", | 546 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", |
547 | req.Size >> 10, req.AccessSpeed); | 547 | req.Size >> 10, req.AccessSpeed); |
548 | ret = pcmcia_request_window(&link->handle, &req, &link->win); | 548 | ret = pcmcia_request_window(&link, &req, &link->win); |
549 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); | 549 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); |
550 | if(ret) { | 550 | if(ret) { |
551 | req.Size >>= 1; | 551 | req.Size >>= 1; |
@@ -566,7 +566,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
566 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 566 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); |
567 | 567 | ||
568 | /* Get write protect status */ | 568 | /* Get write protect status */ |
569 | CS_CHECK(GetStatus, pcmcia_get_status(link->handle, &status)); | 569 | CS_CHECK(GetStatus, pcmcia_get_status(link, &status)); |
570 | DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", | 570 | DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", |
571 | status.CardState, (unsigned long)link->win); | 571 | status.CardState, (unsigned long)link->win); |
572 | dev->win_base = ioremap(req.Base, req.Size); | 572 | dev->win_base = ioremap(req.Base, req.Size); |
@@ -583,7 +583,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
583 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; | 583 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; |
584 | 584 | ||
585 | DEBUG(2, "Getting configuration"); | 585 | DEBUG(2, "Getting configuration"); |
586 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link->handle, &t)); | 586 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &t)); |
587 | DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2); | 587 | DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2); |
588 | dev->vpp = (vpp) ? vpp : t.Vpp1; | 588 | dev->vpp = (vpp) ? vpp : t.Vpp1; |
589 | link->conf.Attributes = 0; | 589 | link->conf.Attributes = 0; |
@@ -602,9 +602,9 @@ static void pcmciamtd_config(dev_link_t *link) | |||
602 | link->conf.ConfigIndex = 0; | 602 | link->conf.ConfigIndex = 0; |
603 | link->conf.Present = t.Present; | 603 | link->conf.Present = t.Present; |
604 | DEBUG(2, "Setting Configuration"); | 604 | DEBUG(2, "Setting Configuration"); |
605 | ret = pcmcia_request_configuration(link->handle, &link->conf); | 605 | ret = pcmcia_request_configuration(link, &link->conf); |
606 | if(ret != CS_SUCCESS) { | 606 | if(ret != CS_SUCCESS) { |
607 | cs_error(link->handle, RequestConfiguration, ret); | 607 | cs_error(link, RequestConfiguration, ret); |
608 | } | 608 | } |
609 | 609 | ||
610 | if(mem_type == 1) { | 610 | if(mem_type == 1) { |
@@ -677,7 +677,7 @@ static void pcmciamtd_config(dev_link_t *link) | |||
677 | return; | 677 | return; |
678 | 678 | ||
679 | cs_failed: | 679 | cs_failed: |
680 | cs_error(link->handle, last_fn, last_ret); | 680 | cs_error(link, last_fn, last_ret); |
681 | err("CS Error, exiting"); | 681 | err("CS Error, exiting"); |
682 | pcmciamtd_release(link); | 682 | pcmciamtd_release(link); |
683 | return; | 683 | return; |
@@ -709,10 +709,8 @@ static int pcmciamtd_resume(struct pcmcia_device *dev) | |||
709 | * when the device is released. | 709 | * when the device is released. |
710 | */ | 710 | */ |
711 | 711 | ||
712 | static void pcmciamtd_detach(struct pcmcia_device *p_dev) | 712 | static void pcmciamtd_detach(struct pcmcia_device *link) |
713 | { | 713 | { |
714 | dev_link_t *link = dev_to_instance(p_dev); | ||
715 | |||
716 | DEBUG(3, "link=0x%p", link); | 714 | DEBUG(3, "link=0x%p", link); |
717 | 715 | ||
718 | if(link->state & DEV_CONFIG) { | 716 | if(link->state & DEV_CONFIG) { |
@@ -732,10 +730,9 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev) | |||
732 | * with Card Services. | 730 | * with Card Services. |
733 | */ | 731 | */ |
734 | 732 | ||
735 | static int pcmciamtd_attach(struct pcmcia_device *p_dev) | 733 | static int pcmciamtd_attach(struct pcmcia_device *link) |
736 | { | 734 | { |
737 | struct pcmciamtd_dev *dev; | 735 | struct pcmciamtd_dev *dev; |
738 | dev_link_t *link = dev_to_instance(p_dev); | ||
739 | 736 | ||
740 | /* Create new memory card device */ | 737 | /* Create new memory card device */ |
741 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 738 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); |
@@ -743,7 +740,7 @@ static int pcmciamtd_attach(struct pcmcia_device *p_dev) | |||
743 | DEBUG(1, "dev=0x%p", dev); | 740 | DEBUG(1, "dev=0x%p", dev); |
744 | 741 | ||
745 | memset(dev, 0, sizeof(*dev)); | 742 | memset(dev, 0, sizeof(*dev)); |
746 | dev->p_dev = p_dev; | 743 | dev->p_dev = link; |
747 | link->priv = dev; | 744 | link->priv = dev; |
748 | 745 | ||
749 | link->conf.Attributes = 0; | 746 | link->conf.Attributes = 0; |
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 | ||
228 | static void tc574_config(dev_link_t *link); | 228 | static void tc574_config(struct pcmcia_device *link); |
229 | static void tc574_release(dev_link_t *link); | 229 | static void tc574_release(struct pcmcia_device *link); |
230 | 230 | ||
231 | static void mdio_sync(kio_addr_t ioaddr, int bits); | 231 | static void mdio_sync(kio_addr_t ioaddr, int bits); |
232 | static int mdio_read(kio_addr_t ioaddr, int phy_id, int location); | 232 | static 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 | ||
259 | static int tc574_attach(struct pcmcia_device *p_dev) | 259 | static 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 | ||
315 | static void tc574_detach(struct pcmcia_device *p_dev) | 314 | static 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 | ||
340 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 338 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
341 | 339 | ||
342 | static void tc574_config(dev_link_t *link) | 340 | static 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 | ||
494 | cs_failed: | 491 | cs_failed: |
495 | cs_error(link->handle, last_fn, last_ret); | 492 | cs_error(link, last_fn, last_ret); |
496 | failed: | 493 | failed: |
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 | ||
508 | static void tc574_release(dev_link_t *link) | 505 | static void tc574_release(struct pcmcia_device *link) |
509 | { | 506 | { |
510 | pcmcia_disable_device(link->handle); | 507 | pcmcia_disable_device(link); |
511 | } | 508 | } |
512 | 509 | ||
513 | static int tc574_suspend(struct pcmcia_device *p_dev) | 510 | static 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 | ||
524 | static int tc574_resume(struct pcmcia_device *p_dev) | 520 | static 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) | |||
739 | static int el3_open(struct net_device *dev) | 734 | static 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 | ||
145 | static void tc589_config(dev_link_t *link); | 145 | static void tc589_config(struct pcmcia_device *link); |
146 | static void tc589_release(dev_link_t *link); | 146 | static void tc589_release(struct pcmcia_device *link); |
147 | 147 | ||
148 | static u16 read_eeprom(kio_addr_t ioaddr, int index); | 148 | static u16 read_eeprom(kio_addr_t ioaddr, int index); |
149 | static void tc589_reset(struct net_device *dev); | 149 | static 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 | ||
173 | static int tc589_attach(struct pcmcia_device *p_dev) | 173 | static 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 | ||
230 | static void tc589_detach(struct pcmcia_device *p_dev) | 229 | static 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) \ |
255 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 253 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
256 | 254 | ||
257 | static void tc589_config(dev_link_t *link) | 255 | static 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 | ||
367 | cs_failed: | 364 | cs_failed: |
368 | cs_error(link->handle, last_fn, last_ret); | 365 | cs_error(link, last_fn, last_ret); |
369 | failed: | 366 | failed: |
370 | tc589_release(link); | 367 | tc589_release(link); |
371 | return; | 368 | return; |
@@ -380,14 +377,13 @@ failed: | |||
380 | 377 | ||
381 | ======================================================================*/ | 378 | ======================================================================*/ |
382 | 379 | ||
383 | static void tc589_release(dev_link_t *link) | 380 | static void tc589_release(struct pcmcia_device *link) |
384 | { | 381 | { |
385 | pcmcia_disable_device(link->handle); | 382 | pcmcia_disable_device(link); |
386 | } | 383 | } |
387 | 384 | ||
388 | static int tc589_suspend(struct pcmcia_device *p_dev) | 385 | static 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 | ||
399 | static int tc589_resume(struct pcmcia_device *p_dev) | 395 | static 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) | |||
569 | static int el3_open(struct net_device *dev) | 564 | static 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) | |||
932 | static void set_multicast_list(struct net_device *dev) | 927 | static 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) | |||
947 | static int el3_close(struct net_device *dev) | 942 | static 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 | ||
89 | static void axnet_config(dev_link_t *link); | 89 | static void axnet_config(struct pcmcia_device *link); |
90 | static void axnet_release(dev_link_t *link); | 90 | static void axnet_release(struct pcmcia_device *link); |
91 | static int axnet_open(struct net_device *dev); | 91 | static int axnet_open(struct net_device *dev); |
92 | static int axnet_close(struct net_device *dev); | 92 | static int axnet_close(struct net_device *dev); |
93 | static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 93 | static 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 | ||
145 | static int axnet_attach(struct pcmcia_device *p_dev) | 145 | static 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 | ||
187 | static void axnet_detach(struct pcmcia_device *p_dev) | 186 | static 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 | ||
209 | static int get_prom(dev_link_t *link) | 207 | static 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) \ |
261 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 259 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
262 | 260 | ||
263 | static int try_io_port(dev_link_t *link) | 261 | static 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 | ||
293 | static void axnet_config(dev_link_t *link) | 291 | static 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, ®); | 398 | pcmcia_access_configuration_register(link, ®); |
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 | ||
433 | cs_failed: | 430 | cs_failed: |
434 | cs_error(link->handle, last_fn, last_ret); | 431 | cs_error(link, last_fn, last_ret); |
435 | failed: | 432 | failed: |
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 | ||
449 | static void axnet_release(dev_link_t *link) | 446 | static void axnet_release(struct pcmcia_device *link) |
450 | { | 447 | { |
451 | pcmcia_disable_device(link->handle); | 448 | pcmcia_disable_device(link); |
452 | } | 449 | } |
453 | 450 | ||
454 | static int axnet_suspend(struct pcmcia_device *p_dev) | 451 | static 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 | ||
465 | static int axnet_resume(struct pcmcia_device *p_dev) | 461 | static 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) | |||
540 | static int axnet_open(struct net_device *dev) | 535 | static 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) | |||
566 | static int axnet_close(struct net_device *dev) | 561 | static 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 | ||
121 | static void com20020_config(dev_link_t *link); | 121 | static void com20020_config(struct pcmcia_device *link); |
122 | static void com20020_release(dev_link_t *link); | 122 | static void com20020_release(struct pcmcia_device *link); |
123 | 123 | ||
124 | static void com20020_detach(struct pcmcia_device *p_dev); | 124 | static void com20020_detach(struct pcmcia_device *p_dev); |
125 | 125 | ||
@@ -198,9 +198,8 @@ fail_alloc_info: | |||
198 | 198 | ||
199 | ======================================================================*/ | 199 | ======================================================================*/ |
200 | 200 | ||
201 | static void com20020_detach(struct pcmcia_device *p_dev) | 201 | static 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) \ |
252 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 251 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
253 | 252 | ||
254 | static void com20020_config(dev_link_t *link) | 253 | static 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 | ||
353 | cs_failed: | 350 | cs_failed: |
354 | cs_error(link->handle, last_fn, last_ret); | 351 | cs_error(link, last_fn, last_ret); |
355 | failed: | 352 | failed: |
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 | ||
368 | static void com20020_release(dev_link_t *link) | 365 | static 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 | ||
374 | static int com20020_suspend(struct pcmcia_device *p_dev) | 371 | static 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 | ||
386 | static int com20020_resume(struct pcmcia_device *p_dev) | 382 | static 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 | */ |
87 | static void fmvj18x_config(dev_link_t *link); | 87 | static void fmvj18x_config(struct pcmcia_device *link); |
88 | static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id); | 88 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id); |
89 | static int fmvj18x_setup_mfc(dev_link_t *link); | 89 | static int fmvj18x_setup_mfc(struct pcmcia_device *link); |
90 | static void fmvj18x_release(dev_link_t *link); | 90 | static void fmvj18x_release(struct pcmcia_device *link); |
91 | static void fmvj18x_detach(struct pcmcia_device *p_dev); | 91 | static 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 | ||
231 | static int fmvj18x_attach(struct pcmcia_device *p_dev) | 231 | static 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 | ||
284 | static void fmvj18x_detach(struct pcmcia_device *p_dev) | 283 | static 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) \ |
303 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 301 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
304 | 302 | ||
305 | static int mfc_try_io_port(dev_link_t *link) | 303 | static 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 | ||
323 | static int ungermann_try_io_port(dev_link_t *link) | 321 | static 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 | ||
344 | static void fmvj18x_config(dev_link_t *link) | 342 | static 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 | ||
560 | cs_failed: | 557 | cs_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); |
563 | failed: | 560 | failed: |
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 | ||
570 | static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id) | 567 | static 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 | ||
623 | static int fmvj18x_setup_mfc(dev_link_t *link) | 620 | static 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 | ||
666 | static void fmvj18x_release(dev_link_t *link) | 663 | static 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 | ||
672 | static int fmvj18x_suspend(struct pcmcia_device *p_dev) | 669 | static 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 | ||
683 | static int fmvj18x_resume(struct pcmcia_device *p_dev) | 679 | static 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){ | |||
1122 | static int fjn_open(struct net_device *dev) | 1117 | static 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) | |||
1147 | static int fjn_close(struct net_device *dev) | 1142 | static 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 | ||
108 | static void ibmtr_config(dev_link_t *link); | 108 | static void ibmtr_config(struct pcmcia_device *link); |
109 | static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase); | 109 | static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase); |
110 | static void ibmtr_release(dev_link_t *link); | 110 | static void ibmtr_release(struct pcmcia_device *link); |
111 | static void ibmtr_detach(struct pcmcia_device *p_dev); | 111 | static 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 | ||
141 | static int ibmtr_attach(struct pcmcia_device *p_dev) | 141 | static 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 | ||
192 | static void ibmtr_detach(struct pcmcia_device *p_dev) | 191 | static 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) \ |
223 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 221 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
224 | 222 | ||
225 | static void ibmtr_config(dev_link_t *link) | 223 | static 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 | ||
331 | cs_failed: | 328 | cs_failed: |
332 | cs_error(link->handle, last_fn, last_ret); | 329 | cs_error(link, last_fn, last_ret); |
333 | failed: | 330 | failed: |
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 | ||
345 | static void ibmtr_release(dev_link_t *link) | 342 | static 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 | ||
360 | static int ibmtr_suspend(struct pcmcia_device *p_dev) | 357 | static 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 | ||
372 | static int ibmtr_resume(struct pcmcia_device *p_dev) | 368 | static 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); | |||
417 | Function Prototypes | 417 | Function Prototypes |
418 | ---------------------------------------------------------------------------- */ | 418 | ---------------------------------------------------------------------------- */ |
419 | 419 | ||
420 | static void nmclan_config(dev_link_t *link); | 420 | static void nmclan_config(struct pcmcia_device *link); |
421 | static void nmclan_release(dev_link_t *link); | 421 | static void nmclan_release(struct pcmcia_device *link); |
422 | 422 | ||
423 | static void nmclan_reset(struct net_device *dev); | 423 | static void nmclan_reset(struct net_device *dev); |
424 | static int mace_config(struct net_device *dev, struct ifmap *map); | 424 | static int mace_config(struct net_device *dev, struct ifmap *map); |
@@ -443,11 +443,10 @@ nmclan_attach | |||
443 | Services. | 443 | Services. |
444 | ---------------------------------------------------------------------------- */ | 444 | ---------------------------------------------------------------------------- */ |
445 | 445 | ||
446 | static int nmclan_attach(struct pcmcia_device *p_dev) | 446 | static 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 | ||
505 | static void nmclan_detach(struct pcmcia_device *p_dev) | 504 | static 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 | ||
660 | static void nmclan_config(dev_link_t *link) | 658 | static 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 | ||
748 | cs_failed: | 745 | cs_failed: |
749 | cs_error(link->handle, last_fn, last_ret); | 746 | cs_error(link, last_fn, last_ret); |
750 | failed: | 747 | failed: |
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 | ---------------------------------------------------------------------------- */ |
762 | static void nmclan_release(dev_link_t *link) | 759 | static 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 | ||
768 | static int nmclan_suspend(struct pcmcia_device *p_dev) | 765 | static 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 | ||
779 | static int nmclan_resume(struct pcmcia_device *p_dev) | 775 | static 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, ®); | 806 | pcmcia_access_configuration_register(link, ®); |
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, ®); | 815 | pcmcia_access_configuration_register(link, ®); |
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, ®); | 820 | pcmcia_access_configuration_register(link, ®); |
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 | |||
944 | static void mace_tx_timeout(struct net_device *dev) | 939 | static 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 | ||
105 | static void mii_phy_probe(struct net_device *dev); | 105 | static void mii_phy_probe(struct net_device *dev); |
106 | static void pcnet_config(dev_link_t *link); | 106 | static void pcnet_config(struct pcmcia_device *link); |
107 | static void pcnet_release(dev_link_t *link); | 107 | static void pcnet_release(struct pcmcia_device *link); |
108 | static int pcnet_open(struct net_device *dev); | 108 | static int pcnet_open(struct net_device *dev); |
109 | static int pcnet_close(struct net_device *dev); | 109 | static int pcnet_close(struct net_device *dev); |
110 | static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 110 | static 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); | |||
113 | static void ei_watchdog(u_long arg); | 113 | static void ei_watchdog(u_long arg); |
114 | static void pcnet_reset_8390(struct net_device *dev); | 114 | static void pcnet_reset_8390(struct net_device *dev); |
115 | static int set_config(struct net_device *dev, struct ifmap *map); | 115 | static int set_config(struct net_device *dev, struct ifmap *map); |
116 | static int setup_shmem_window(dev_link_t *link, int start_pg, | 116 | static 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); |
118 | static int setup_dma_config(dev_link_t *link, int start_pg, | 118 | static int setup_dma_config(struct pcmcia_device *link, int start_pg, |
119 | int stop_pg); | 119 | int stop_pg); |
120 | 120 | ||
121 | static void pcnet_detach(struct pcmcia_device *p_dev); | 121 | static 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 | ||
243 | static int pcnet_probe(struct pcmcia_device *p_dev) | 243 | static 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 | ||
283 | static void pcnet_detach(struct pcmcia_device *p_dev) | 282 | static 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 | ||
306 | static hw_info_t *get_hwinfo(dev_link_t *link) | 304 | static 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 | ||
355 | static hw_info_t *get_prom(dev_link_t *link) | 353 | static 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 | ||
409 | static hw_info_t *get_dl10019(dev_link_t *link) | 407 | static 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 | ||
431 | static hw_info_t *get_ax88190(dev_link_t *link) | 429 | static 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 | ||
464 | static hw_info_t *get_hwired(dev_link_t *link) | 462 | static 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) \ |
489 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 487 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
490 | 488 | ||
491 | static int try_io_port(dev_link_t *link) | 489 | static 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 | ||
521 | static void pcnet_config(dev_link_t *link) | 519 | static 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 | ||
709 | cs_failed: | 706 | cs_failed: |
710 | cs_error(link->handle, last_fn, last_ret); | 707 | cs_error(link, last_fn, last_ret); |
711 | failed: | 708 | failed: |
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 | ||
725 | static void pcnet_release(dev_link_t *link) | 722 | static 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 | ||
746 | static int pcnet_suspend(struct pcmcia_device *p_dev) | 743 | static 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 | ||
757 | static int pcnet_resume(struct pcmcia_device *p_dev) | 753 | static 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) | |||
1002 | static int pcnet_open(struct net_device *dev) | 997 | static 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) | |||
1030 | static int pcnet_close(struct net_device *dev) | 1025 | static 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 | ||
1411 | static int setup_dma_config(dev_link_t *link, int start_pg, | 1406 | static 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 | ||
1514 | static int setup_shmem_window(dev_link_t *link, int start_pg, | 1509 | static 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 | ||
1576 | cs_failed: | 1571 | cs_failed: |
1577 | cs_error(link->handle, last_fn, last_ret); | 1572 | cs_error(link, last_fn, last_ret); |
1578 | failed: | 1573 | failed: |
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 | ||
281 | static void smc91c92_detach(struct pcmcia_device *p_dev); | 281 | static void smc91c92_detach(struct pcmcia_device *p_dev); |
282 | static void smc91c92_config(dev_link_t *link); | 282 | static void smc91c92_config(struct pcmcia_device *link); |
283 | static void smc91c92_release(dev_link_t *link); | 283 | static void smc91c92_release(struct pcmcia_device *link); |
284 | 284 | ||
285 | static int smc_open(struct net_device *dev); | 285 | static int smc_open(struct net_device *dev); |
286 | static int smc_close(struct net_device *dev); | 286 | static int smc_close(struct net_device *dev); |
@@ -309,11 +309,10 @@ static struct ethtool_ops ethtool_ops; | |||
309 | 309 | ||
310 | ======================================================================*/ | 310 | ======================================================================*/ |
311 | 311 | ||
312 | static int smc91c92_attach(struct pcmcia_device *p_dev) | 312 | static 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 | ||
375 | static void smc91c92_detach(struct pcmcia_device *p_dev) | 374 | static 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 | ||
414 | static int first_tuple(client_handle_t handle, tuple_t *tuple, | 412 | static 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 | ||
425 | static int next_tuple(client_handle_t handle, tuple_t *tuple, | 423 | static 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 | ||
447 | static int mhz_3288_power(dev_link_t *link) | 445 | static 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 | ||
469 | static int mhz_mfc_config(dev_link_t *link) | 467 | static 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 | ||
546 | static int mhz_setup(dev_link_t *link) | 544 | static 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 | ||
616 | static void mot_config(dev_link_t *link) | 613 | static 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 | ||
637 | static int mot_setup(dev_link_t *link) | 634 | static 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 | ||
671 | static int smc_config(dev_link_t *link) | 668 | static 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 | ||
714 | static int smc_setup(dev_link_t *link) | 711 | static 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 | ||
774 | static int osi_config(dev_link_t *link) | 770 | static 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 | ||
807 | static int osi_setup(dev_link_t *link, u_short manfid, u_short cardid) | 803 | static 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 | ||
868 | static int smc91c92_suspend(struct pcmcia_device *p_dev) | 863 | static 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 | ||
879 | static int smc91c92_resume(struct pcmcia_device *p_dev) | 873 | static 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 | ||
925 | static int check_sig(dev_link_t *link) | 918 | static 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) \ |
980 | if (ret != CS_SUCCESS) { cs_error(link->handle, svc, ret); goto label; } | 973 | if (ret != CS_SUCCESS) { cs_error(link, svc, ret); goto label; } |
981 | 974 | ||
982 | static void smc91c92_config(dev_link_t *link) | 975 | static 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 | ||
1175 | static void smc91c92_release(dev_link_t *link) | 1167 | static 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) | |||
1269 | static int smc_open(struct net_device *dev) | 1261 | static 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) | |||
1306 | static int smc_close(struct net_device *dev) | 1298 | static 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 | ||
292 | static int has_ce2_string(dev_link_t * link); | 292 | static int has_ce2_string(struct pcmcia_device * link); |
293 | static void xirc2ps_config(dev_link_t * link); | 293 | static void xirc2ps_config(struct pcmcia_device * link); |
294 | static void xirc2ps_release(dev_link_t * link); | 294 | static 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); | |||
355 | static struct net_device_stats *do_get_stats(struct net_device *dev); | 355 | static struct net_device_stats *do_get_stats(struct net_device *dev); |
356 | static void set_addresses(struct net_device *dev); | 356 | static void set_addresses(struct net_device *dev); |
357 | static void set_multicast_list(struct net_device *dev); | 357 | static void set_multicast_list(struct net_device *dev); |
358 | static int set_card_type(dev_link_t *link, const void *s); | 358 | static int set_card_type(struct pcmcia_device *link, const void *s); |
359 | static int do_config(struct net_device *dev, struct ifmap *map); | 359 | static int do_config(struct net_device *dev, struct ifmap *map); |
360 | static int do_open(struct net_device *dev); | 360 | static int do_open(struct net_device *dev); |
361 | static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 361 | static 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 =========================*/ |
370 | static int | 370 | static int |
371 | first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 371 | first_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 | ||
381 | static int | 381 | static int |
382 | next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 382 | next_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 | ||
555 | static int | 555 | static int |
556 | xirc2ps_attach(struct pcmcia_device *p_dev) | 556 | xirc2ps_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 | ||
608 | static void | 607 | static void |
609 | xirc2ps_detach(struct pcmcia_device *p_dev) | 608 | xirc2ps_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 | */ |
643 | static int | 641 | static int |
644 | set_card_type(dev_link_t *link, const void *s) | 642 | set_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 | */ |
712 | static int | 710 | static int |
713 | has_ce2_string(dev_link_t * link) | 711 | has_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 | */ |
737 | static void | 734 | static void |
738 | xirc2ps_config(dev_link_t * link) | 735 | xirc2ps_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, ®))) { | 958 | if ((err = pcmcia_access_configuration_register(link, ®))) { |
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, ®))) { | 965 | if ((err = pcmcia_access_configuration_register(link, ®))) { |
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 | */ |
1086 | static void | 1082 | static void |
1087 | xirc2ps_release(dev_link_t *link) | 1083 | xirc2ps_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 | ||
1103 | static int xirc2ps_suspend(struct pcmcia_device *p_dev) | 1099 | static 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 | ||
1116 | static int xirc2ps_resume(struct pcmcia_device *p_dev) | 1111 | static 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 | |||
1534 | do_open(struct net_device *dev) | 1528 | do_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 | ||
83 | static void airo_config(dev_link_t *link); | 83 | static void airo_config(struct pcmcia_device *link); |
84 | static void airo_release(dev_link_t *link); | 84 | static 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 | ||
188 | static void airo_detach(struct pcmcia_device *p_dev) | 188 | static 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) \ |
214 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 212 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
215 | 213 | ||
216 | static void airo_config(dev_link_t *link) | 214 | static 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 | ||
409 | static void airo_release(dev_link_t *link) | 405 | static 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 | ||
415 | static int airo_suspend(struct pcmcia_device *p_dev) | 411 | static 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 | ||
426 | static int airo_resume(struct pcmcia_device *p_dev) | 421 | static 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 | ||
94 | static void atmel_config(dev_link_t *link); | 94 | static void atmel_config(struct pcmcia_device *link); |
95 | static void atmel_release(dev_link_t *link); | 95 | static 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 | ||
199 | static void atmel_detach(struct pcmcia_device *p_dev) | 199 | static 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 */ |
224 | static int card_present(void *arg) | 222 | static 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 | ||
235 | static void atmel_config(dev_link_t *link) | 233 | static 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 | ||
399 | static void atmel_release(dev_link_t *link) | 395 | static 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 | ||
412 | static int atmel_suspend(struct pcmcia_device *dev) | 408 | static 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 | ||
423 | static int atmel_resume(struct pcmcia_device *dev) | 418 | static 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 */ |
43 | struct hostap_cs_priv { | 43 | struct 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 | ||
205 | static void prism2_detach(struct pcmcia_device *p_dev); | 205 | static void prism2_detach(struct pcmcia_device *p_dev); |
206 | static void prism2_release(u_long arg); | 206 | static void prism2_release(u_long arg); |
207 | static int prism2_config(dev_link_t *link); | 207 | static int prism2_config(struct pcmcia_device *link); |
208 | 208 | ||
209 | 209 | ||
210 | static int prism2_pccard_card_present(local_info_t *local) | 210 | static 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 | ®); | 241 | ®); |
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 | ®); | 253 | ®); |
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 | ®); | 332 | ®); |
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 | ®); | 349 | ®); |
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 | ®); | 384 | ®); |
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 | ®); | 396 | ®); |
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 | ®); | 409 | ®); |
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 | ®); | 443 | ®); |
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 | ®); | 456 | ®); |
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 | ®); | 470 | ®); |
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 | ®); | 482 | ®); |
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 | ||
517 | static void prism2_detach(struct pcmcia_device *p_dev) | 517 | static 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) | |||
545 | do { int ret = (retf); \ | 543 | do { int ret = (retf); \ |
546 | if (ret != 0) { \ | 544 | if (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 */ |
556 | static int prism2_config(dev_link_t *link) | 554 | static 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 | ||
774 | static void prism2_release(u_long arg) | 772 | static 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 | ||
794 | static int hostap_cs_suspend(struct pcmcia_device *p_dev) | 792 | static 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 | ||
816 | static int hostap_cs_resume(struct pcmcia_device *p_dev) | 813 | static 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 */ |
193 | static void netwave_release(dev_link_t *link); /* Card removal */ | 193 | static void netwave_release(struct pcmcia_device *link); /* Card removal */ |
194 | static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card | 194 | static void netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card |
195 | insertion */ | 195 | insertion */ |
196 | static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ | 196 | static 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); | |||
221 | static void set_multicast_list(struct net_device *dev); | 221 | static 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 | */ |
379 | static int netwave_attach(struct pcmcia_device *p_dev) | 379 | static 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 | */ |
446 | static void netwave_detach(struct pcmcia_device *p_dev) | 445 | static 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) \ |
740 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 738 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
741 | 739 | ||
742 | static void netwave_pcmcia_config(dev_link_t *link) { | 740 | static 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 | ||
853 | cs_failed: | 850 | cs_failed: |
854 | cs_error(link->handle, last_fn, last_ret); | 851 | cs_error(link, last_fn, last_ret); |
855 | failed: | 852 | failed: |
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 | */ |
866 | static void netwave_release(dev_link_t *link) | 863 | static 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 | ||
878 | static int netwave_suspend(struct pcmcia_device *p_dev) | 875 | static 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 | ||
889 | static int netwave_resume(struct pcmcia_device *p_dev) | 885 | static 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 | ||
1355 | static int netwave_open(struct net_device *dev) { | 1350 | static 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 | ||
1372 | static int netwave_close(struct net_device *dev) { | 1367 | static 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 | ||
66 | static void orinoco_cs_config(dev_link_t *link); | 66 | static void orinoco_cs_config(struct pcmcia_device *link); |
67 | static void orinoco_cs_release(dev_link_t *link); | 67 | static void orinoco_cs_release(struct pcmcia_device *link); |
68 | static void orinoco_cs_detach(struct pcmcia_device *p_dev); | 68 | static void orinoco_cs_detach(struct pcmcia_device *p_dev); |
69 | 69 | ||
70 | /********************************************************************/ | 70 | /********************************************************************/ |
@@ -75,13 +75,13 @@ static int | |||
75 | orinoco_cs_hard_reset(struct orinoco_private *priv) | 75 | orinoco_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. */ |
106 | static int | 106 | static int |
107 | orinoco_cs_attach(struct pcmcia_device *p_dev) | 107 | orinoco_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 | */ |
150 | static void orinoco_cs_detach(struct pcmcia_device *p_dev) | 149 | static 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 | ||
177 | static void | 175 | static void |
178 | orinoco_cs_config(dev_link_t *link) | 176 | orinoco_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 | */ |
397 | static void | 394 | static void |
398 | orinoco_cs_release(dev_link_t *link) | 395 | orinoco_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 | ||
415 | static int orinoco_cs_suspend(struct pcmcia_device *p_dev) | 412 | static 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 | ||
446 | static int orinoco_cs_resume(struct pcmcia_device *p_dev) | 442 | static 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 *******************************/ |
93 | static void ray_config(dev_link_t *link); | 93 | static void ray_config(struct pcmcia_device *link); |
94 | static void ray_release(dev_link_t *link); | 94 | static void ray_release(struct pcmcia_device *link); |
95 | static void ray_detach(struct pcmcia_device *p_dev); | 95 | static 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; | |||
190 | static char *phy_addr = NULL; | 190 | static 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 | */ |
199 | static unsigned int ray_mem_speed = 500; | 199 | static 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 | =============================================================================*/ |
384 | static void ray_detach(struct pcmcia_device *p_dev) | 384 | static 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) \ |
414 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 413 | do { 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 |
416 | static void ray_config(dev_link_t *link) | 415 | static 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 | ||
526 | cs_failed: | 524 | cs_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 | =============================================================================*/ |
818 | static void ray_release(dev_link_t *link) | 816 | static 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 | ||
841 | static int ray_suspend(struct pcmcia_device *p_dev) | 839 | static 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 | ||
852 | static int ray_resume(struct pcmcia_device *p_dev) | 849 | static 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) | |||
903 | static int ray_dev_config(struct net_device *dev, struct ifmap *map) | 899 | static 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) | |||
917 | static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev) | 913 | static 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, | |||
1529 | static iw_stats * ray_get_wireless_stats(struct net_device * dev) | 1525 | static 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 = | |||
1617 | static int ray_open(struct net_device *dev) | 1613 | static 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) | |||
1651 | static int ray_dev_close(struct net_device *dev) | 1647 | static 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) { | |||
1677 | static int interrupt_ecf(ray_dev_t *local, int ccs) | 1673 | static 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) | |||
1810 | static struct net_device_stats *ray_get_stats(struct net_device *dev) | 1806 | static 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) | |||
1840 | static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len) | 1836 | static 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) | |||
1957 | static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs) | 1953 | static 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 | /*===========================================================================*/ |
2493 | static void authenticate(ray_dev_t *local) | 2489 | static 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, | |||
2558 | static void associate(ray_dev_t *local) | 2554 | static 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 | ||
74 | static void spectrum_cs_config(dev_link_t *link); | 74 | static void spectrum_cs_config(struct pcmcia_device *link); |
75 | static void spectrum_cs_release(dev_link_t *link); | 75 | static 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 | */ |
240 | static int | 240 | static int |
241 | spectrum_reset(dev_link_t *link, int idle) | 241 | spectrum_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, ®)); | 256 | pcmcia_access_configuration_register(link, ®)); |
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, ®)); | 264 | pcmcia_access_configuration_register(link, ®)); |
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, ®)); | 271 | pcmcia_access_configuration_register(link, ®)); |
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, ®)); | 281 | pcmcia_access_configuration_register(link, ®)); |
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, ®)); | 289 | pcmcia_access_configuration_register(link, ®)); |
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 | */ |
443 | static int | 443 | static int |
444 | spectrum_dl_image(hermes_t *hw, dev_link_t *link, | 444 | spectrum_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 | */ |
507 | static int | 507 | static int |
508 | spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | 508 | spectrum_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 | |||
554 | spectrum_cs_hard_reset(struct orinoco_private *priv) | 553 | spectrum_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. */ |
586 | static int | 585 | static int |
587 | spectrum_cs_attach(struct pcmcia_device *p_dev) | 586 | spectrum_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 | */ |
630 | static void spectrum_cs_detach(struct pcmcia_device *p_dev) | 628 | static 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 | ||
653 | static void | 650 | static void |
654 | spectrum_cs_config(dev_link_t *link) | 651 | spectrum_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 | */ |
878 | static void | 874 | static void |
879 | spectrum_cs_release(dev_link_t *link) | 875 | spectrum_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 | ||
897 | static int | 893 | static int |
898 | spectrum_cs_suspend(struct pcmcia_device *p_dev) | 894 | spectrum_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 | ||
924 | static int | 919 | static int |
925 | spectrum_cs_resume(struct pcmcia_device *p_dev) | 920 | spectrum_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 | |||
1005 | wv_82593_reconfig(struct net_device * dev) | 1005 | wv_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, ®); | 3753 | i = pcmcia_access_configuration_register(link, ®); |
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, ®); | 3767 | i = pcmcia_access_configuration_register(link, ®); |
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, ®); | 3776 | i = pcmcia_access_configuration_register(link, ®); |
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 | */ |
3942 | static inline int | 3942 | static inline int |
3943 | wv_pcmcia_config(dev_link_t * link) | 3943 | wv_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 | */ |
4098 | static void | 4097 | static void |
4099 | wv_pcmcia_release(dev_link_t *link) | 4098 | wv_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 | |||
4473 | wavelan_open(struct net_device * dev) | 4472 | wavelan_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) | |||
4527 | static int | 4526 | static int |
4528 | wavelan_close(struct net_device * dev) | 4527 | wavelan_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 | */ |
4675 | static void | 4674 | static void |
4676 | wavelan_detach(struct pcmcia_device *p_dev) | 4675 | wavelan_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 | ||
4716 | static int wavelan_suspend(struct pcmcia_device *p_dev) | 4713 | static 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 | ||
4739 | static int wavelan_resume(struct pcmcia_device *p_dev) | 4735 | static 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 | |||
733 | static inline void | 733 | static inline void |
734 | wv_hw_reset(struct net_device *); /* Same, + start receiver unit */ | 734 | wv_hw_reset(struct net_device *); /* Same, + start receiver unit */ |
735 | static inline int | 735 | static inline int |
736 | wv_pcmcia_config(dev_link_t *); /* Configure the pcmcia interface */ | 736 | wv_pcmcia_config(struct pcmcia_device *); /* Configure the pcmcia interface */ |
737 | static void | 737 | static 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 ---------------------- */ |
740 | static irqreturn_t | 740 | static 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 | */ |
106 | static void wl3501_config(dev_link_t *link); | 106 | static void wl3501_config(struct pcmcia_device *link); |
107 | static void wl3501_release(dev_link_t *link); | 107 | static 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 | */ |
1480 | static void wl3501_detach(struct pcmcia_device *p_dev) | 1480 | static 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 | */ |
1983 | static void wl3501_config(dev_link_t *link) | 1981 | static 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; |
2089 | cs_failed: | 2086 | cs_failed: |
2090 | cs_error(link->handle, last_fn, last_ret); | 2087 | cs_error(link, last_fn, last_ret); |
2091 | failed: | 2088 | failed: |
2092 | wl3501_release(link); | 2089 | wl3501_release(link); |
2093 | out: | 2090 | out: |
@@ -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 | */ |
2105 | static void wl3501_release(dev_link_t *link) | 2102 | static 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 | ||
2116 | static int wl3501_suspend(struct pcmcia_device *p_dev) | 2113 | static 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 | ||
2128 | static int wl3501_resume(struct pcmcia_device *p_dev) | 2124 | static 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); |
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index ad2738ae2222..6dcaf44c120a 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -88,8 +88,8 @@ typedef struct parport_info_t { | |||
88 | } parport_info_t; | 88 | } parport_info_t; |
89 | 89 | ||
90 | static void parport_detach(struct pcmcia_device *p_dev); | 90 | static void parport_detach(struct pcmcia_device *p_dev); |
91 | static void parport_config(dev_link_t *link); | 91 | static void parport_config(struct pcmcia_device *link); |
92 | static void parport_cs_release(dev_link_t *); | 92 | static void parport_cs_release(struct pcmcia_device *); |
93 | 93 | ||
94 | /*====================================================================== | 94 | /*====================================================================== |
95 | 95 | ||
@@ -99,10 +99,9 @@ static void parport_cs_release(dev_link_t *); | |||
99 | 99 | ||
100 | ======================================================================*/ | 100 | ======================================================================*/ |
101 | 101 | ||
102 | static int parport_attach(struct pcmcia_device *p_dev) | 102 | static int parport_attach(struct pcmcia_device *link) |
103 | { | 103 | { |
104 | parport_info_t *info; | 104 | parport_info_t *info; |
105 | dev_link_t *link = dev_to_instance(p_dev); | ||
106 | 105 | ||
107 | DEBUG(0, "parport_attach()\n"); | 106 | DEBUG(0, "parport_attach()\n"); |
108 | 107 | ||
@@ -111,7 +110,7 @@ static int parport_attach(struct pcmcia_device *p_dev) | |||
111 | if (!info) return -ENOMEM; | 110 | if (!info) return -ENOMEM; |
112 | memset(info, 0, sizeof(*info)); | 111 | memset(info, 0, sizeof(*info)); |
113 | link->priv = info; | 112 | link->priv = info; |
114 | info->p_dev = p_dev; | 113 | info->p_dev = link; |
115 | 114 | ||
116 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 115 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
117 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 116 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
@@ -135,10 +134,8 @@ static int parport_attach(struct pcmcia_device *p_dev) | |||
135 | 134 | ||
136 | ======================================================================*/ | 135 | ======================================================================*/ |
137 | 136 | ||
138 | static void parport_detach(struct pcmcia_device *p_dev) | 137 | static void parport_detach(struct pcmcia_device *link) |
139 | { | 138 | { |
140 | dev_link_t *link = dev_to_instance(p_dev); | ||
141 | |||
142 | DEBUG(0, "parport_detach(0x%p)\n", link); | 139 | DEBUG(0, "parport_detach(0x%p)\n", link); |
143 | 140 | ||
144 | if (link->state & DEV_CONFIG) | 141 | if (link->state & DEV_CONFIG) |
@@ -158,9 +155,8 @@ static void parport_detach(struct pcmcia_device *p_dev) | |||
158 | #define CS_CHECK(fn, ret) \ | 155 | #define CS_CHECK(fn, ret) \ |
159 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 156 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
160 | 157 | ||
161 | void parport_config(dev_link_t *link) | 158 | void parport_config(struct pcmcia_device *link) |
162 | { | 159 | { |
163 | client_handle_t handle = link->handle; | ||
164 | parport_info_t *info = link->priv; | 160 | parport_info_t *info = link->priv; |
165 | tuple_t tuple; | 161 | tuple_t tuple; |
166 | u_short buf[128]; | 162 | u_short buf[128]; |
@@ -176,9 +172,9 @@ void parport_config(dev_link_t *link) | |||
176 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 172 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
177 | tuple.Attributes = 0; | 173 | tuple.Attributes = 0; |
178 | tuple.DesiredTuple = CISTPL_CONFIG; | 174 | tuple.DesiredTuple = CISTPL_CONFIG; |
179 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 175 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
180 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 176 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
181 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 177 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
182 | link->conf.ConfigBase = parse.config.base; | 178 | link->conf.ConfigBase = parse.config.base; |
183 | link->conf.Present = parse.config.rmask[0]; | 179 | link->conf.Present = parse.config.rmask[0]; |
184 | 180 | ||
@@ -187,10 +183,10 @@ void parport_config(dev_link_t *link) | |||
187 | 183 | ||
188 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 184 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
189 | tuple.Attributes = 0; | 185 | tuple.Attributes = 0; |
190 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 186 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
191 | while (1) { | 187 | while (1) { |
192 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 188 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
193 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 189 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
194 | goto next_entry; | 190 | goto next_entry; |
195 | 191 | ||
196 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | 192 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { |
@@ -205,7 +201,7 @@ void parport_config(dev_link_t *link) | |||
205 | link->io.BasePort2 = io->win[1].base; | 201 | link->io.BasePort2 = io->win[1].base; |
206 | link->io.NumPorts2 = io->win[1].len; | 202 | link->io.NumPorts2 = io->win[1].len; |
207 | } | 203 | } |
208 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 204 | if (pcmcia_request_io(link, &link->io) != 0) |
209 | goto next_entry; | 205 | goto next_entry; |
210 | /* If we've got this far, we're done */ | 206 | /* If we've got this far, we're done */ |
211 | break; | 207 | break; |
@@ -213,11 +209,11 @@ void parport_config(dev_link_t *link) | |||
213 | 209 | ||
214 | next_entry: | 210 | next_entry: |
215 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; | 211 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; |
216 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 212 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
217 | } | 213 | } |
218 | 214 | ||
219 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 215 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
220 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 216 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
221 | 217 | ||
222 | p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, | 218 | p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, |
223 | link->irq.AssignedIRQ, PARPORT_DMA_NONE, | 219 | link->irq.AssignedIRQ, PARPORT_DMA_NONE, |
@@ -243,7 +239,7 @@ void parport_config(dev_link_t *link) | |||
243 | return; | 239 | return; |
244 | 240 | ||
245 | cs_failed: | 241 | cs_failed: |
246 | cs_error(link->handle, last_fn, last_ret); | 242 | cs_error(link, last_fn, last_ret); |
247 | failed: | 243 | failed: |
248 | parport_cs_release(link); | 244 | parport_cs_release(link); |
249 | link->state &= ~DEV_CONFIG_PENDING; | 245 | link->state &= ~DEV_CONFIG_PENDING; |
@@ -258,7 +254,7 @@ failed: | |||
258 | 254 | ||
259 | ======================================================================*/ | 255 | ======================================================================*/ |
260 | 256 | ||
261 | void parport_cs_release(dev_link_t *link) | 257 | void parport_cs_release(struct pcmcia_device *link) |
262 | { | 258 | { |
263 | parport_info_t *info = link->priv; | 259 | parport_info_t *info = link->priv; |
264 | 260 | ||
@@ -270,7 +266,7 @@ void parport_cs_release(dev_link_t *link) | |||
270 | } | 266 | } |
271 | info->ndev = 0; | 267 | info->ndev = 0; |
272 | 268 | ||
273 | pcmcia_disable_device(link->handle); | 269 | pcmcia_disable_device(link); |
274 | } /* parport_cs_release */ | 270 | } /* parport_cs_release */ |
275 | 271 | ||
276 | 272 | ||
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index ad04ad4386b3..ecc579bbaeba 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -31,7 +31,7 @@ typedef struct region_t { | |||
31 | u_short region_magic; | 31 | u_short region_magic; |
32 | u_short state; | 32 | u_short state; |
33 | dev_info_t dev_info; | 33 | dev_info_t dev_info; |
34 | client_handle_t mtd; | 34 | struct pcmcia_device *mtd; |
35 | u_int MediaID; | 35 | u_int MediaID; |
36 | region_info_t info; | 36 | region_info_t info; |
37 | } region_t; | 37 | } region_t; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4ab956843d86..e8fe544f2e9c 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -391,7 +391,6 @@ static int pcmcia_device_probe(struct device * dev) | |||
391 | } | 391 | } |
392 | 392 | ||
393 | p_dev->p_state &= ~CLIENT_UNBOUND; | 393 | p_dev->p_state &= ~CLIENT_UNBOUND; |
394 | p_dev->handle = p_dev; | ||
395 | 394 | ||
396 | ret = p_drv->probe(p_dev); | 395 | ret = p_drv->probe(p_dev); |
397 | if (ret) | 396 | if (ret) |
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 0c196fbb3121..21c6b1014535 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -94,24 +94,23 @@ typedef struct scsi_info_t { | |||
94 | struct Scsi_Host *host; | 94 | struct Scsi_Host *host; |
95 | } scsi_info_t; | 95 | } scsi_info_t; |
96 | 96 | ||
97 | static void aha152x_release_cs(dev_link_t *link); | 97 | static void aha152x_release_cs(struct pcmcia_device *link); |
98 | static void aha152x_detach(struct pcmcia_device *p_dev); | 98 | static void aha152x_detach(struct pcmcia_device *p_dev); |
99 | static void aha152x_config_cs(dev_link_t *link); | 99 | static void aha152x_config_cs(struct pcmcia_device *link); |
100 | 100 | ||
101 | static dev_link_t *dev_list; | 101 | static struct pcmcia_device *dev_list; |
102 | 102 | ||
103 | static int aha152x_attach(struct pcmcia_device *p_dev) | 103 | static int aha152x_attach(struct pcmcia_device *link) |
104 | { | 104 | { |
105 | scsi_info_t *info; | 105 | scsi_info_t *info; |
106 | dev_link_t *link = dev_to_instance(p_dev); | 106 | |
107 | |||
108 | DEBUG(0, "aha152x_attach()\n"); | 107 | DEBUG(0, "aha152x_attach()\n"); |
109 | 108 | ||
110 | /* Create new SCSI device */ | 109 | /* Create new SCSI device */ |
111 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 110 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
112 | if (!info) return -ENOMEM; | 111 | if (!info) return -ENOMEM; |
113 | memset(info, 0, sizeof(*info)); | 112 | memset(info, 0, sizeof(*info)); |
114 | info->p_dev = p_dev; | 113 | info->p_dev = link; |
115 | link->priv = info; | 114 | link->priv = info; |
116 | 115 | ||
117 | link->io.NumPorts1 = 0x20; | 116 | link->io.NumPorts1 = 0x20; |
@@ -131,10 +130,8 @@ static int aha152x_attach(struct pcmcia_device *p_dev) | |||
131 | 130 | ||
132 | /*====================================================================*/ | 131 | /*====================================================================*/ |
133 | 132 | ||
134 | static void aha152x_detach(struct pcmcia_device *p_dev) | 133 | static void aha152x_detach(struct pcmcia_device *link) |
135 | { | 134 | { |
136 | dev_link_t *link = dev_to_instance(p_dev); | ||
137 | |||
138 | DEBUG(0, "aha152x_detach(0x%p)\n", link); | 135 | DEBUG(0, "aha152x_detach(0x%p)\n", link); |
139 | 136 | ||
140 | if (link->state & DEV_CONFIG) | 137 | if (link->state & DEV_CONFIG) |
@@ -149,9 +146,8 @@ static void aha152x_detach(struct pcmcia_device *p_dev) | |||
149 | #define CS_CHECK(fn, ret) \ | 146 | #define CS_CHECK(fn, ret) \ |
150 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 147 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
151 | 148 | ||
152 | static void aha152x_config_cs(dev_link_t *link) | 149 | static void aha152x_config_cs(struct pcmcia_device *link) |
153 | { | 150 | { |
154 | client_handle_t handle = link->handle; | ||
155 | scsi_info_t *info = link->priv; | 151 | scsi_info_t *info = link->priv; |
156 | struct aha152x_setup s; | 152 | struct aha152x_setup s; |
157 | tuple_t tuple; | 153 | tuple_t tuple; |
@@ -166,19 +162,19 @@ static void aha152x_config_cs(dev_link_t *link) | |||
166 | tuple.TupleData = tuple_data; | 162 | tuple.TupleData = tuple_data; |
167 | tuple.TupleDataMax = 64; | 163 | tuple.TupleDataMax = 64; |
168 | tuple.TupleOffset = 0; | 164 | tuple.TupleOffset = 0; |
169 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 165 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
170 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 166 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
171 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 167 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
172 | link->conf.ConfigBase = parse.config.base; | 168 | link->conf.ConfigBase = parse.config.base; |
173 | 169 | ||
174 | /* Configure card */ | 170 | /* Configure card */ |
175 | link->state |= DEV_CONFIG; | 171 | link->state |= DEV_CONFIG; |
176 | 172 | ||
177 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 173 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
178 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 174 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
179 | while (1) { | 175 | while (1) { |
180 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 176 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
181 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 177 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
182 | goto next_entry; | 178 | goto next_entry; |
183 | /* For New Media T&J, look for a SCSI window */ | 179 | /* For New Media T&J, look for a SCSI window */ |
184 | if (parse.cftable_entry.io.win[0].len >= 0x20) | 180 | if (parse.cftable_entry.io.win[0].len >= 0x20) |
@@ -189,15 +185,15 @@ static void aha152x_config_cs(dev_link_t *link) | |||
189 | if ((parse.cftable_entry.io.nwin > 0) && | 185 | if ((parse.cftable_entry.io.nwin > 0) && |
190 | (link->io.BasePort1 < 0xffff)) { | 186 | (link->io.BasePort1 < 0xffff)) { |
191 | link->conf.ConfigIndex = parse.cftable_entry.index; | 187 | link->conf.ConfigIndex = parse.cftable_entry.index; |
192 | i = pcmcia_request_io(handle, &link->io); | 188 | i = pcmcia_request_io(link, &link->io); |
193 | if (i == CS_SUCCESS) break; | 189 | if (i == CS_SUCCESS) break; |
194 | } | 190 | } |
195 | next_entry: | 191 | next_entry: |
196 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 192 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
197 | } | 193 | } |
198 | 194 | ||
199 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 195 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
200 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 196 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
201 | 197 | ||
202 | /* Set configuration options for the aha152x driver */ | 198 | /* Set configuration options for the aha152x driver */ |
203 | memset(&s, 0, sizeof(s)); | 199 | memset(&s, 0, sizeof(s)); |
@@ -226,22 +222,21 @@ static void aha152x_config_cs(dev_link_t *link) | |||
226 | return; | 222 | return; |
227 | 223 | ||
228 | cs_failed: | 224 | cs_failed: |
229 | cs_error(link->handle, last_fn, last_ret); | 225 | cs_error(link, last_fn, last_ret); |
230 | aha152x_release_cs(link); | 226 | aha152x_release_cs(link); |
231 | return; | 227 | return; |
232 | } | 228 | } |
233 | 229 | ||
234 | static void aha152x_release_cs(dev_link_t *link) | 230 | static void aha152x_release_cs(struct pcmcia_device *link) |
235 | { | 231 | { |
236 | scsi_info_t *info = link->priv; | 232 | scsi_info_t *info = link->priv; |
237 | 233 | ||
238 | aha152x_release(info->host); | 234 | aha152x_release(info->host); |
239 | pcmcia_disable_device(link->handle); | 235 | pcmcia_disable_device(link); |
240 | } | 236 | } |
241 | 237 | ||
242 | static int aha152x_resume(struct pcmcia_device *dev) | 238 | static int aha152x_resume(struct pcmcia_device *link) |
243 | { | 239 | { |
244 | dev_link_t *link = dev_to_instance(dev); | ||
245 | scsi_info_t *info = link->priv; | 240 | scsi_info_t *info = link->priv; |
246 | 241 | ||
247 | aha152x_host_reset_host(info->host); | 242 | aha152x_host_reset_host(info->host); |
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 94dcee9f285a..4e6927112c05 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -79,14 +79,13 @@ typedef struct scsi_info_t { | |||
79 | } scsi_info_t; | 79 | } scsi_info_t; |
80 | 80 | ||
81 | 81 | ||
82 | static void fdomain_release(dev_link_t *link); | 82 | static void fdomain_release(struct pcmcia_device *link); |
83 | static void fdomain_detach(struct pcmcia_device *p_dev); | 83 | static void fdomain_detach(struct pcmcia_device *p_dev); |
84 | static void fdomain_config(dev_link_t *link); | 84 | static void fdomain_config(struct pcmcia_device *link); |
85 | 85 | ||
86 | static int fdomain_attach(struct pcmcia_device *p_dev) | 86 | static int fdomain_attach(struct pcmcia_device *link) |
87 | { | 87 | { |
88 | scsi_info_t *info; | 88 | scsi_info_t *info; |
89 | dev_link_t *link = dev_to_instance(p_dev); | ||
90 | 89 | ||
91 | DEBUG(0, "fdomain_attach()\n"); | 90 | DEBUG(0, "fdomain_attach()\n"); |
92 | 91 | ||
@@ -94,7 +93,7 @@ static int fdomain_attach(struct pcmcia_device *p_dev) | |||
94 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 93 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
95 | if (!info) return -ENOMEM; | 94 | if (!info) return -ENOMEM; |
96 | memset(info, 0, sizeof(*info)); | 95 | memset(info, 0, sizeof(*info)); |
97 | info->p_dev = p_dev; | 96 | info->p_dev = link; |
98 | link->priv = info; | 97 | link->priv = info; |
99 | link->io.NumPorts1 = 0x10; | 98 | link->io.NumPorts1 = 0x10; |
100 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 99 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
@@ -113,10 +112,8 @@ static int fdomain_attach(struct pcmcia_device *p_dev) | |||
113 | 112 | ||
114 | /*====================================================================*/ | 113 | /*====================================================================*/ |
115 | 114 | ||
116 | static void fdomain_detach(struct pcmcia_device *p_dev) | 115 | static void fdomain_detach(struct pcmcia_device *link) |
117 | { | 116 | { |
118 | dev_link_t *link = dev_to_instance(p_dev); | ||
119 | |||
120 | DEBUG(0, "fdomain_detach(0x%p)\n", link); | 117 | DEBUG(0, "fdomain_detach(0x%p)\n", link); |
121 | 118 | ||
122 | if (link->state & DEV_CONFIG) | 119 | if (link->state & DEV_CONFIG) |
@@ -130,9 +127,8 @@ static void fdomain_detach(struct pcmcia_device *p_dev) | |||
130 | #define CS_CHECK(fn, ret) \ | 127 | #define CS_CHECK(fn, ret) \ |
131 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 128 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
132 | 129 | ||
133 | static void fdomain_config(dev_link_t *link) | 130 | static void fdomain_config(struct pcmcia_device *link) |
134 | { | 131 | { |
135 | client_handle_t handle = link->handle; | ||
136 | scsi_info_t *info = link->priv; | 132 | scsi_info_t *info = link->priv; |
137 | tuple_t tuple; | 133 | tuple_t tuple; |
138 | cisparse_t parse; | 134 | cisparse_t parse; |
@@ -147,30 +143,30 @@ static void fdomain_config(dev_link_t *link) | |||
147 | tuple.TupleData = tuple_data; | 143 | tuple.TupleData = tuple_data; |
148 | tuple.TupleDataMax = 64; | 144 | tuple.TupleDataMax = 64; |
149 | tuple.TupleOffset = 0; | 145 | tuple.TupleOffset = 0; |
150 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 146 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
151 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 147 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
152 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 148 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
153 | link->conf.ConfigBase = parse.config.base; | 149 | link->conf.ConfigBase = parse.config.base; |
154 | 150 | ||
155 | /* Configure card */ | 151 | /* Configure card */ |
156 | link->state |= DEV_CONFIG; | 152 | link->state |= DEV_CONFIG; |
157 | 153 | ||
158 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 154 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
159 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 155 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
160 | while (1) { | 156 | while (1) { |
161 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 157 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
162 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 158 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
163 | goto next_entry; | 159 | goto next_entry; |
164 | link->conf.ConfigIndex = parse.cftable_entry.index; | 160 | link->conf.ConfigIndex = parse.cftable_entry.index; |
165 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; | 161 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; |
166 | i = pcmcia_request_io(handle, &link->io); | 162 | i = pcmcia_request_io(link, &link->io); |
167 | if (i == CS_SUCCESS) break; | 163 | if (i == CS_SUCCESS) break; |
168 | next_entry: | 164 | next_entry: |
169 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 165 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
170 | } | 166 | } |
171 | 167 | ||
172 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 168 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
173 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 169 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
174 | 170 | ||
175 | /* A bad hack... */ | 171 | /* A bad hack... */ |
176 | release_region(link->io.BasePort1, link->io.NumPorts1); | 172 | release_region(link->io.BasePort1, link->io.NumPorts1); |
@@ -196,7 +192,7 @@ static void fdomain_config(dev_link_t *link) | |||
196 | return; | 192 | return; |
197 | 193 | ||
198 | cs_failed: | 194 | cs_failed: |
199 | cs_error(link->handle, last_fn, last_ret); | 195 | cs_error(link, last_fn, last_ret); |
200 | fdomain_release(link); | 196 | fdomain_release(link); |
201 | return; | 197 | return; |
202 | 198 | ||
@@ -204,23 +200,21 @@ cs_failed: | |||
204 | 200 | ||
205 | /*====================================================================*/ | 201 | /*====================================================================*/ |
206 | 202 | ||
207 | static void fdomain_release(dev_link_t *link) | 203 | static void fdomain_release(struct pcmcia_device *link) |
208 | { | 204 | { |
209 | scsi_info_t *info = link->priv; | 205 | scsi_info_t *info = link->priv; |
210 | 206 | ||
211 | DEBUG(0, "fdomain_release(0x%p)\n", link); | 207 | DEBUG(0, "fdomain_release(0x%p)\n", link); |
212 | 208 | ||
213 | scsi_remove_host(info->host); | 209 | scsi_remove_host(info->host); |
214 | pcmcia_disable_device(link->handle); | 210 | pcmcia_disable_device(link); |
215 | scsi_unregister(info->host); | 211 | scsi_unregister(info->host); |
216 | } | 212 | } |
217 | 213 | ||
218 | /*====================================================================*/ | 214 | /*====================================================================*/ |
219 | 215 | ||
220 | static int fdomain_resume(struct pcmcia_device *dev) | 216 | static int fdomain_resume(struct pcmcia_device *link) |
221 | { | 217 | { |
222 | dev_link_t *link = dev_to_instance(dev); | ||
223 | |||
224 | if (link->state & DEV_CONFIG) | 218 | if (link->state & DEV_CONFIG) |
225 | fdomain_16x0_bus_reset(NULL); | 219 | fdomain_16x0_bus_reset(NULL); |
226 | 220 | ||
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 23548fbf4898..ce4d7d868d27 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1593,11 +1593,10 @@ static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt) | |||
1593 | configure the card at this point -- we wait until we receive a | 1593 | configure the card at this point -- we wait until we receive a |
1594 | card insertion event. | 1594 | card insertion event. |
1595 | ======================================================================*/ | 1595 | ======================================================================*/ |
1596 | static int nsp_cs_attach(struct pcmcia_device *p_dev) | 1596 | static int nsp_cs_attach(struct pcmcia_device *link) |
1597 | { | 1597 | { |
1598 | scsi_info_t *info; | 1598 | scsi_info_t *info; |
1599 | nsp_hw_data *data = &nsp_data_base; | 1599 | nsp_hw_data *data = &nsp_data_base; |
1600 | dev_link_t *link = dev_to_instance(p_dev); | ||
1601 | 1600 | ||
1602 | nsp_dbg(NSP_DEBUG_INIT, "in"); | 1601 | nsp_dbg(NSP_DEBUG_INIT, "in"); |
1603 | 1602 | ||
@@ -1605,7 +1604,7 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev) | |||
1605 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1604 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1606 | if (info == NULL) { return -ENOMEM; } | 1605 | if (info == NULL) { return -ENOMEM; } |
1607 | memset(info, 0, sizeof(*info)); | 1606 | memset(info, 0, sizeof(*info)); |
1608 | info->p_dev = p_dev; | 1607 | info->p_dev = link; |
1609 | link->priv = info; | 1608 | link->priv = info; |
1610 | data->ScsiInfo = info; | 1609 | data->ScsiInfo = info; |
1611 | 1610 | ||
@@ -1644,10 +1643,8 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev) | |||
1644 | structures are freed. Otherwise, the structures will be freed | 1643 | structures are freed. Otherwise, the structures will be freed |
1645 | when the device is released. | 1644 | when the device is released. |
1646 | ======================================================================*/ | 1645 | ======================================================================*/ |
1647 | static void nsp_cs_detach(struct pcmcia_device *p_dev) | 1646 | static void nsp_cs_detach(struct pcmcia_device *link) |
1648 | { | 1647 | { |
1649 | dev_link_t *link = dev_to_instance(p_dev); | ||
1650 | |||
1651 | nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); | 1648 | nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); |
1652 | 1649 | ||
1653 | if (link->state & DEV_CONFIG) { | 1650 | if (link->state & DEV_CONFIG) { |
@@ -1668,9 +1665,8 @@ static void nsp_cs_detach(struct pcmcia_device *p_dev) | |||
1668 | #define CS_CHECK(fn, ret) \ | 1665 | #define CS_CHECK(fn, ret) \ |
1669 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 1666 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
1670 | /*====================================================================*/ | 1667 | /*====================================================================*/ |
1671 | static void nsp_cs_config(dev_link_t *link) | 1668 | static void nsp_cs_config(struct pcmcia_device *link) |
1672 | { | 1669 | { |
1673 | client_handle_t handle = link->handle; | ||
1674 | scsi_info_t *info = link->priv; | 1670 | scsi_info_t *info = link->priv; |
1675 | tuple_t tuple; | 1671 | tuple_t tuple; |
1676 | cisparse_t parse; | 1672 | cisparse_t parse; |
@@ -1694,9 +1690,9 @@ static void nsp_cs_config(dev_link_t *link) | |||
1694 | tuple.TupleData = tuple_data; | 1690 | tuple.TupleData = tuple_data; |
1695 | tuple.TupleDataMax = sizeof(tuple_data); | 1691 | tuple.TupleDataMax = sizeof(tuple_data); |
1696 | tuple.TupleOffset = 0; | 1692 | tuple.TupleOffset = 0; |
1697 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 1693 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
1698 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 1694 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
1699 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 1695 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
1700 | link->conf.ConfigBase = parse.config.base; | 1696 | link->conf.ConfigBase = parse.config.base; |
1701 | link->conf.Present = parse.config.rmask[0]; | 1697 | link->conf.Present = parse.config.rmask[0]; |
1702 | 1698 | ||
@@ -1704,15 +1700,15 @@ static void nsp_cs_config(dev_link_t *link) | |||
1704 | link->state |= DEV_CONFIG; | 1700 | link->state |= DEV_CONFIG; |
1705 | 1701 | ||
1706 | /* Look up the current Vcc */ | 1702 | /* Look up the current Vcc */ |
1707 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); | 1703 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); |
1708 | 1704 | ||
1709 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 1705 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
1710 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 1706 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
1711 | while (1) { | 1707 | while (1) { |
1712 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 1708 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); |
1713 | 1709 | ||
1714 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 1710 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
1715 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 1711 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
1716 | goto next_entry; | 1712 | goto next_entry; |
1717 | 1713 | ||
1718 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) { dflt = *cfg; } | 1714 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) { dflt = *cfg; } |
@@ -1768,7 +1764,7 @@ static void nsp_cs_config(dev_link_t *link) | |||
1768 | link->io.NumPorts2 = io->win[1].len; | 1764 | link->io.NumPorts2 = io->win[1].len; |
1769 | } | 1765 | } |
1770 | /* This reserves IO space but doesn't actually enable it */ | 1766 | /* This reserves IO space but doesn't actually enable it */ |
1771 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 1767 | if (pcmcia_request_io(link, &link->io) != 0) |
1772 | goto next_entry; | 1768 | goto next_entry; |
1773 | } | 1769 | } |
1774 | 1770 | ||
@@ -1783,7 +1779,7 @@ static void nsp_cs_config(dev_link_t *link) | |||
1783 | req.Size = 0x1000; | 1779 | req.Size = 0x1000; |
1784 | } | 1780 | } |
1785 | req.AccessSpeed = 0; | 1781 | req.AccessSpeed = 0; |
1786 | if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) | 1782 | if (pcmcia_request_window(&link, &req, &link->win) != 0) |
1787 | goto next_entry; | 1783 | goto next_entry; |
1788 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; | 1784 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; |
1789 | if (pcmcia_map_mem_page(link->win, &map) != 0) | 1785 | if (pcmcia_map_mem_page(link->win, &map) != 0) |
@@ -1797,14 +1793,14 @@ static void nsp_cs_config(dev_link_t *link) | |||
1797 | 1793 | ||
1798 | next_entry: | 1794 | next_entry: |
1799 | nsp_dbg(NSP_DEBUG_INIT, "next"); | 1795 | nsp_dbg(NSP_DEBUG_INIT, "next"); |
1800 | pcmcia_disable_device(handle); | 1796 | pcmcia_disable_device(link); |
1801 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 1797 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
1802 | } | 1798 | } |
1803 | 1799 | ||
1804 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 1800 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
1805 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | 1801 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
1806 | } | 1802 | } |
1807 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 1803 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
1808 | 1804 | ||
1809 | if (free_ports) { | 1805 | if (free_ports) { |
1810 | if (link->io.BasePort1) { | 1806 | if (link->io.BasePort1) { |
@@ -1925,7 +1921,7 @@ static void nsp_cs_config(dev_link_t *link) | |||
1925 | 1921 | ||
1926 | cs_failed: | 1922 | cs_failed: |
1927 | nsp_dbg(NSP_DEBUG_INIT, "config fail"); | 1923 | nsp_dbg(NSP_DEBUG_INIT, "config fail"); |
1928 | cs_error(link->handle, last_fn, last_ret); | 1924 | cs_error(link, last_fn, last_ret); |
1929 | nsp_cs_release(link); | 1925 | nsp_cs_release(link); |
1930 | 1926 | ||
1931 | return; | 1927 | return; |
@@ -1938,7 +1934,7 @@ static void nsp_cs_config(dev_link_t *link) | |||
1938 | device, and release the PCMCIA configuration. If the device is | 1934 | device, and release the PCMCIA configuration. If the device is |
1939 | still open, this will be postponed until it is closed. | 1935 | still open, this will be postponed until it is closed. |
1940 | ======================================================================*/ | 1936 | ======================================================================*/ |
1941 | static void nsp_cs_release(dev_link_t *link) | 1937 | static void nsp_cs_release(struct pcmcia_device *link) |
1942 | { | 1938 | { |
1943 | scsi_info_t *info = link->priv; | 1939 | scsi_info_t *info = link->priv; |
1944 | nsp_hw_data *data = NULL; | 1940 | nsp_hw_data *data = NULL; |
@@ -1966,7 +1962,7 @@ static void nsp_cs_release(dev_link_t *link) | |||
1966 | iounmap((void *)(data->MmioAddress)); | 1962 | iounmap((void *)(data->MmioAddress)); |
1967 | } | 1963 | } |
1968 | } | 1964 | } |
1969 | pcmcia_disable_device(link->handle); | 1965 | pcmcia_disable_device(link); |
1970 | 1966 | ||
1971 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2)) | 1967 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2)) |
1972 | if (info->host != NULL) { | 1968 | if (info->host != NULL) { |
@@ -1975,9 +1971,8 @@ static void nsp_cs_release(dev_link_t *link) | |||
1975 | #endif | 1971 | #endif |
1976 | } /* nsp_cs_release */ | 1972 | } /* nsp_cs_release */ |
1977 | 1973 | ||
1978 | static int nsp_cs_suspend(struct pcmcia_device *dev) | 1974 | static int nsp_cs_suspend(struct pcmcia_device *link) |
1979 | { | 1975 | { |
1980 | dev_link_t *link = dev_to_instance(dev); | ||
1981 | scsi_info_t *info = link->priv; | 1976 | scsi_info_t *info = link->priv; |
1982 | nsp_hw_data *data; | 1977 | nsp_hw_data *data; |
1983 | 1978 | ||
@@ -1996,9 +1991,8 @@ static int nsp_cs_suspend(struct pcmcia_device *dev) | |||
1996 | return 0; | 1991 | return 0; |
1997 | } | 1992 | } |
1998 | 1993 | ||
1999 | static int nsp_cs_resume(struct pcmcia_device *dev) | 1994 | static int nsp_cs_resume(struct pcmcia_device *link) |
2000 | { | 1995 | { |
2001 | dev_link_t *link = dev_to_instance(dev); | ||
2002 | scsi_info_t *info = link->priv; | 1996 | scsi_info_t *info = link->priv; |
2003 | nsp_hw_data *data; | 1997 | nsp_hw_data *data; |
2004 | 1998 | ||
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index 2e1fde467c27..ce348b379f22 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h | |||
@@ -297,8 +297,8 @@ typedef struct _nsp_hw_data { | |||
297 | 297 | ||
298 | /* Card service functions */ | 298 | /* Card service functions */ |
299 | static void nsp_cs_detach (struct pcmcia_device *p_dev); | 299 | static void nsp_cs_detach (struct pcmcia_device *p_dev); |
300 | static void nsp_cs_release(dev_link_t *link); | 300 | static void nsp_cs_release(struct pcmcia_device *link); |
301 | static void nsp_cs_config (dev_link_t *link); | 301 | static void nsp_cs_config (struct pcmcia_device *link); |
302 | 302 | ||
303 | /* Linux SCSI subsystem specific functions */ | 303 | /* Linux SCSI subsystem specific functions */ |
304 | static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht); | 304 | static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht); |
@@ -450,7 +450,7 @@ static inline struct Scsi_Host *scsi_host_hn_get(unsigned short hostno) | |||
450 | return host; | 450 | return host; |
451 | } | 451 | } |
452 | 452 | ||
453 | static void cs_error(client_handle_t handle, int func, int ret) | 453 | static void cs_error(struct pcmcia_device *handle, int func, int ret) |
454 | { | 454 | { |
455 | error_info_t err = { func, ret }; | 455 | error_info_t err = { func, ret }; |
456 | pcmcia_report_error(handle, &err); | 456 | pcmcia_report_error(handle, &err); |
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index c6b3e9587ff3..a2a1c4b318e6 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
@@ -97,12 +97,12 @@ typedef struct scsi_info_t { | |||
97 | unsigned short manf_id; | 97 | unsigned short manf_id; |
98 | } scsi_info_t; | 98 | } scsi_info_t; |
99 | 99 | ||
100 | static void qlogic_release(dev_link_t *link); | 100 | static void qlogic_release(struct pcmcia_device *link); |
101 | static void qlogic_detach(struct pcmcia_device *p_dev); | 101 | static void qlogic_detach(struct pcmcia_device *p_dev); |
102 | static void qlogic_config(dev_link_t * link); | 102 | static void qlogic_config(struct pcmcia_device * link); |
103 | 103 | ||
104 | static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, | 104 | static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, |
105 | dev_link_t *link, int qbase, int qlirq) | 105 | struct pcmcia_device *link, int qbase, int qlirq) |
106 | { | 106 | { |
107 | int qltyp; /* type of chip */ | 107 | int qltyp; /* type of chip */ |
108 | int qinitid; | 108 | int qinitid; |
@@ -156,10 +156,9 @@ free_scsi_host: | |||
156 | err: | 156 | err: |
157 | return NULL; | 157 | return NULL; |
158 | } | 158 | } |
159 | static int qlogic_attach(struct pcmcia_device *p_dev) | 159 | static int qlogic_attach(struct pcmcia_device *link) |
160 | { | 160 | { |
161 | scsi_info_t *info; | 161 | scsi_info_t *info; |
162 | dev_link_t *link = dev_to_instance(p_dev); | ||
163 | 162 | ||
164 | DEBUG(0, "qlogic_attach()\n"); | 163 | DEBUG(0, "qlogic_attach()\n"); |
165 | 164 | ||
@@ -168,7 +167,7 @@ static int qlogic_attach(struct pcmcia_device *p_dev) | |||
168 | if (!info) | 167 | if (!info) |
169 | return -ENOMEM; | 168 | return -ENOMEM; |
170 | memset(info, 0, sizeof(*info)); | 169 | memset(info, 0, sizeof(*info)); |
171 | info->p_dev = p_dev; | 170 | info->p_dev = link; |
172 | link->priv = info; | 171 | link->priv = info; |
173 | link->io.NumPorts1 = 16; | 172 | link->io.NumPorts1 = 16; |
174 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 173 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
@@ -187,10 +186,8 @@ static int qlogic_attach(struct pcmcia_device *p_dev) | |||
187 | 186 | ||
188 | /*====================================================================*/ | 187 | /*====================================================================*/ |
189 | 188 | ||
190 | static void qlogic_detach(struct pcmcia_device *p_dev) | 189 | static void qlogic_detach(struct pcmcia_device *link) |
191 | { | 190 | { |
192 | dev_link_t *link = dev_to_instance(p_dev); | ||
193 | |||
194 | DEBUG(0, "qlogic_detach(0x%p)\n", link); | 191 | DEBUG(0, "qlogic_detach(0x%p)\n", link); |
195 | 192 | ||
196 | if (link->state & DEV_CONFIG) | 193 | if (link->state & DEV_CONFIG) |
@@ -205,9 +202,8 @@ static void qlogic_detach(struct pcmcia_device *p_dev) | |||
205 | #define CS_CHECK(fn, ret) \ | 202 | #define CS_CHECK(fn, ret) \ |
206 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 203 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
207 | 204 | ||
208 | static void qlogic_config(dev_link_t * link) | 205 | static void qlogic_config(struct pcmcia_device * link) |
209 | { | 206 | { |
210 | client_handle_t handle = link->handle; | ||
211 | scsi_info_t *info = link->priv; | 207 | scsi_info_t *info = link->priv; |
212 | tuple_t tuple; | 208 | tuple_t tuple; |
213 | cisparse_t parse; | 209 | cisparse_t parse; |
@@ -221,38 +217,38 @@ static void qlogic_config(dev_link_t * link) | |||
221 | tuple.TupleDataMax = 64; | 217 | tuple.TupleDataMax = 64; |
222 | tuple.TupleOffset = 0; | 218 | tuple.TupleOffset = 0; |
223 | tuple.DesiredTuple = CISTPL_CONFIG; | 219 | tuple.DesiredTuple = CISTPL_CONFIG; |
224 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 220 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
225 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 221 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
226 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 222 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
227 | link->conf.ConfigBase = parse.config.base; | 223 | link->conf.ConfigBase = parse.config.base; |
228 | 224 | ||
229 | tuple.DesiredTuple = CISTPL_MANFID; | 225 | tuple.DesiredTuple = CISTPL_MANFID; |
230 | if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) | 226 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) |
231 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); | 227 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); |
232 | 228 | ||
233 | /* Configure card */ | 229 | /* Configure card */ |
234 | link->state |= DEV_CONFIG; | 230 | link->state |= DEV_CONFIG; |
235 | 231 | ||
236 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 232 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
237 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 233 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
238 | while (1) { | 234 | while (1) { |
239 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 235 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
240 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 236 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
241 | goto next_entry; | 237 | goto next_entry; |
242 | link->conf.ConfigIndex = parse.cftable_entry.index; | 238 | link->conf.ConfigIndex = parse.cftable_entry.index; |
243 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; | 239 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; |
244 | link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; | 240 | link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; |
245 | if (link->io.BasePort1 != 0) { | 241 | if (link->io.BasePort1 != 0) { |
246 | i = pcmcia_request_io(handle, &link->io); | 242 | i = pcmcia_request_io(link, &link->io); |
247 | if (i == CS_SUCCESS) | 243 | if (i == CS_SUCCESS) |
248 | break; | 244 | break; |
249 | } | 245 | } |
250 | next_entry: | 246 | next_entry: |
251 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 247 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
252 | } | 248 | } |
253 | 249 | ||
254 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 250 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
255 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 251 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
256 | 252 | ||
257 | if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { | 253 | if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { |
258 | /* set ATAcmd */ | 254 | /* set ATAcmd */ |
@@ -283,15 +279,15 @@ out: | |||
283 | return; | 279 | return; |
284 | 280 | ||
285 | cs_failed: | 281 | cs_failed: |
286 | cs_error(link->handle, last_fn, last_ret); | 282 | cs_error(link, last_fn, last_ret); |
287 | pcmcia_disable_device(link->handle); | 283 | pcmcia_disable_device(link); |
288 | return; | 284 | return; |
289 | 285 | ||
290 | } /* qlogic_config */ | 286 | } /* qlogic_config */ |
291 | 287 | ||
292 | /*====================================================================*/ | 288 | /*====================================================================*/ |
293 | 289 | ||
294 | static void qlogic_release(dev_link_t *link) | 290 | static void qlogic_release(struct pcmcia_device *link) |
295 | { | 291 | { |
296 | scsi_info_t *info = link->priv; | 292 | scsi_info_t *info = link->priv; |
297 | 293 | ||
@@ -300,21 +296,19 @@ static void qlogic_release(dev_link_t *link) | |||
300 | scsi_remove_host(info->host); | 296 | scsi_remove_host(info->host); |
301 | 297 | ||
302 | free_irq(link->irq.AssignedIRQ, info->host); | 298 | free_irq(link->irq.AssignedIRQ, info->host); |
303 | pcmcia_disable_device(link->handle); | 299 | pcmcia_disable_device(link); |
304 | 300 | ||
305 | scsi_host_put(info->host); | 301 | scsi_host_put(info->host); |
306 | } | 302 | } |
307 | 303 | ||
308 | /*====================================================================*/ | 304 | /*====================================================================*/ |
309 | 305 | ||
310 | static int qlogic_resume(struct pcmcia_device *dev) | 306 | static int qlogic_resume(struct pcmcia_device *link) |
311 | { | 307 | { |
312 | dev_link_t *link = dev_to_instance(dev); | ||
313 | |||
314 | if (link->state & DEV_CONFIG) { | 308 | if (link->state & DEV_CONFIG) { |
315 | scsi_info_t *info = link->priv; | 309 | scsi_info_t *info = link->priv; |
316 | 310 | ||
317 | pcmcia_request_configuration(link->handle, &link->conf); | 311 | pcmcia_request_configuration(link, &link->conf); |
318 | if ((info->manf_id == MANFID_MACNICA) || | 312 | if ((info->manf_id == MANFID_MACNICA) || |
319 | (info->manf_id == MANFID_PIONEER) || | 313 | (info->manf_id == MANFID_PIONEER) || |
320 | (info->manf_id == 0x0098)) { | 314 | (info->manf_id == 0x0098)) { |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 1ef3109418c9..49a37de68758 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -527,7 +527,7 @@ idle_out: | |||
527 | } | 527 | } |
528 | 528 | ||
529 | static void | 529 | static void |
530 | SYM53C500_release(dev_link_t *link) | 530 | SYM53C500_release(struct pcmcia_device *link) |
531 | { | 531 | { |
532 | struct scsi_info_t *info = link->priv; | 532 | struct scsi_info_t *info = link->priv; |
533 | struct Scsi_Host *shost = info->host; | 533 | struct Scsi_Host *shost = info->host; |
@@ -550,7 +550,7 @@ SYM53C500_release(dev_link_t *link) | |||
550 | if (shost->io_port && shost->n_io_port) | 550 | if (shost->io_port && shost->n_io_port) |
551 | release_region(shost->io_port, shost->n_io_port); | 551 | release_region(shost->io_port, shost->n_io_port); |
552 | 552 | ||
553 | pcmcia_disable_device(link->handle); | 553 | pcmcia_disable_device(link); |
554 | 554 | ||
555 | scsi_host_put(shost); | 555 | scsi_host_put(shost); |
556 | } /* SYM53C500_release */ | 556 | } /* SYM53C500_release */ |
@@ -708,9 +708,8 @@ static struct scsi_host_template sym53c500_driver_template = { | |||
708 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 708 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
709 | 709 | ||
710 | static void | 710 | static void |
711 | SYM53C500_config(dev_link_t *link) | 711 | SYM53C500_config(struct pcmcia_device *link) |
712 | { | 712 | { |
713 | client_handle_t handle = link->handle; | ||
714 | struct scsi_info_t *info = link->priv; | 713 | struct scsi_info_t *info = link->priv; |
715 | tuple_t tuple; | 714 | tuple_t tuple; |
716 | cisparse_t parse; | 715 | cisparse_t parse; |
@@ -727,40 +726,40 @@ SYM53C500_config(dev_link_t *link) | |||
727 | tuple.TupleDataMax = 64; | 726 | tuple.TupleDataMax = 64; |
728 | tuple.TupleOffset = 0; | 727 | tuple.TupleOffset = 0; |
729 | tuple.DesiredTuple = CISTPL_CONFIG; | 728 | tuple.DesiredTuple = CISTPL_CONFIG; |
730 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 729 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
731 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 730 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
732 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 731 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
733 | link->conf.ConfigBase = parse.config.base; | 732 | link->conf.ConfigBase = parse.config.base; |
734 | 733 | ||
735 | tuple.DesiredTuple = CISTPL_MANFID; | 734 | tuple.DesiredTuple = CISTPL_MANFID; |
736 | if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && | 735 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && |
737 | (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) | 736 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) |
738 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); | 737 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); |
739 | 738 | ||
740 | /* Configure card */ | 739 | /* Configure card */ |
741 | link->state |= DEV_CONFIG; | 740 | link->state |= DEV_CONFIG; |
742 | 741 | ||
743 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 742 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
744 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 743 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
745 | while (1) { | 744 | while (1) { |
746 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 745 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
747 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 746 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
748 | goto next_entry; | 747 | goto next_entry; |
749 | link->conf.ConfigIndex = parse.cftable_entry.index; | 748 | link->conf.ConfigIndex = parse.cftable_entry.index; |
750 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; | 749 | link->io.BasePort1 = parse.cftable_entry.io.win[0].base; |
751 | link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; | 750 | link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; |
752 | 751 | ||
753 | if (link->io.BasePort1 != 0) { | 752 | if (link->io.BasePort1 != 0) { |
754 | i = pcmcia_request_io(handle, &link->io); | 753 | i = pcmcia_request_io(link, &link->io); |
755 | if (i == CS_SUCCESS) | 754 | if (i == CS_SUCCESS) |
756 | break; | 755 | break; |
757 | } | 756 | } |
758 | next_entry: | 757 | next_entry: |
759 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 758 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
760 | } | 759 | } |
761 | 760 | ||
762 | CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); | 761 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
763 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 762 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
764 | 763 | ||
765 | /* | 764 | /* |
766 | * That's the trouble with copying liberally from another driver. | 765 | * That's the trouble with copying liberally from another driver. |
@@ -852,14 +851,13 @@ out: | |||
852 | return; | 851 | return; |
853 | 852 | ||
854 | cs_failed: | 853 | cs_failed: |
855 | cs_error(link->handle, last_fn, last_ret); | 854 | cs_error(link, last_fn, last_ret); |
856 | SYM53C500_release(link); | 855 | SYM53C500_release(link); |
857 | return; | 856 | return; |
858 | } /* SYM53C500_config */ | 857 | } /* SYM53C500_config */ |
859 | 858 | ||
860 | static int sym53c500_resume(struct pcmcia_device *dev) | 859 | static int sym53c500_resume(struct pcmcia_device *link) |
861 | { | 860 | { |
862 | dev_link_t *link = dev_to_instance(dev); | ||
863 | struct scsi_info_t *info = link->priv; | 861 | struct scsi_info_t *info = link->priv; |
864 | 862 | ||
865 | if (link->state & DEV_CONFIG) { | 863 | if (link->state & DEV_CONFIG) { |
@@ -882,10 +880,8 @@ static int sym53c500_resume(struct pcmcia_device *dev) | |||
882 | } | 880 | } |
883 | 881 | ||
884 | static void | 882 | static void |
885 | SYM53C500_detach(struct pcmcia_device *p_dev) | 883 | SYM53C500_detach(struct pcmcia_device *link) |
886 | { | 884 | { |
887 | dev_link_t *link = dev_to_instance(p_dev); | ||
888 | |||
889 | DEBUG(0, "SYM53C500_detach(0x%p)\n", link); | 885 | DEBUG(0, "SYM53C500_detach(0x%p)\n", link); |
890 | 886 | ||
891 | if (link->state & DEV_CONFIG) | 887 | if (link->state & DEV_CONFIG) |
@@ -896,10 +892,9 @@ SYM53C500_detach(struct pcmcia_device *p_dev) | |||
896 | } /* SYM53C500_detach */ | 892 | } /* SYM53C500_detach */ |
897 | 893 | ||
898 | static int | 894 | static int |
899 | SYM53C500_attach(struct pcmcia_device *p_dev) | 895 | SYM53C500_attach(struct pcmcia_device *link) |
900 | { | 896 | { |
901 | struct scsi_info_t *info; | 897 | struct scsi_info_t *info; |
902 | dev_link_t *link = dev_to_instance(p_dev); | ||
903 | 898 | ||
904 | DEBUG(0, "SYM53C500_attach()\n"); | 899 | DEBUG(0, "SYM53C500_attach()\n"); |
905 | 900 | ||
@@ -908,7 +903,7 @@ SYM53C500_attach(struct pcmcia_device *p_dev) | |||
908 | if (!info) | 903 | if (!info) |
909 | return -ENOMEM; | 904 | return -ENOMEM; |
910 | memset(info, 0, sizeof(*info)); | 905 | memset(info, 0, sizeof(*info)); |
911 | info->p_dev = p_dev; | 906 | info->p_dev = link; |
912 | link->priv = info; | 907 | link->priv = info; |
913 | link->io.NumPorts1 = 16; | 908 | link->io.NumPorts1 = 16; |
914 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 909 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 6bcde2c7b159..1fe8cafebe38 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -113,7 +113,7 @@ struct serial_cfg_mem { | |||
113 | }; | 113 | }; |
114 | 114 | ||
115 | 115 | ||
116 | static void serial_config(dev_link_t * link); | 116 | static void serial_config(struct pcmcia_device * link); |
117 | 117 | ||
118 | 118 | ||
119 | /*====================================================================== | 119 | /*====================================================================== |
@@ -123,7 +123,7 @@ static void serial_config(dev_link_t * link); | |||
123 | 123 | ||
124 | ======================================================================*/ | 124 | ======================================================================*/ |
125 | 125 | ||
126 | static void serial_remove(dev_link_t *link) | 126 | static void serial_remove(struct pcmcia_device *link) |
127 | { | 127 | { |
128 | struct serial_info *info = link->priv; | 128 | struct serial_info *info = link->priv; |
129 | int i; | 129 | int i; |
@@ -142,16 +142,14 @@ static void serial_remove(dev_link_t *link) | |||
142 | info->p_dev->dev_node = NULL; | 142 | info->p_dev->dev_node = NULL; |
143 | 143 | ||
144 | if (!info->slave) | 144 | if (!info->slave) |
145 | pcmcia_disable_device(link->handle); | 145 | pcmcia_disable_device(link); |
146 | 146 | ||
147 | info->p_dev->state &= ~DEV_CONFIG; | 147 | info->p_dev->state &= ~DEV_CONFIG; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | static int serial_suspend(struct pcmcia_device *dev) | 151 | static int serial_suspend(struct pcmcia_device *link) |
152 | { | 152 | { |
153 | dev_link_t *link = dev_to_instance(dev); | ||
154 | |||
155 | if (link->state & DEV_CONFIG) { | 153 | if (link->state & DEV_CONFIG) { |
156 | struct serial_info *info = link->priv; | 154 | struct serial_info *info = link->priv; |
157 | int i; | 155 | int i; |
@@ -166,10 +164,8 @@ static int serial_suspend(struct pcmcia_device *dev) | |||
166 | return 0; | 164 | return 0; |
167 | } | 165 | } |
168 | 166 | ||
169 | static int serial_resume(struct pcmcia_device *dev) | 167 | static int serial_resume(struct pcmcia_device *link) |
170 | { | 168 | { |
171 | dev_link_t *link = dev_to_instance(dev); | ||
172 | |||
173 | if (DEV_OK(link)) { | 169 | if (DEV_OK(link)) { |
174 | struct serial_info *info = link->priv; | 170 | struct serial_info *info = link->priv; |
175 | int i; | 171 | int i; |
@@ -189,10 +185,9 @@ static int serial_resume(struct pcmcia_device *dev) | |||
189 | 185 | ||
190 | ======================================================================*/ | 186 | ======================================================================*/ |
191 | 187 | ||
192 | static int serial_probe(struct pcmcia_device *p_dev) | 188 | static int serial_probe(struct pcmcia_device *link) |
193 | { | 189 | { |
194 | struct serial_info *info; | 190 | struct serial_info *info; |
195 | dev_link_t *link = dev_to_instance(p_dev); | ||
196 | 191 | ||
197 | DEBUG(0, "serial_attach()\n"); | 192 | DEBUG(0, "serial_attach()\n"); |
198 | 193 | ||
@@ -201,7 +196,7 @@ static int serial_probe(struct pcmcia_device *p_dev) | |||
201 | if (!info) | 196 | if (!info) |
202 | return -ENOMEM; | 197 | return -ENOMEM; |
203 | memset(info, 0, sizeof (*info)); | 198 | memset(info, 0, sizeof (*info)); |
204 | info->p_dev = p_dev; | 199 | info->p_dev = link; |
205 | link->priv = info; | 200 | link->priv = info; |
206 | 201 | ||
207 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 202 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
@@ -230,9 +225,8 @@ static int serial_probe(struct pcmcia_device *p_dev) | |||
230 | 225 | ||
231 | ======================================================================*/ | 226 | ======================================================================*/ |
232 | 227 | ||
233 | static void serial_detach(struct pcmcia_device *p_dev) | 228 | static void serial_detach(struct pcmcia_device *link) |
234 | { | 229 | { |
235 | dev_link_t *link = dev_to_instance(p_dev); | ||
236 | struct serial_info *info = link->priv; | 230 | struct serial_info *info = link->priv; |
237 | 231 | ||
238 | DEBUG(0, "serial_detach(0x%p)\n", link); | 232 | DEBUG(0, "serial_detach(0x%p)\n", link); |
@@ -253,7 +247,7 @@ static void serial_detach(struct pcmcia_device *p_dev) | |||
253 | 247 | ||
254 | /*====================================================================*/ | 248 | /*====================================================================*/ |
255 | 249 | ||
256 | static int setup_serial(client_handle_t handle, struct serial_info * info, | 250 | static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, |
257 | kio_addr_t iobase, int irq) | 251 | kio_addr_t iobase, int irq) |
258 | { | 252 | { |
259 | struct uart_port port; | 253 | struct uart_port port; |
@@ -288,7 +282,7 @@ static int setup_serial(client_handle_t handle, struct serial_info * info, | |||
288 | /*====================================================================*/ | 282 | /*====================================================================*/ |
289 | 283 | ||
290 | static int | 284 | static int |
291 | first_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | 285 | first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) |
292 | { | 286 | { |
293 | int i; | 287 | int i; |
294 | i = pcmcia_get_first_tuple(handle, tuple); | 288 | i = pcmcia_get_first_tuple(handle, tuple); |
@@ -301,7 +295,7 @@ first_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | |||
301 | } | 295 | } |
302 | 296 | ||
303 | static int | 297 | static int |
304 | next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | 298 | next_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) |
305 | { | 299 | { |
306 | int i; | 300 | int i; |
307 | i = pcmcia_get_next_tuple(handle, tuple); | 301 | i = pcmcia_get_next_tuple(handle, tuple); |
@@ -315,11 +309,10 @@ next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | |||
315 | 309 | ||
316 | /*====================================================================*/ | 310 | /*====================================================================*/ |
317 | 311 | ||
318 | static int simple_config(dev_link_t *link) | 312 | static int simple_config(struct pcmcia_device *link) |
319 | { | 313 | { |
320 | static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 314 | static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
321 | static const int size_table[2] = { 8, 16 }; | 315 | static const int size_table[2] = { 8, 16 }; |
322 | client_handle_t handle = link->handle; | ||
323 | struct serial_info *info = link->priv; | 316 | struct serial_info *info = link->priv; |
324 | struct serial_cfg_mem *cfg_mem; | 317 | struct serial_cfg_mem *cfg_mem; |
325 | tuple_t *tuple; | 318 | tuple_t *tuple; |
@@ -340,7 +333,7 @@ static int simple_config(dev_link_t *link) | |||
340 | buf = cfg_mem->buf; | 333 | buf = cfg_mem->buf; |
341 | 334 | ||
342 | /* If the card is already configured, look up the port and irq */ | 335 | /* If the card is already configured, look up the port and irq */ |
343 | i = pcmcia_get_configuration_info(handle, &config); | 336 | i = pcmcia_get_configuration_info(link, &config); |
344 | if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { | 337 | if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { |
345 | kio_addr_t port = 0; | 338 | kio_addr_t port = 0; |
346 | if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) { | 339 | if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) { |
@@ -353,7 +346,7 @@ static int simple_config(dev_link_t *link) | |||
353 | } | 346 | } |
354 | if (info->slave) { | 347 | if (info->slave) { |
355 | kfree(cfg_mem); | 348 | kfree(cfg_mem); |
356 | return setup_serial(handle, info, port, config.AssignedIRQ); | 349 | return setup_serial(link, info, port, config.AssignedIRQ); |
357 | } | 350 | } |
358 | } | 351 | } |
359 | 352 | ||
@@ -366,7 +359,7 @@ static int simple_config(dev_link_t *link) | |||
366 | /* Two tries: without IO aliases, then with aliases */ | 359 | /* Two tries: without IO aliases, then with aliases */ |
367 | for (s = 0; s < 2; s++) { | 360 | for (s = 0; s < 2; s++) { |
368 | for (try = 0; try < 2; try++) { | 361 | for (try = 0; try < 2; try++) { |
369 | i = first_tuple(handle, tuple, parse); | 362 | i = first_tuple(link, tuple, parse); |
370 | while (i != CS_NO_MORE_ITEMS) { | 363 | while (i != CS_NO_MORE_ITEMS) { |
371 | if (i != CS_SUCCESS) | 364 | if (i != CS_SUCCESS) |
372 | goto next_entry; | 365 | goto next_entry; |
@@ -379,19 +372,19 @@ static int simple_config(dev_link_t *link) | |||
379 | link->io.BasePort1 = cf->io.win[0].base; | 372 | link->io.BasePort1 = cf->io.win[0].base; |
380 | link->io.IOAddrLines = (try == 0) ? | 373 | link->io.IOAddrLines = (try == 0) ? |
381 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | 374 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; |
382 | i = pcmcia_request_io(link->handle, &link->io); | 375 | i = pcmcia_request_io(link, &link->io); |
383 | if (i == CS_SUCCESS) | 376 | if (i == CS_SUCCESS) |
384 | goto found_port; | 377 | goto found_port; |
385 | } | 378 | } |
386 | next_entry: | 379 | next_entry: |
387 | i = next_tuple(handle, tuple, parse); | 380 | i = next_tuple(link, tuple, parse); |
388 | } | 381 | } |
389 | } | 382 | } |
390 | } | 383 | } |
391 | /* Second pass: try to find an entry that isn't picky about | 384 | /* Second pass: try to find an entry that isn't picky about |
392 | its base address, then try to grab any standard serial port | 385 | its base address, then try to grab any standard serial port |
393 | address, and finally try to get any free port. */ | 386 | address, and finally try to get any free port. */ |
394 | i = first_tuple(handle, tuple, parse); | 387 | i = first_tuple(link, tuple, parse); |
395 | while (i != CS_NO_MORE_ITEMS) { | 388 | while (i != CS_NO_MORE_ITEMS) { |
396 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && | 389 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && |
397 | ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 390 | ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
@@ -399,43 +392,42 @@ next_entry: | |||
399 | for (j = 0; j < 5; j++) { | 392 | for (j = 0; j < 5; j++) { |
400 | link->io.BasePort1 = base[j]; | 393 | link->io.BasePort1 = base[j]; |
401 | link->io.IOAddrLines = base[j] ? 16 : 3; | 394 | link->io.IOAddrLines = base[j] ? 16 : 3; |
402 | i = pcmcia_request_io(link->handle, &link->io); | 395 | i = pcmcia_request_io(link, &link->io); |
403 | if (i == CS_SUCCESS) | 396 | if (i == CS_SUCCESS) |
404 | goto found_port; | 397 | goto found_port; |
405 | } | 398 | } |
406 | } | 399 | } |
407 | i = next_tuple(handle, tuple, parse); | 400 | i = next_tuple(link, tuple, parse); |
408 | } | 401 | } |
409 | 402 | ||
410 | found_port: | 403 | found_port: |
411 | if (i != CS_SUCCESS) { | 404 | if (i != CS_SUCCESS) { |
412 | printk(KERN_NOTICE | 405 | printk(KERN_NOTICE |
413 | "serial_cs: no usable port range found, giving up\n"); | 406 | "serial_cs: no usable port range found, giving up\n"); |
414 | cs_error(link->handle, RequestIO, i); | 407 | cs_error(link, RequestIO, i); |
415 | kfree(cfg_mem); | 408 | kfree(cfg_mem); |
416 | return -1; | 409 | return -1; |
417 | } | 410 | } |
418 | 411 | ||
419 | i = pcmcia_request_irq(link->handle, &link->irq); | 412 | i = pcmcia_request_irq(link, &link->irq); |
420 | if (i != CS_SUCCESS) { | 413 | if (i != CS_SUCCESS) { |
421 | cs_error(link->handle, RequestIRQ, i); | 414 | cs_error(link, RequestIRQ, i); |
422 | link->irq.AssignedIRQ = 0; | 415 | link->irq.AssignedIRQ = 0; |
423 | } | 416 | } |
424 | if (info->multi && (info->manfid == MANFID_3COM)) | 417 | if (info->multi && (info->manfid == MANFID_3COM)) |
425 | link->conf.ConfigIndex &= ~(0x08); | 418 | link->conf.ConfigIndex &= ~(0x08); |
426 | i = pcmcia_request_configuration(link->handle, &link->conf); | 419 | i = pcmcia_request_configuration(link, &link->conf); |
427 | if (i != CS_SUCCESS) { | 420 | if (i != CS_SUCCESS) { |
428 | cs_error(link->handle, RequestConfiguration, i); | 421 | cs_error(link, RequestConfiguration, i); |
429 | kfree(cfg_mem); | 422 | kfree(cfg_mem); |
430 | return -1; | 423 | return -1; |
431 | } | 424 | } |
432 | kfree(cfg_mem); | 425 | kfree(cfg_mem); |
433 | return setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); | 426 | return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
434 | } | 427 | } |
435 | 428 | ||
436 | static int multi_config(dev_link_t * link) | 429 | static int multi_config(struct pcmcia_device * link) |
437 | { | 430 | { |
438 | client_handle_t handle = link->handle; | ||
439 | struct serial_info *info = link->priv; | 431 | struct serial_info *info = link->priv; |
440 | struct serial_cfg_mem *cfg_mem; | 432 | struct serial_cfg_mem *cfg_mem; |
441 | tuple_t *tuple; | 433 | tuple_t *tuple; |
@@ -460,7 +452,7 @@ static int multi_config(dev_link_t * link) | |||
460 | 452 | ||
461 | /* First, look for a generic full-sized window */ | 453 | /* First, look for a generic full-sized window */ |
462 | link->io.NumPorts1 = info->multi * 8; | 454 | link->io.NumPorts1 = info->multi * 8; |
463 | i = first_tuple(handle, tuple, parse); | 455 | i = first_tuple(link, tuple, parse); |
464 | while (i != CS_NO_MORE_ITEMS) { | 456 | while (i != CS_NO_MORE_ITEMS) { |
465 | /* The quad port cards have bad CIS's, so just look for a | 457 | /* The quad port cards have bad CIS's, so just look for a |
466 | window larger than 8 ports and assume it will be right */ | 458 | window larger than 8 ports and assume it will be right */ |
@@ -470,19 +462,19 @@ static int multi_config(dev_link_t * link) | |||
470 | link->io.BasePort1 = cf->io.win[0].base; | 462 | link->io.BasePort1 = cf->io.win[0].base; |
471 | link->io.IOAddrLines = | 463 | link->io.IOAddrLines = |
472 | cf->io.flags & CISTPL_IO_LINES_MASK; | 464 | cf->io.flags & CISTPL_IO_LINES_MASK; |
473 | i = pcmcia_request_io(link->handle, &link->io); | 465 | i = pcmcia_request_io(link, &link->io); |
474 | base2 = link->io.BasePort1 + 8; | 466 | base2 = link->io.BasePort1 + 8; |
475 | if (i == CS_SUCCESS) | 467 | if (i == CS_SUCCESS) |
476 | break; | 468 | break; |
477 | } | 469 | } |
478 | i = next_tuple(handle, tuple, parse); | 470 | i = next_tuple(link, tuple, parse); |
479 | } | 471 | } |
480 | 472 | ||
481 | /* If that didn't work, look for two windows */ | 473 | /* If that didn't work, look for two windows */ |
482 | if (i != CS_SUCCESS) { | 474 | if (i != CS_SUCCESS) { |
483 | link->io.NumPorts1 = link->io.NumPorts2 = 8; | 475 | link->io.NumPorts1 = link->io.NumPorts2 = 8; |
484 | info->multi = 2; | 476 | info->multi = 2; |
485 | i = first_tuple(handle, tuple, parse); | 477 | i = first_tuple(link, tuple, parse); |
486 | while (i != CS_NO_MORE_ITEMS) { | 478 | while (i != CS_NO_MORE_ITEMS) { |
487 | if ((i == CS_SUCCESS) && (cf->io.nwin == 2)) { | 479 | if ((i == CS_SUCCESS) && (cf->io.nwin == 2)) { |
488 | link->conf.ConfigIndex = cf->index; | 480 | link->conf.ConfigIndex = cf->index; |
@@ -490,26 +482,26 @@ static int multi_config(dev_link_t * link) | |||
490 | link->io.BasePort2 = cf->io.win[1].base; | 482 | link->io.BasePort2 = cf->io.win[1].base; |
491 | link->io.IOAddrLines = | 483 | link->io.IOAddrLines = |
492 | cf->io.flags & CISTPL_IO_LINES_MASK; | 484 | cf->io.flags & CISTPL_IO_LINES_MASK; |
493 | i = pcmcia_request_io(link->handle, &link->io); | 485 | i = pcmcia_request_io(link, &link->io); |
494 | base2 = link->io.BasePort2; | 486 | base2 = link->io.BasePort2; |
495 | if (i == CS_SUCCESS) | 487 | if (i == CS_SUCCESS) |
496 | break; | 488 | break; |
497 | } | 489 | } |
498 | i = next_tuple(handle, tuple, parse); | 490 | i = next_tuple(link, tuple, parse); |
499 | } | 491 | } |
500 | } | 492 | } |
501 | 493 | ||
502 | if (i != CS_SUCCESS) { | 494 | if (i != CS_SUCCESS) { |
503 | cs_error(link->handle, RequestIO, i); | 495 | cs_error(link, RequestIO, i); |
504 | rc = -1; | 496 | rc = -1; |
505 | goto free_cfg_mem; | 497 | goto free_cfg_mem; |
506 | } | 498 | } |
507 | 499 | ||
508 | i = pcmcia_request_irq(link->handle, &link->irq); | 500 | i = pcmcia_request_irq(link, &link->irq); |
509 | if (i != CS_SUCCESS) { | 501 | if (i != CS_SUCCESS) { |
510 | printk(KERN_NOTICE | 502 | printk(KERN_NOTICE |
511 | "serial_cs: no usable port range found, giving up\n"); | 503 | "serial_cs: no usable port range found, giving up\n"); |
512 | cs_error(link->handle, RequestIRQ, i); | 504 | cs_error(link, RequestIRQ, i); |
513 | link->irq.AssignedIRQ = 0; | 505 | link->irq.AssignedIRQ = 0; |
514 | } | 506 | } |
515 | /* Socket Dual IO: this enables irq's for second port */ | 507 | /* Socket Dual IO: this enables irq's for second port */ |
@@ -517,9 +509,9 @@ static int multi_config(dev_link_t * link) | |||
517 | link->conf.Present |= PRESENT_EXT_STATUS; | 509 | link->conf.Present |= PRESENT_EXT_STATUS; |
518 | link->conf.ExtStatus = ESR_REQ_ATTN_ENA; | 510 | link->conf.ExtStatus = ESR_REQ_ATTN_ENA; |
519 | } | 511 | } |
520 | i = pcmcia_request_configuration(link->handle, &link->conf); | 512 | i = pcmcia_request_configuration(link, &link->conf); |
521 | if (i != CS_SUCCESS) { | 513 | if (i != CS_SUCCESS) { |
522 | cs_error(link->handle, RequestConfiguration, i); | 514 | cs_error(link, RequestConfiguration, i); |
523 | rc = -1; | 515 | rc = -1; |
524 | goto free_cfg_mem; | 516 | goto free_cfg_mem; |
525 | } | 517 | } |
@@ -528,24 +520,24 @@ static int multi_config(dev_link_t * link) | |||
528 | 8 registers are for the UART, the others are extra registers */ | 520 | 8 registers are for the UART, the others are extra registers */ |
529 | if (info->manfid == MANFID_OXSEMI) { | 521 | if (info->manfid == MANFID_OXSEMI) { |
530 | if (cf->index == 1 || cf->index == 3) { | 522 | if (cf->index == 1 || cf->index == 3) { |
531 | setup_serial(handle, info, base2, link->irq.AssignedIRQ); | 523 | setup_serial(link, info, base2, link->irq.AssignedIRQ); |
532 | outb(12, link->io.BasePort1 + 1); | 524 | outb(12, link->io.BasePort1 + 1); |
533 | } else { | 525 | } else { |
534 | setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); | 526 | setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
535 | outb(12, base2 + 1); | 527 | outb(12, base2 + 1); |
536 | } | 528 | } |
537 | rc = 0; | 529 | rc = 0; |
538 | goto free_cfg_mem; | 530 | goto free_cfg_mem; |
539 | } | 531 | } |
540 | 532 | ||
541 | setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); | 533 | setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
542 | /* The Nokia cards are not really multiport cards */ | 534 | /* The Nokia cards are not really multiport cards */ |
543 | if (info->manfid == MANFID_NOKIA) { | 535 | if (info->manfid == MANFID_NOKIA) { |
544 | rc = 0; | 536 | rc = 0; |
545 | goto free_cfg_mem; | 537 | goto free_cfg_mem; |
546 | } | 538 | } |
547 | for (i = 0; i < info->multi - 1; i++) | 539 | for (i = 0; i < info->multi - 1; i++) |
548 | setup_serial(handle, info, base2 + (8 * i), | 540 | setup_serial(link, info, base2 + (8 * i), |
549 | link->irq.AssignedIRQ); | 541 | link->irq.AssignedIRQ); |
550 | rc = 0; | 542 | rc = 0; |
551 | free_cfg_mem: | 543 | free_cfg_mem: |
@@ -561,9 +553,8 @@ free_cfg_mem: | |||
561 | 553 | ||
562 | ======================================================================*/ | 554 | ======================================================================*/ |
563 | 555 | ||
564 | void serial_config(dev_link_t * link) | 556 | void serial_config(struct pcmcia_device * link) |
565 | { | 557 | { |
566 | client_handle_t handle = link->handle; | ||
567 | struct serial_info *info = link->priv; | 558 | struct serial_info *info = link->priv; |
568 | struct serial_cfg_mem *cfg_mem; | 559 | struct serial_cfg_mem *cfg_mem; |
569 | tuple_t *tuple; | 560 | tuple_t *tuple; |
@@ -589,7 +580,7 @@ void serial_config(dev_link_t * link) | |||
589 | tuple->Attributes = 0; | 580 | tuple->Attributes = 0; |
590 | /* Get configuration register information */ | 581 | /* Get configuration register information */ |
591 | tuple->DesiredTuple = CISTPL_CONFIG; | 582 | tuple->DesiredTuple = CISTPL_CONFIG; |
592 | last_ret = first_tuple(handle, tuple, parse); | 583 | last_ret = first_tuple(link, tuple, parse); |
593 | if (last_ret != CS_SUCCESS) { | 584 | if (last_ret != CS_SUCCESS) { |
594 | last_fn = ParseTuple; | 585 | last_fn = ParseTuple; |
595 | goto cs_failed; | 586 | goto cs_failed; |
@@ -603,11 +594,11 @@ void serial_config(dev_link_t * link) | |||
603 | /* Is this a compliant multifunction card? */ | 594 | /* Is this a compliant multifunction card? */ |
604 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 595 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
605 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | 596 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; |
606 | info->multi = (first_tuple(handle, tuple, parse) == CS_SUCCESS); | 597 | info->multi = (first_tuple(link, tuple, parse) == CS_SUCCESS); |
607 | 598 | ||
608 | /* Is this a multiport card? */ | 599 | /* Is this a multiport card? */ |
609 | tuple->DesiredTuple = CISTPL_MANFID; | 600 | tuple->DesiredTuple = CISTPL_MANFID; |
610 | if (first_tuple(handle, tuple, parse) == CS_SUCCESS) { | 601 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { |
611 | info->manfid = parse->manfid.manf; | 602 | info->manfid = parse->manfid.manf; |
612 | for (i = 0; i < MULTI_COUNT; i++) | 603 | for (i = 0; i < MULTI_COUNT; i++) |
613 | if ((info->manfid == multi_id[i].manfid) && | 604 | if ((info->manfid == multi_id[i].manfid) && |
@@ -621,11 +612,11 @@ void serial_config(dev_link_t * link) | |||
621 | multifunction cards that ask for appropriate IO port ranges */ | 612 | multifunction cards that ask for appropriate IO port ranges */ |
622 | tuple->DesiredTuple = CISTPL_FUNCID; | 613 | tuple->DesiredTuple = CISTPL_FUNCID; |
623 | if ((info->multi == 0) && | 614 | if ((info->multi == 0) && |
624 | ((first_tuple(handle, tuple, parse) != CS_SUCCESS) || | 615 | ((first_tuple(link, tuple, parse) != CS_SUCCESS) || |
625 | (parse->funcid.func == CISTPL_FUNCID_MULTI) || | 616 | (parse->funcid.func == CISTPL_FUNCID_MULTI) || |
626 | (parse->funcid.func == CISTPL_FUNCID_SERIAL))) { | 617 | (parse->funcid.func == CISTPL_FUNCID_SERIAL))) { |
627 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | 618 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; |
628 | if (first_tuple(handle, tuple, parse) == CS_SUCCESS) { | 619 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { |
629 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) | 620 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) |
630 | info->multi = cf->io.win[0].len >> 3; | 621 | info->multi = cf->io.win[0].len >> 3; |
631 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && | 622 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && |
@@ -644,14 +635,14 @@ void serial_config(dev_link_t * link) | |||
644 | 635 | ||
645 | if (info->manfid == MANFID_IBM) { | 636 | if (info->manfid == MANFID_IBM) { |
646 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; | 637 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; |
647 | last_ret = pcmcia_access_configuration_register(link->handle, ®); | 638 | last_ret = pcmcia_access_configuration_register(link, ®); |
648 | if (last_ret) { | 639 | if (last_ret) { |
649 | last_fn = AccessConfigurationRegister; | 640 | last_fn = AccessConfigurationRegister; |
650 | goto cs_failed; | 641 | goto cs_failed; |
651 | } | 642 | } |
652 | reg.Action = CS_WRITE; | 643 | reg.Action = CS_WRITE; |
653 | reg.Value = reg.Value | 1; | 644 | reg.Value = reg.Value | 1; |
654 | last_ret = pcmcia_access_configuration_register(link->handle, ®); | 645 | last_ret = pcmcia_access_configuration_register(link, ®); |
655 | if (last_ret) { | 646 | if (last_ret) { |
656 | last_fn = AccessConfigurationRegister; | 647 | last_fn = AccessConfigurationRegister; |
657 | goto cs_failed; | 648 | goto cs_failed; |
@@ -664,7 +655,7 @@ void serial_config(dev_link_t * link) | |||
664 | return; | 655 | return; |
665 | 656 | ||
666 | cs_failed: | 657 | cs_failed: |
667 | cs_error(link->handle, last_fn, last_ret); | 658 | cs_error(link, last_fn, last_ret); |
668 | failed: | 659 | failed: |
669 | serial_remove(link); | 660 | serial_remove(link); |
670 | link->state &= ~DEV_CONFIG_PENDING; | 661 | link->state &= ~DEV_CONFIG_PENDING; |
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 0afd6c04f2f8..bad68187f215 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -35,8 +35,8 @@ typedef struct ixj_info_t { | |||
35 | } ixj_info_t; | 35 | } ixj_info_t; |
36 | 36 | ||
37 | static void ixj_detach(struct pcmcia_device *p_dev); | 37 | static void ixj_detach(struct pcmcia_device *p_dev); |
38 | static void ixj_config(dev_link_t * link); | 38 | static void ixj_config(struct pcmcia_device * link); |
39 | static void ixj_cs_release(dev_link_t * link); | 39 | static void ixj_cs_release(struct pcmcia_device * link); |
40 | 40 | ||
41 | static int ixj_attach(struct pcmcia_device *p_dev) | 41 | static int ixj_attach(struct pcmcia_device *p_dev) |
42 | { | 42 | { |
@@ -58,10 +58,8 @@ static int ixj_attach(struct pcmcia_device *p_dev) | |||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | ||
61 | static void ixj_detach(struct pcmcia_device *p_dev) | 61 | static void ixj_detach(struct pcmcia_device *link) |
62 | { | 62 | { |
63 | dev_link_t *link = dev_to_instance(p_dev); | ||
64 | |||
65 | DEBUG(0, "ixj_detach(0x%p)\n", link); | 63 | DEBUG(0, "ixj_detach(0x%p)\n", link); |
66 | 64 | ||
67 | link->state &= ~DEV_RELEASE_PENDING; | 65 | link->state &= ~DEV_RELEASE_PENDING; |
@@ -74,22 +72,20 @@ static void ixj_detach(struct pcmcia_device *p_dev) | |||
74 | #define CS_CHECK(fn, ret) \ | 72 | #define CS_CHECK(fn, ret) \ |
75 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 73 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
76 | 74 | ||
77 | static void ixj_get_serial(dev_link_t * link, IXJ * j) | 75 | static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) |
78 | { | 76 | { |
79 | client_handle_t handle; | ||
80 | tuple_t tuple; | 77 | tuple_t tuple; |
81 | u_short buf[128]; | 78 | u_short buf[128]; |
82 | char *str; | 79 | char *str; |
83 | int last_ret, last_fn, i, place; | 80 | int last_ret, last_fn, i, place; |
84 | handle = link->handle; | ||
85 | DEBUG(0, "ixj_get_serial(0x%p)\n", link); | 81 | DEBUG(0, "ixj_get_serial(0x%p)\n", link); |
86 | tuple.TupleData = (cisdata_t *) buf; | 82 | tuple.TupleData = (cisdata_t *) buf; |
87 | tuple.TupleOffset = 0; | 83 | tuple.TupleOffset = 0; |
88 | tuple.TupleDataMax = 80; | 84 | tuple.TupleDataMax = 80; |
89 | tuple.Attributes = 0; | 85 | tuple.Attributes = 0; |
90 | tuple.DesiredTuple = CISTPL_VERS_1; | 86 | tuple.DesiredTuple = CISTPL_VERS_1; |
91 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 87 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
92 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 88 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
93 | str = (char *) buf; | 89 | str = (char *) buf; |
94 | printk("PCMCIA Version %d.%d\n", str[0], str[1]); | 90 | printk("PCMCIA Version %d.%d\n", str[0], str[1]); |
95 | str += 2; | 91 | str += 2; |
@@ -137,10 +133,9 @@ static void ixj_get_serial(dev_link_t * link, IXJ * j) | |||
137 | return; | 133 | return; |
138 | } | 134 | } |
139 | 135 | ||
140 | static void ixj_config(dev_link_t * link) | 136 | static void ixj_config(struct pcmcia_device * link) |
141 | { | 137 | { |
142 | IXJ *j; | 138 | IXJ *j; |
143 | client_handle_t handle; | ||
144 | ixj_info_t *info; | 139 | ixj_info_t *info; |
145 | tuple_t tuple; | 140 | tuple_t tuple; |
146 | u_short buf[128]; | 141 | u_short buf[128]; |
@@ -151,7 +146,6 @@ static void ixj_config(dev_link_t * link) | |||
151 | 0 | 146 | 0 |
152 | }; | 147 | }; |
153 | int last_ret, last_fn; | 148 | int last_ret, last_fn; |
154 | handle = link->handle; | ||
155 | info = link->priv; | 149 | info = link->priv; |
156 | DEBUG(0, "ixj_config(0x%p)\n", link); | 150 | DEBUG(0, "ixj_config(0x%p)\n", link); |
157 | tuple.TupleData = (cisdata_t *) buf; | 151 | tuple.TupleData = (cisdata_t *) buf; |
@@ -159,18 +153,18 @@ static void ixj_config(dev_link_t * link) | |||
159 | tuple.TupleDataMax = 255; | 153 | tuple.TupleDataMax = 255; |
160 | tuple.Attributes = 0; | 154 | tuple.Attributes = 0; |
161 | tuple.DesiredTuple = CISTPL_CONFIG; | 155 | tuple.DesiredTuple = CISTPL_CONFIG; |
162 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 156 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
163 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 157 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
164 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 158 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
165 | link->conf.ConfigBase = parse.config.base; | 159 | link->conf.ConfigBase = parse.config.base; |
166 | link->conf.Present = parse.config.rmask[0]; | 160 | link->conf.Present = parse.config.rmask[0]; |
167 | link->state |= DEV_CONFIG; | 161 | link->state |= DEV_CONFIG; |
168 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 162 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
169 | tuple.Attributes = 0; | 163 | tuple.Attributes = 0; |
170 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 164 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
171 | while (1) { | 165 | while (1) { |
172 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 166 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
173 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 167 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
174 | goto next_entry; | 168 | goto next_entry; |
175 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | 169 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { |
176 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | 170 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; |
@@ -181,7 +175,7 @@ static void ixj_config(dev_link_t * link) | |||
181 | link->io.BasePort2 = io->win[1].base; | 175 | link->io.BasePort2 = io->win[1].base; |
182 | link->io.NumPorts2 = io->win[1].len; | 176 | link->io.NumPorts2 = io->win[1].len; |
183 | } | 177 | } |
184 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 178 | if (pcmcia_request_io(link, &link->io) != 0) |
185 | goto next_entry; | 179 | goto next_entry; |
186 | /* If we've got this far, we're done */ | 180 | /* If we've got this far, we're done */ |
187 | break; | 181 | break; |
@@ -189,10 +183,10 @@ static void ixj_config(dev_link_t * link) | |||
189 | next_entry: | 183 | next_entry: |
190 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 184 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) |
191 | dflt = *cfg; | 185 | dflt = *cfg; |
192 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 186 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
193 | } | 187 | } |
194 | 188 | ||
195 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 189 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
196 | 190 | ||
197 | /* | 191 | /* |
198 | * Register the card with the core. | 192 | * Register the card with the core. |
@@ -206,16 +200,16 @@ static void ixj_config(dev_link_t * link) | |||
206 | link->state &= ~DEV_CONFIG_PENDING; | 200 | link->state &= ~DEV_CONFIG_PENDING; |
207 | return; | 201 | return; |
208 | cs_failed: | 202 | cs_failed: |
209 | cs_error(link->handle, last_fn, last_ret); | 203 | cs_error(link, last_fn, last_ret); |
210 | ixj_cs_release(link); | 204 | ixj_cs_release(link); |
211 | } | 205 | } |
212 | 206 | ||
213 | static void ixj_cs_release(dev_link_t *link) | 207 | static void ixj_cs_release(struct pcmcia_device *link) |
214 | { | 208 | { |
215 | ixj_info_t *info = link->priv; | 209 | ixj_info_t *info = link->priv; |
216 | DEBUG(0, "ixj_cs_release(0x%p)\n", link); | 210 | DEBUG(0, "ixj_cs_release(0x%p)\n", link); |
217 | info->ndev = 0; | 211 | info->ndev = 0; |
218 | pcmcia_disable_device(link->handle); | 212 | pcmcia_disable_device(link); |
219 | } | 213 | } |
220 | 214 | ||
221 | static struct pcmcia_device_id ixj_ids[] = { | 215 | static struct pcmcia_device_id ixj_ids[] = { |
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 8e61faa120fc..bfa8b213e137 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -71,7 +71,7 @@ typedef struct local_info_t { | |||
71 | dev_node_t node; | 71 | dev_node_t node; |
72 | } local_info_t; | 72 | } local_info_t; |
73 | 73 | ||
74 | static void sl811_cs_release(dev_link_t * link); | 74 | static void sl811_cs_release(struct pcmcia_device * link); |
75 | 75 | ||
76 | /*====================================================================*/ | 76 | /*====================================================================*/ |
77 | 77 | ||
@@ -138,10 +138,8 @@ static int sl811_hc_init(struct device *parent, ioaddr_t base_addr, int irq) | |||
138 | 138 | ||
139 | /*====================================================================*/ | 139 | /*====================================================================*/ |
140 | 140 | ||
141 | static void sl811_cs_detach(struct pcmcia_device *p_dev) | 141 | static void sl811_cs_detach(struct pcmcia_device *link) |
142 | { | 142 | { |
143 | dev_link_t *link = dev_to_instance(p_dev); | ||
144 | |||
145 | DBG(0, "sl811_cs_detach(0x%p)\n", link); | 143 | DBG(0, "sl811_cs_detach(0x%p)\n", link); |
146 | 144 | ||
147 | link->state &= ~DEV_PRESENT; | 145 | link->state &= ~DEV_PRESENT; |
@@ -152,18 +150,17 @@ static void sl811_cs_detach(struct pcmcia_device *p_dev) | |||
152 | kfree(link->priv); | 150 | kfree(link->priv); |
153 | } | 151 | } |
154 | 152 | ||
155 | static void sl811_cs_release(dev_link_t * link) | 153 | static void sl811_cs_release(struct pcmcia_device * link) |
156 | { | 154 | { |
157 | DBG(0, "sl811_cs_release(0x%p)\n", link); | 155 | DBG(0, "sl811_cs_release(0x%p)\n", link); |
158 | 156 | ||
159 | pcmcia_disable_device(link->handle); | 157 | pcmcia_disable_device(link); |
160 | platform_device_unregister(&platform_dev); | 158 | platform_device_unregister(&platform_dev); |
161 | } | 159 | } |
162 | 160 | ||
163 | static void sl811_cs_config(dev_link_t *link) | 161 | static void sl811_cs_config(struct pcmcia_device *link) |
164 | { | 162 | { |
165 | client_handle_t handle = link->handle; | 163 | struct device *parent = &handle_to_dev(link); |
166 | struct device *parent = &handle_to_dev(handle); | ||
167 | local_info_t *dev = link->priv; | 164 | local_info_t *dev = link->priv; |
168 | tuple_t tuple; | 165 | tuple_t tuple; |
169 | cisparse_t parse; | 166 | cisparse_t parse; |
@@ -179,9 +176,9 @@ static void sl811_cs_config(dev_link_t *link) | |||
179 | tuple.TupleData = buf; | 176 | tuple.TupleData = buf; |
180 | tuple.TupleDataMax = sizeof(buf); | 177 | tuple.TupleDataMax = sizeof(buf); |
181 | tuple.TupleOffset = 0; | 178 | tuple.TupleOffset = 0; |
182 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 179 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
183 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 180 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
184 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 181 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
185 | link->conf.ConfigBase = parse.config.base; | 182 | link->conf.ConfigBase = parse.config.base; |
186 | link->conf.Present = parse.config.rmask[0]; | 183 | link->conf.Present = parse.config.rmask[0]; |
187 | 184 | ||
@@ -190,15 +187,15 @@ static void sl811_cs_config(dev_link_t *link) | |||
190 | 187 | ||
191 | /* Look up the current Vcc */ | 188 | /* Look up the current Vcc */ |
192 | CS_CHECK(GetConfigurationInfo, | 189 | CS_CHECK(GetConfigurationInfo, |
193 | pcmcia_get_configuration_info(handle, &conf)); | 190 | pcmcia_get_configuration_info(link, &conf)); |
194 | 191 | ||
195 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 192 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
196 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 193 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
197 | while (1) { | 194 | while (1) { |
198 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 195 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); |
199 | 196 | ||
200 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 | 197 | if (pcmcia_get_tuple_data(link, &tuple) != 0 |
201 | || pcmcia_parse_tuple(handle, &tuple, &parse) | 198 | || pcmcia_parse_tuple(link, &tuple, &parse) |
202 | != 0) | 199 | != 0) |
203 | goto next_entry; | 200 | goto next_entry; |
204 | 201 | ||
@@ -244,14 +241,14 @@ static void sl811_cs_config(dev_link_t *link) | |||
244 | link->io.BasePort1 = io->win[0].base; | 241 | link->io.BasePort1 = io->win[0].base; |
245 | link->io.NumPorts1 = io->win[0].len; | 242 | link->io.NumPorts1 = io->win[0].len; |
246 | 243 | ||
247 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 244 | if (pcmcia_request_io(link, &link->io) != 0) |
248 | goto next_entry; | 245 | goto next_entry; |
249 | } | 246 | } |
250 | break; | 247 | break; |
251 | 248 | ||
252 | next_entry: | 249 | next_entry: |
253 | pcmcia_disable_device(handle); | 250 | pcmcia_disable_device(link); |
254 | last_ret = pcmcia_get_next_tuple(handle, &tuple); | 251 | last_ret = pcmcia_get_next_tuple(link, &tuple); |
255 | } | 252 | } |
256 | 253 | ||
257 | /* require an IRQ and two registers */ | 254 | /* require an IRQ and two registers */ |
@@ -259,12 +256,12 @@ next_entry: | |||
259 | goto cs_failed; | 256 | goto cs_failed; |
260 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 257 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
261 | CS_CHECK(RequestIRQ, | 258 | CS_CHECK(RequestIRQ, |
262 | pcmcia_request_irq(link->handle, &link->irq)); | 259 | pcmcia_request_irq(link, &link->irq)); |
263 | else | 260 | else |
264 | goto cs_failed; | 261 | goto cs_failed; |
265 | 262 | ||
266 | CS_CHECK(RequestConfiguration, | 263 | CS_CHECK(RequestConfiguration, |
267 | pcmcia_request_configuration(link->handle, &link->conf)); | 264 | pcmcia_request_configuration(link, &link->conf)); |
268 | 265 | ||
269 | sprintf(dev->node.dev_name, driver_name); | 266 | sprintf(dev->node.dev_name, driver_name); |
270 | dev->node.major = dev->node.minor = 0; | 267 | dev->node.major = dev->node.minor = 0; |
@@ -285,22 +282,21 @@ next_entry: | |||
285 | < 0) { | 282 | < 0) { |
286 | cs_failed: | 283 | cs_failed: |
287 | printk("sl811_cs_config failed\n"); | 284 | printk("sl811_cs_config failed\n"); |
288 | cs_error(link->handle, last_fn, last_ret); | 285 | cs_error(link, last_fn, last_ret); |
289 | sl811_cs_release(link); | 286 | sl811_cs_release(link); |
290 | link->state &= ~DEV_CONFIG_PENDING; | 287 | link->state &= ~DEV_CONFIG_PENDING; |
291 | } | 288 | } |
292 | } | 289 | } |
293 | 290 | ||
294 | static int sl811_cs_attach(struct pcmcia_device *p_dev) | 291 | static int sl811_cs_attach(struct pcmcia_device *link) |
295 | { | 292 | { |
296 | local_info_t *local; | 293 | local_info_t *local; |
297 | dev_link_t *link = dev_to_instance(p_dev); | ||
298 | 294 | ||
299 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 295 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); |
300 | if (!local) | 296 | if (!local) |
301 | return -ENOMEM; | 297 | return -ENOMEM; |
302 | memset(local, 0, sizeof(local_info_t)); | 298 | memset(local, 0, sizeof(local_info_t)); |
303 | local->p_dev = p_dev; | 299 | local->p_dev = link; |
304 | link->priv = local; | 300 | link->priv = local; |
305 | 301 | ||
306 | /* Initialize */ | 302 | /* Initialize */ |