diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:12:40 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:12:40 -0400 |
| commit | 2be4ff2f084842839b041b793ed6237e8d1d315a (patch) | |
| tree | 1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/bluetooth | |
| parent | cf2fa66055d718ae13e62451bb546505f63906a2 (diff) | |
| parent | a45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits)
pcmcia: ioctl-internal definitions
pcmcia: cistpl header cleanup
pcmcia: remove unused argument to pcmcia_parse_tuple()
pcmcia: card services header cleanup
pcmcia: device_id header cleanup
pcmcia: encapsulate ioaddr_t
pcmcia: cleanup device driver header file
pcmcia: cleanup socket services header file
pcmcia: merge ds_internal.h into cs_internal.h
pcmcia: cleanup cs_internal.h
pcmcia: cs_internal.h is internal
pcmcia: use dev_printk for cs_error()
pcmcia: remove CS_ error codes alltogether
pcmcia: deprecate CS_BAD_TUPLE
pcmcia: deprecate CS_BAD_ARGS
pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE
pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE
pcmcia: deprecate CS_NO_MORE_ITEMS
pcmcia: deprecate CS_IN_USE
pcmcia: deprecate CS_CONFIGURATION_LOCKED
...
Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/bluetooth')
| -rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 8 | ||||
| -rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 125 | ||||
| -rw-r--r-- | drivers/bluetooth/btuart_cs.c | 126 | ||||
| -rw-r--r-- | drivers/bluetooth/dtl1_cs.c | 67 |
4 files changed, 122 insertions, 204 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index bcf57927b7a8..e6ee21d99d92 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
| @@ -901,23 +901,23 @@ static int bluecard_config(struct pcmcia_device *link) | |||
| 901 | for (n = 0; n < 0x400; n += 0x40) { | 901 | for (n = 0; n < 0x400; n += 0x40) { |
| 902 | link->io.BasePort1 = n ^ 0x300; | 902 | link->io.BasePort1 = n ^ 0x300; |
| 903 | i = pcmcia_request_io(link, &link->io); | 903 | i = pcmcia_request_io(link, &link->io); |
| 904 | if (i == CS_SUCCESS) | 904 | if (i == 0) |
| 905 | break; | 905 | break; |
| 906 | } | 906 | } |
| 907 | 907 | ||
| 908 | if (i != CS_SUCCESS) { | 908 | if (i != 0) { |
| 909 | cs_error(link, RequestIO, i); | 909 | cs_error(link, RequestIO, i); |
| 910 | goto failed; | 910 | goto failed; |
| 911 | } | 911 | } |
| 912 | 912 | ||
| 913 | i = pcmcia_request_irq(link, &link->irq); | 913 | i = pcmcia_request_irq(link, &link->irq); |
| 914 | if (i != CS_SUCCESS) { | 914 | if (i != 0) { |
| 915 | cs_error(link, RequestIRQ, i); | 915 | cs_error(link, RequestIRQ, i); |
| 916 | link->irq.AssignedIRQ = 0; | 916 | link->irq.AssignedIRQ = 0; |
| 917 | } | 917 | } |
| 918 | 918 | ||
| 919 | i = pcmcia_request_configuration(link, &link->conf); | 919 | i = pcmcia_request_configuration(link, &link->conf); |
| 920 | if (i != CS_SUCCESS) { | 920 | if (i != 0) { |
| 921 | cs_error(link, RequestConfiguration, i); | 921 | cs_error(link, RequestConfiguration, i); |
| 922 | goto failed; | 922 | goto failed; |
| 923 | } | 923 | } |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 27058477cc8b..2cbe70b66470 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
| @@ -678,101 +678,78 @@ static void bt3c_detach(struct pcmcia_device *link) | |||
| 678 | kfree(info); | 678 | kfree(info); |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 681 | static int bt3c_check_config(struct pcmcia_device *p_dev, |
| 682 | cistpl_cftable_entry_t *cf, | ||
| 683 | cistpl_cftable_entry_t *dflt, | ||
| 684 | unsigned int vcc, | ||
| 685 | void *priv_data) | ||
| 682 | { | 686 | { |
| 683 | int i; | 687 | unsigned long try = (unsigned long) priv_data; |
| 684 | 688 | ||
| 685 | i = pcmcia_get_tuple_data(handle, tuple); | 689 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
| 686 | if (i != CS_SUCCESS) | 690 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
| 687 | return i; | 691 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && |
| 688 | 692 | (cf->io.win[0].base != 0)) { | |
| 689 | return pcmcia_parse_tuple(handle, tuple, parse); | 693 | p_dev->io.BasePort1 = cf->io.win[0].base; |
| 690 | } | 694 | p_dev->io.IOAddrLines = (try == 0) ? 16 : |
| 691 | 695 | cf->io.flags & CISTPL_IO_LINES_MASK; | |
| 692 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 696 | if (!pcmcia_request_io(p_dev, &p_dev->io)) |
| 693 | { | 697 | return 0; |
| 694 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) | 698 | } |
| 695 | return CS_NO_MORE_ITEMS; | 699 | return -ENODEV; |
| 696 | return get_tuple(handle, tuple, parse); | ||
| 697 | } | 700 | } |
| 698 | 701 | ||
| 699 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 702 | static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, |
| 703 | cistpl_cftable_entry_t *cf, | ||
| 704 | cistpl_cftable_entry_t *dflt, | ||
| 705 | unsigned int vcc, | ||
| 706 | void *priv_data) | ||
| 700 | { | 707 | { |
| 701 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) | 708 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
| 702 | return CS_NO_MORE_ITEMS; | 709 | int j; |
| 703 | return get_tuple(handle, tuple, parse); | 710 | |
| 711 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | ||
| 712 | for (j = 0; j < 5; j++) { | ||
| 713 | p_dev->io.BasePort1 = base[j]; | ||
| 714 | p_dev->io.IOAddrLines = base[j] ? 16 : 3; | ||
| 715 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
| 716 | return 0; | ||
| 717 | } | ||
| 718 | } | ||
| 719 | return -ENODEV; | ||
| 704 | } | 720 | } |
| 705 | 721 | ||
| 706 | static int bt3c_config(struct pcmcia_device *link) | 722 | static int bt3c_config(struct pcmcia_device *link) |
| 707 | { | 723 | { |
| 708 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | ||
| 709 | bt3c_info_t *info = link->priv; | 724 | bt3c_info_t *info = link->priv; |
| 710 | tuple_t tuple; | 725 | int i; |
| 711 | u_short buf[256]; | 726 | unsigned long try; |
| 712 | cisparse_t parse; | 727 | |
| 713 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 728 | /* First pass: look for a config entry that looks normal. |
| 714 | int i, j, try; | 729 | Two tries: without IO aliases, then with aliases */ |
| 715 | 730 | for (try = 0; try < 2; try++) | |
| 716 | /* First pass: look for a config entry that looks normal. */ | 731 | if (!pcmcia_loop_config(link, bt3c_check_config, (void *) try)) |
| 717 | tuple.TupleData = (cisdata_t *)buf; | 732 | goto found_port; |
| 718 | tuple.TupleOffset = 0; | ||
| 719 | tuple.TupleDataMax = 255; | ||
| 720 | tuple.Attributes = 0; | ||
| 721 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 722 | /* Two tries: without IO aliases, then with aliases */ | ||
| 723 | for (try = 0; try < 2; try++) { | ||
| 724 | i = first_tuple(link, &tuple, &parse); | ||
| 725 | while (i != CS_NO_MORE_ITEMS) { | ||
| 726 | if (i != CS_SUCCESS) | ||
| 727 | goto next_entry; | ||
| 728 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
| 729 | link->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
| 730 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { | ||
| 731 | link->conf.ConfigIndex = cf->index; | ||
| 732 | link->io.BasePort1 = cf->io.win[0].base; | ||
| 733 | link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
| 734 | i = pcmcia_request_io(link, &link->io); | ||
| 735 | if (i == CS_SUCCESS) | ||
| 736 | goto found_port; | ||
| 737 | } | ||
| 738 | next_entry: | ||
| 739 | i = next_tuple(link, &tuple, &parse); | ||
| 740 | } | ||
| 741 | } | ||
| 742 | 733 | ||
| 743 | /* Second pass: try to find an entry that isn't picky about | 734 | /* Second pass: try to find an entry that isn't picky about |
| 744 | its base address, then try to grab any standard serial port | 735 | its base address, then try to grab any standard serial port |
| 745 | address, and finally try to get any free port. */ | 736 | address, and finally try to get any free port. */ |
| 746 | i = first_tuple(link, &tuple, &parse); | 737 | if (!pcmcia_loop_config(link, bt3c_check_config_notpicky, NULL)) |
| 747 | while (i != CS_NO_MORE_ITEMS) { | 738 | goto found_port; |
| 748 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | ||
| 749 | link->conf.ConfigIndex = cf->index; | ||
| 750 | for (j = 0; j < 5; j++) { | ||
| 751 | link->io.BasePort1 = base[j]; | ||
| 752 | link->io.IOAddrLines = base[j] ? 16 : 3; | ||
| 753 | i = pcmcia_request_io(link, &link->io); | ||
| 754 | if (i == CS_SUCCESS) | ||
| 755 | goto found_port; | ||
| 756 | } | ||
| 757 | } | ||
| 758 | i = next_tuple(link, &tuple, &parse); | ||
| 759 | } | ||
| 760 | 739 | ||
| 761 | found_port: | 740 | BT_ERR("No usable port range found"); |
| 762 | if (i != CS_SUCCESS) { | 741 | cs_error(link, RequestIO, -ENODEV); |
| 763 | BT_ERR("No usable port range found"); | 742 | goto failed; |
| 764 | cs_error(link, RequestIO, i); | ||
| 765 | goto failed; | ||
| 766 | } | ||
| 767 | 743 | ||
| 744 | found_port: | ||
| 768 | i = pcmcia_request_irq(link, &link->irq); | 745 | i = pcmcia_request_irq(link, &link->irq); |
| 769 | if (i != CS_SUCCESS) { | 746 | if (i != 0) { |
| 770 | cs_error(link, RequestIRQ, i); | 747 | cs_error(link, RequestIRQ, i); |
| 771 | link->irq.AssignedIRQ = 0; | 748 | link->irq.AssignedIRQ = 0; |
| 772 | } | 749 | } |
| 773 | 750 | ||
| 774 | i = pcmcia_request_configuration(link, &link->conf); | 751 | i = pcmcia_request_configuration(link, &link->conf); |
| 775 | if (i != CS_SUCCESS) { | 752 | if (i != 0) { |
| 776 | cs_error(link, RequestConfiguration, i); | 753 | cs_error(link, RequestConfiguration, i); |
| 777 | goto failed; | 754 | goto failed; |
| 778 | } | 755 | } |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 68d1d258e6a4..8e556b7ff9f6 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
| @@ -607,102 +607,78 @@ static void btuart_detach(struct pcmcia_device *link) | |||
| 607 | kfree(info); | 607 | kfree(info); |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 610 | static int btuart_check_config(struct pcmcia_device *p_dev, |
| 611 | cistpl_cftable_entry_t *cf, | ||
| 612 | cistpl_cftable_entry_t *dflt, | ||
| 613 | unsigned int vcc, | ||
| 614 | void *priv_data) | ||
| 611 | { | 615 | { |
| 612 | int i; | 616 | int *try = priv_data; |
| 613 | 617 | ||
| 614 | i = pcmcia_get_tuple_data(handle, tuple); | 618 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
| 615 | if (i != CS_SUCCESS) | 619 | p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
| 616 | return i; | 620 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && |
| 617 | 621 | (cf->io.win[0].base != 0)) { | |
| 618 | return pcmcia_parse_tuple(handle, tuple, parse); | 622 | p_dev->io.BasePort1 = cf->io.win[0].base; |
| 619 | } | 623 | p_dev->io.IOAddrLines = (*try == 0) ? 16 : |
| 620 | 624 | cf->io.flags & CISTPL_IO_LINES_MASK; | |
| 621 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 625 | if (!pcmcia_request_io(p_dev, &p_dev->io)) |
| 622 | { | 626 | return 0; |
| 623 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) | 627 | } |
| 624 | return CS_NO_MORE_ITEMS; | 628 | return -ENODEV; |
| 625 | return get_tuple(handle, tuple, parse); | ||
| 626 | } | 629 | } |
| 627 | 630 | ||
| 628 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 631 | static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, |
| 632 | cistpl_cftable_entry_t *cf, | ||
| 633 | cistpl_cftable_entry_t *dflt, | ||
| 634 | unsigned int vcc, | ||
| 635 | void *priv_data) | ||
| 629 | { | 636 | { |
| 630 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) | 637 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
| 631 | return CS_NO_MORE_ITEMS; | 638 | int j; |
| 632 | return get_tuple(handle, tuple, parse); | 639 | |
| 640 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | ||
| 641 | for (j = 0; j < 5; j++) { | ||
| 642 | p_dev->io.BasePort1 = base[j]; | ||
| 643 | p_dev->io.IOAddrLines = base[j] ? 16 : 3; | ||
| 644 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
| 645 | return 0; | ||
| 646 | } | ||
| 647 | } | ||
| 648 | return -ENODEV; | ||
| 633 | } | 649 | } |
| 634 | 650 | ||
| 635 | static int btuart_config(struct pcmcia_device *link) | 651 | static int btuart_config(struct pcmcia_device *link) |
| 636 | { | 652 | { |
| 637 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | ||
| 638 | btuart_info_t *info = link->priv; | 653 | btuart_info_t *info = link->priv; |
| 639 | tuple_t tuple; | 654 | int i; |
| 640 | u_short buf[256]; | 655 | int try; |
| 641 | cisparse_t parse; | 656 | |
| 642 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 657 | /* First pass: look for a config entry that looks normal. |
| 643 | int i, j, try; | 658 | Two tries: without IO aliases, then with aliases */ |
| 644 | 659 | for (try = 0; try < 2; try++) | |
| 645 | /* First pass: look for a config entry that looks normal. */ | 660 | if (!pcmcia_loop_config(link, btuart_check_config, &try)) |
| 646 | tuple.TupleData = (cisdata_t *) buf; | 661 | goto found_port; |
| 647 | tuple.TupleOffset = 0; | ||
| 648 | tuple.TupleDataMax = 255; | ||
| 649 | tuple.Attributes = 0; | ||
| 650 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 651 | /* Two tries: without IO aliases, then with aliases */ | ||
| 652 | for (try = 0; try < 2; try++) { | ||
| 653 | i = first_tuple(link, &tuple, &parse); | ||
| 654 | while (i != CS_NO_MORE_ITEMS) { | ||
| 655 | if (i != CS_SUCCESS) | ||
| 656 | goto next_entry; | ||
| 657 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
| 658 | link->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
| 659 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { | ||
| 660 | link->conf.ConfigIndex = cf->index; | ||
| 661 | link->io.BasePort1 = cf->io.win[0].base; | ||
| 662 | link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
| 663 | i = pcmcia_request_io(link, &link->io); | ||
| 664 | if (i == CS_SUCCESS) | ||
| 665 | goto found_port; | ||
| 666 | } | ||
| 667 | next_entry: | ||
| 668 | i = next_tuple(link, &tuple, &parse); | ||
| 669 | } | ||
| 670 | } | ||
| 671 | 662 | ||
| 672 | /* Second pass: try to find an entry that isn't picky about | 663 | /* Second pass: try to find an entry that isn't picky about |
| 673 | its base address, then try to grab any standard serial port | 664 | its base address, then try to grab any standard serial port |
| 674 | address, and finally try to get any free port. */ | 665 | address, and finally try to get any free port. */ |
| 675 | i = first_tuple(link, &tuple, &parse); | 666 | if (!pcmcia_loop_config(link, btuart_check_config_notpicky, NULL)) |
| 676 | while (i != CS_NO_MORE_ITEMS) { | 667 | goto found_port; |
| 677 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) | ||
| 678 | && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | ||
| 679 | link->conf.ConfigIndex = cf->index; | ||
| 680 | for (j = 0; j < 5; j++) { | ||
| 681 | link->io.BasePort1 = base[j]; | ||
| 682 | link->io.IOAddrLines = base[j] ? 16 : 3; | ||
| 683 | i = pcmcia_request_io(link, &link->io); | ||
| 684 | if (i == CS_SUCCESS) | ||
| 685 | goto found_port; | ||
| 686 | } | ||
| 687 | } | ||
| 688 | i = next_tuple(link, &tuple, &parse); | ||
| 689 | } | ||
| 690 | 668 | ||
| 691 | found_port: | 669 | BT_ERR("No usable port range found"); |
| 692 | if (i != CS_SUCCESS) { | 670 | cs_error(link, RequestIO, -ENODEV); |
| 693 | BT_ERR("No usable port range found"); | 671 | goto failed; |
| 694 | cs_error(link, RequestIO, i); | ||
| 695 | goto failed; | ||
| 696 | } | ||
| 697 | 672 | ||
| 673 | found_port: | ||
| 698 | i = pcmcia_request_irq(link, &link->irq); | 674 | i = pcmcia_request_irq(link, &link->irq); |
| 699 | if (i != CS_SUCCESS) { | 675 | if (i != 0) { |
| 700 | cs_error(link, RequestIRQ, i); | 676 | cs_error(link, RequestIRQ, i); |
| 701 | link->irq.AssignedIRQ = 0; | 677 | link->irq.AssignedIRQ = 0; |
| 702 | } | 678 | } |
| 703 | 679 | ||
| 704 | i = pcmcia_request_configuration(link, &link->conf); | 680 | i = pcmcia_request_configuration(link, &link->conf); |
| 705 | if (i != CS_SUCCESS) { | 681 | if (i != 0) { |
| 706 | cs_error(link, RequestConfiguration, i); | 682 | cs_error(link, RequestConfiguration, i); |
| 707 | goto failed; | 683 | goto failed; |
| 708 | } | 684 | } |
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index dae45cdf02b2..e6e6b037695a 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
| @@ -590,75 +590,40 @@ static void dtl1_detach(struct pcmcia_device *link) | |||
| 590 | kfree(info); | 590 | kfree(info); |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 593 | static int dtl1_confcheck(struct pcmcia_device *p_dev, |
| 594 | cistpl_cftable_entry_t *cf, | ||
| 595 | cistpl_cftable_entry_t *dflt, | ||
| 596 | unsigned int vcc, | ||
| 597 | void *priv_data) | ||
| 594 | { | 598 | { |
| 595 | int i; | 599 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { |
| 596 | 600 | p_dev->io.BasePort1 = cf->io.win[0].base; | |
| 597 | i = pcmcia_get_tuple_data(handle, tuple); | 601 | p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */ |
| 598 | if (i != CS_SUCCESS) | 602 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; |
| 599 | return i; | 603 | if (!pcmcia_request_io(p_dev, &p_dev->io)) |
| 600 | 604 | return 0; | |
| 601 | return pcmcia_parse_tuple(handle, tuple, parse); | 605 | } |
| 602 | } | 606 | return -ENODEV; |
| 603 | |||
| 604 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
| 605 | { | ||
| 606 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) | ||
| 607 | return CS_NO_MORE_ITEMS; | ||
| 608 | return get_tuple(handle, tuple, parse); | ||
| 609 | } | ||
| 610 | |||
| 611 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
| 612 | { | ||
| 613 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) | ||
| 614 | return CS_NO_MORE_ITEMS; | ||
| 615 | return get_tuple(handle, tuple, parse); | ||
| 616 | } | 607 | } |
| 617 | 608 | ||
| 618 | static int dtl1_config(struct pcmcia_device *link) | 609 | static int dtl1_config(struct pcmcia_device *link) |
| 619 | { | 610 | { |
| 620 | dtl1_info_t *info = link->priv; | 611 | dtl1_info_t *info = link->priv; |
| 621 | tuple_t tuple; | ||
| 622 | u_short buf[256]; | ||
| 623 | cisparse_t parse; | ||
| 624 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | ||
| 625 | int i; | 612 | int i; |
| 626 | 613 | ||
| 627 | tuple.TupleData = (cisdata_t *)buf; | ||
| 628 | tuple.TupleOffset = 0; | ||
| 629 | tuple.TupleDataMax = 255; | ||
| 630 | tuple.Attributes = 0; | ||
| 631 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 632 | |||
| 633 | /* Look for a generic full-sized window */ | 614 | /* Look for a generic full-sized window */ |
| 634 | link->io.NumPorts1 = 8; | 615 | link->io.NumPorts1 = 8; |
| 635 | i = first_tuple(link, &tuple, &parse); | 616 | if (!pcmcia_loop_config(link, dtl1_confcheck, NULL)) |
| 636 | while (i != CS_NO_MORE_ITEMS) { | ||
| 637 | if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { | ||
| 638 | link->conf.ConfigIndex = cf->index; | ||
| 639 | link->io.BasePort1 = cf->io.win[0].base; | ||
| 640 | link->io.NumPorts1 = cf->io.win[0].len; /*yo */ | ||
| 641 | link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | ||
| 642 | i = pcmcia_request_io(link, &link->io); | ||
| 643 | if (i == CS_SUCCESS) | ||
| 644 | break; | ||
| 645 | } | ||
| 646 | i = next_tuple(link, &tuple, &parse); | ||
| 647 | } | ||
| 648 | |||
| 649 | if (i != CS_SUCCESS) { | ||
| 650 | cs_error(link, RequestIO, i); | ||
| 651 | goto failed; | 617 | goto failed; |
| 652 | } | ||
| 653 | 618 | ||
| 654 | i = pcmcia_request_irq(link, &link->irq); | 619 | i = pcmcia_request_irq(link, &link->irq); |
| 655 | if (i != CS_SUCCESS) { | 620 | if (i != 0) { |
| 656 | cs_error(link, RequestIRQ, i); | 621 | cs_error(link, RequestIRQ, i); |
| 657 | link->irq.AssignedIRQ = 0; | 622 | link->irq.AssignedIRQ = 0; |
| 658 | } | 623 | } |
| 659 | 624 | ||
| 660 | i = pcmcia_request_configuration(link, &link->conf); | 625 | i = pcmcia_request_configuration(link, &link->conf); |
| 661 | if (i != CS_SUCCESS) { | 626 | if (i != 0) { |
| 662 | cs_error(link, RequestConfiguration, i); | 627 | cs_error(link, RequestConfiguration, i); |
| 663 | goto failed; | 628 | goto failed; |
| 664 | } | 629 | } |
