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/bluetooth/bt3c_cs.c | |
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/bluetooth/bt3c_cs.c')
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 51 |
1 files changed, 24 insertions, 27 deletions
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 | ||