diff options
| author | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-10-28 19:54:49 -0400 |
|---|---|---|
| committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-11-09 02:30:17 -0500 |
| commit | 55a19b39acb8888af8e9cfe5b762d03c52fdb48c (patch) | |
| tree | 6572e3290b74171a9b317ac4324a2990a351d437 | |
| parent | 66024db57d5b9011e274b314affad68f370c0d6f (diff) | |
pcmcia/staging: update comedi drivers
Update comedi PCMCIA drivers to work with recent PCMCIA changes documented
in Documentation/pcmcia/driver-changes.txt:
- use pcmcia_config_loop()
- don't use PCMCIA_DEBUG, but use dev_dbg()
- don't use cs_error()
- re-use prod_id and card_id values already stored
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| -rw-r--r-- | drivers/staging/comedi/drivers/cb_das16_cs.c | 220 | ||||
| -rw-r--r-- | drivers/staging/comedi/drivers/das08_cs.c | 202 | ||||
| -rw-r--r-- | drivers/staging/comedi/drivers/ni_daq_700.c | 236 | ||||
| -rw-r--r-- | drivers/staging/comedi/drivers/ni_daq_dio24.c | 235 | ||||
| -rw-r--r-- | drivers/staging/comedi/drivers/ni_labpc_cs.c | 224 | ||||
| -rw-r--r-- | drivers/staging/comedi/drivers/ni_mio_cs.c | 127 | ||||
| -rw-r--r-- | drivers/staging/comedi/drivers/quatech_daqp_cs.c | 215 |
7 files changed, 424 insertions, 1035 deletions
diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 80c0df8656f3..9e758027efee 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c | |||
| @@ -141,37 +141,14 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, | |||
| 141 | struct comedi_insn *insn, | 141 | struct comedi_insn *insn, |
| 142 | unsigned int *data); | 142 | unsigned int *data); |
| 143 | 143 | ||
| 144 | static int get_prodid(struct comedi_device *dev, struct pcmcia_device *link) | ||
| 145 | { | ||
| 146 | tuple_t tuple; | ||
| 147 | u_short buf[128]; | ||
| 148 | int prodid = 0; | ||
| 149 | |||
| 150 | tuple.TupleData = (cisdata_t *) buf; | ||
| 151 | tuple.TupleOffset = 0; | ||
| 152 | tuple.TupleDataMax = 255; | ||
| 153 | tuple.DesiredTuple = CISTPL_MANFID; | ||
| 154 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
| 155 | if ((pcmcia_get_first_tuple(link, &tuple) == 0) && | ||
| 156 | (pcmcia_get_tuple_data(link, &tuple) == 0)) { | ||
| 157 | prodid = le16_to_cpu(buf[1]); | ||
| 158 | } | ||
| 159 | |||
| 160 | return prodid; | ||
| 161 | } | ||
| 162 | |||
| 163 | static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, | 144 | static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, |
| 164 | struct pcmcia_device *link) | 145 | struct pcmcia_device *link) |
| 165 | { | 146 | { |
| 166 | int id; | ||
| 167 | int i; | 147 | int i; |
| 168 | 148 | ||
| 169 | id = get_prodid(dev, link); | ||
| 170 | |||
| 171 | for (i = 0; i < n_boards; i++) { | 149 | for (i = 0; i < n_boards; i++) { |
| 172 | if (das16cs_boards[i].device_id == id) { | 150 | if (das16cs_boards[i].device_id == link->card_id) |
| 173 | return das16cs_boards + i; | 151 | return das16cs_boards + i; |
| 174 | } | ||
| 175 | } | 152 | } |
| 176 | 153 | ||
| 177 | printk("unknown board!\n"); | 154 | printk("unknown board!\n"); |
| @@ -660,27 +637,8 @@ static int das16cs_timer_insn_config(struct comedi_device *dev, | |||
| 660 | 637 | ||
| 661 | ======================================================================*/ | 638 | ======================================================================*/ |
| 662 | 639 | ||
| 663 | /* | ||
| 664 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 665 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 666 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 667 | be present but disabled -- but it can then be enabled for specific | ||
| 668 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 669 | */ | ||
| 670 | #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) | 640 | #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) |
| 671 | 641 | ||
| 672 | #ifdef PCMCIA_DEBUG | ||
| 673 | static int pc_debug = PCMCIA_DEBUG; | ||
| 674 | module_param(pc_debug, int, 0644); | ||
| 675 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 676 | static char *version = | ||
| 677 | "cb_das16_cs.c pcmcia code (David Schleef), modified from dummy_cs.c 1.31 2001/08/24 12:13:13 (David Hinds)"; | ||
| 678 | #else | ||
| 679 | #define DEBUG(n, args...) | ||
| 680 | #endif | ||
| 681 | |||
| 682 | /*====================================================================*/ | ||
| 683 | |||
| 684 | static void das16cs_pcmcia_config(struct pcmcia_device *link); | 642 | static void das16cs_pcmcia_config(struct pcmcia_device *link); |
| 685 | static void das16cs_pcmcia_release(struct pcmcia_device *link); | 643 | static void das16cs_pcmcia_release(struct pcmcia_device *link); |
| 686 | static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); | 644 | static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); |
| @@ -733,7 +691,7 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) | |||
| 733 | { | 691 | { |
| 734 | struct local_info_t *local; | 692 | struct local_info_t *local; |
| 735 | 693 | ||
| 736 | DEBUG(0, "das16cs_pcmcia_attach()\n"); | 694 | dev_dbg(&link->dev, "das16cs_pcmcia_attach()\n"); |
| 737 | 695 | ||
| 738 | /* Allocate space for private device-specific data */ | 696 | /* Allocate space for private device-specific data */ |
| 739 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 697 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -760,7 +718,7 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) | |||
| 760 | 718 | ||
| 761 | static void das16cs_pcmcia_detach(struct pcmcia_device *link) | 719 | static void das16cs_pcmcia_detach(struct pcmcia_device *link) |
| 762 | { | 720 | { |
| 763 | DEBUG(0, "das16cs_pcmcia_detach(0x%p)\n", link); | 721 | dev_dbg(&link->dev, "das16cs_pcmcia_detach\n"); |
| 764 | 722 | ||
| 765 | if (link->dev_node) { | 723 | if (link->dev_node) { |
| 766 | ((struct local_info_t *)link->priv)->stop = 1; | 724 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -771,118 +729,55 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) | |||
| 771 | kfree(link->priv); | 729 | kfree(link->priv); |
| 772 | } /* das16cs_pcmcia_detach */ | 730 | } /* das16cs_pcmcia_detach */ |
| 773 | 731 | ||
| 774 | static void das16cs_pcmcia_config(struct pcmcia_device *link) | ||
| 775 | { | ||
| 776 | struct local_info_t *dev = link->priv; | ||
| 777 | tuple_t tuple; | ||
| 778 | cisparse_t parse; | ||
| 779 | int last_fn, last_ret; | ||
| 780 | u_char buf[64]; | ||
| 781 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 782 | 732 | ||
| 783 | DEBUG(0, "das16cs_pcmcia_config(0x%p)\n", link); | 733 | static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 784 | 734 | cistpl_cftable_entry_t *cfg, | |
| 785 | /* | 735 | cistpl_cftable_entry_t *dflt, |
| 786 | This reads the card's CONFIG tuple to find its configuration | 736 | unsigned int vcc, |
| 787 | registers. | 737 | void *priv_data) |
| 788 | */ | 738 | { |
| 789 | tuple.DesiredTuple = CISTPL_CONFIG; | 739 | if (cfg->index == 0) |
| 790 | tuple.Attributes = 0; | 740 | return -EINVAL; |
| 791 | tuple.TupleData = buf; | ||
| 792 | tuple.TupleDataMax = sizeof(buf); | ||
| 793 | tuple.TupleOffset = 0; | ||
| 794 | |||
| 795 | last_fn = GetFirstTuple; | ||
| 796 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 797 | if (last_ret != 0) | ||
| 798 | goto cs_failed; | ||
| 799 | |||
| 800 | last_fn = GetTupleData; | ||
| 801 | last_ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 802 | if (last_ret != 0) | ||
| 803 | goto cs_failed; | ||
| 804 | |||
| 805 | last_fn = ParseTuple; | ||
| 806 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 807 | if (last_ret != 0) | ||
| 808 | goto cs_failed; | ||
| 809 | |||
| 810 | link->conf.ConfigBase = parse.config.base; | ||
| 811 | link->conf.Present = parse.config.rmask[0]; | ||
| 812 | 741 | ||
| 813 | /* | 742 | /* Do we need to allocate an interrupt? */ |
| 814 | In this loop, we scan the CIS for configuration table entries, | 743 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 815 | each of which describes a valid card configuration, including | 744 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 816 | voltage, IO window, memory window, and interrupt settings. | 745 | |
| 817 | 746 | /* IO window settings */ | |
| 818 | We make no assumptions about the card to be configured: we use | 747 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; |
| 819 | just the information available in the CIS. In an ideal world, | 748 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
| 820 | this would work for any PCMCIA card, but it requires a complete | 749 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
| 821 | and accurate CIS. In practice, a driver usually "knows" most of | 750 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 822 | these things without consulting the CIS, and most client drivers | 751 | if (!(io->flags & CISTPL_IO_8BIT)) |
| 823 | will only use the CIS to fill in implementation-defined details. | 752 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 824 | */ | 753 | if (!(io->flags & CISTPL_IO_16BIT)) |
| 825 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 754 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 826 | last_fn = GetFirstTuple; | 755 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; |
| 827 | 756 | p_dev->io.BasePort1 = io->win[0].base; | |
| 828 | last_ret = pcmcia_get_first_tuple(link, &tuple); | 757 | p_dev->io.NumPorts1 = io->win[0].len; |
| 829 | if (last_ret) | 758 | if (io->nwin > 1) { |
| 830 | goto cs_failed; | 759 | p_dev->io.Attributes2 = p_dev->io.Attributes1; |
| 831 | 760 | p_dev->io.BasePort2 = io->win[1].base; | |
| 832 | while (1) { | 761 | p_dev->io.NumPorts2 = io->win[1].len; |
| 833 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 834 | if (pcmcia_get_tuple_data(link, &tuple)) | ||
| 835 | goto next_entry; | ||
| 836 | if (pcmcia_parse_tuple(&tuple, &parse)) | ||
| 837 | goto next_entry; | ||
| 838 | |||
| 839 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 840 | dflt = *cfg; | ||
| 841 | if (cfg->index == 0) | ||
| 842 | goto next_entry; | ||
| 843 | link->conf.ConfigIndex = cfg->index; | ||
| 844 | |||
| 845 | /* Does this card need audio output? */ | ||
| 846 | /* if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 847 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 848 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 849 | } | ||
| 850 | */ | ||
| 851 | /* Do we need to allocate an interrupt? */ | ||
| 852 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | ||
| 853 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 854 | |||
| 855 | /* IO window settings */ | ||
| 856 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 857 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 858 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 859 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 860 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 861 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 862 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 863 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 864 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 865 | link->io.BasePort1 = io->win[0].base; | ||
| 866 | link->io.NumPorts1 = io->win[0].len; | ||
| 867 | if (io->nwin > 1) { | ||
| 868 | link->io.Attributes2 = link->io.Attributes1; | ||
| 869 | link->io.BasePort2 = io->win[1].base; | ||
| 870 | link->io.NumPorts2 = io->win[1].len; | ||
| 871 | } | ||
| 872 | /* This reserves IO space but doesn't actually enable it */ | ||
| 873 | if (pcmcia_request_io(link, &link->io)) | ||
| 874 | goto next_entry; | ||
| 875 | } | 762 | } |
| 763 | /* This reserves IO space but doesn't actually enable it */ | ||
| 764 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
| 765 | } | ||
| 876 | 766 | ||
| 877 | /* If we got this far, we're cool! */ | 767 | return 0; |
| 878 | break; | 768 | } |
| 769 | |||
| 770 | static void das16cs_pcmcia_config(struct pcmcia_device *link) | ||
| 771 | { | ||
| 772 | struct local_info_t *dev = link->priv; | ||
| 773 | int ret; | ||
| 879 | 774 | ||
| 880 | next_entry: | 775 | dev_dbg(&link->dev, "das16cs_pcmcia_config\n"); |
| 881 | last_fn = GetNextTuple; | ||
| 882 | 776 | ||
| 883 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 777 | ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); |
| 884 | if (last_ret) | 778 | if (ret) { |
| 885 | goto cs_failed; | 779 | dev_warn(&link->dev, "no configuration found\n"); |
| 780 | goto failed; | ||
| 886 | } | 781 | } |
| 887 | 782 | ||
| 888 | /* | 783 | /* |
| @@ -891,21 +786,18 @@ next_entry: | |||
| 891 | irq structure is initialized. | 786 | irq structure is initialized. |
| 892 | */ | 787 | */ |
| 893 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 788 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 894 | last_fn = RequestIRQ; | 789 | ret = pcmcia_request_irq(link, &link->irq); |
| 895 | 790 | if (ret) | |
| 896 | last_ret = pcmcia_request_irq(link, &link->irq); | 791 | goto failed; |
| 897 | if (last_ret) | ||
| 898 | goto cs_failed; | ||
| 899 | } | 792 | } |
| 900 | /* | 793 | /* |
| 901 | This actually configures the PCMCIA socket -- setting up | 794 | This actually configures the PCMCIA socket -- setting up |
| 902 | the I/O windows and the interrupt mapping, and putting the | 795 | the I/O windows and the interrupt mapping, and putting the |
| 903 | card and host interface into "Memory and IO" mode. | 796 | card and host interface into "Memory and IO" mode. |
| 904 | */ | 797 | */ |
| 905 | last_fn = RequestConfiguration; | 798 | ret = pcmcia_request_configuration(link, &link->conf); |
| 906 | last_ret = pcmcia_request_configuration(link, &link->conf); | 799 | if (ret) |
| 907 | if (last_ret) | 800 | goto failed; |
| 908 | goto cs_failed; | ||
| 909 | 801 | ||
| 910 | /* | 802 | /* |
| 911 | At this point, the dev_node_t structure(s) need to be | 803 | At this point, the dev_node_t structure(s) need to be |
| @@ -930,14 +822,13 @@ next_entry: | |||
| 930 | 822 | ||
| 931 | return; | 823 | return; |
| 932 | 824 | ||
| 933 | cs_failed: | 825 | failed: |
| 934 | cs_error(link, last_fn, last_ret); | ||
| 935 | das16cs_pcmcia_release(link); | 826 | das16cs_pcmcia_release(link); |
| 936 | } /* das16cs_pcmcia_config */ | 827 | } /* das16cs_pcmcia_config */ |
| 937 | 828 | ||
| 938 | static void das16cs_pcmcia_release(struct pcmcia_device *link) | 829 | static void das16cs_pcmcia_release(struct pcmcia_device *link) |
| 939 | { | 830 | { |
| 940 | DEBUG(0, "das16cs_pcmcia_release(0x%p)\n", link); | 831 | dev_dbg(&link->dev, "das16cs_pcmcia_release\n"); |
| 941 | pcmcia_disable_device(link); | 832 | pcmcia_disable_device(link); |
| 942 | } /* das16cs_pcmcia_release */ | 833 | } /* das16cs_pcmcia_release */ |
| 943 | 834 | ||
| @@ -983,14 +874,13 @@ struct pcmcia_driver das16cs_driver = { | |||
| 983 | 874 | ||
| 984 | static int __init init_das16cs_pcmcia_cs(void) | 875 | static int __init init_das16cs_pcmcia_cs(void) |
| 985 | { | 876 | { |
| 986 | DEBUG(0, "%s\n", version); | ||
| 987 | pcmcia_register_driver(&das16cs_driver); | 877 | pcmcia_register_driver(&das16cs_driver); |
| 988 | return 0; | 878 | return 0; |
| 989 | } | 879 | } |
| 990 | 880 | ||
| 991 | static void __exit exit_das16cs_pcmcia_cs(void) | 881 | static void __exit exit_das16cs_pcmcia_cs(void) |
| 992 | { | 882 | { |
| 993 | DEBUG(0, "das16cs_pcmcia_cs: unloading\n"); | 883 | pr_debug("das16cs_pcmcia_cs: unloading\n"); |
| 994 | pcmcia_unregister_driver(&das16cs_driver); | 884 | pcmcia_unregister_driver(&das16cs_driver); |
| 995 | } | 885 | } |
| 996 | 886 | ||
diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 9cab21eaaa18..384a77a37c26 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c | |||
| @@ -110,25 +110,6 @@ static int das08_cs_attach(struct comedi_device *dev, | |||
| 110 | 110 | ||
| 111 | ======================================================================*/ | 111 | ======================================================================*/ |
| 112 | 112 | ||
| 113 | /* | ||
| 114 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 115 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 116 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 117 | be present but disabled -- but it can then be enabled for specific | ||
| 118 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 119 | */ | ||
| 120 | |||
| 121 | #ifdef PCMCIA_DEBUG | ||
| 122 | static int pc_debug = PCMCIA_DEBUG; | ||
| 123 | module_param(pc_debug, int, 0644); | ||
| 124 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 125 | static const char *version = | ||
| 126 | "das08.c pcmcia code (Frank Hess), modified from dummy_cs.c 1.31 2001/08/24 12:13:13 (David Hinds)"; | ||
| 127 | #else | ||
| 128 | #define DEBUG(n, args...) | ||
| 129 | #endif | ||
| 130 | |||
| 131 | /*====================================================================*/ | ||
| 132 | static void das08_pcmcia_config(struct pcmcia_device *link); | 113 | static void das08_pcmcia_config(struct pcmcia_device *link); |
| 133 | static void das08_pcmcia_release(struct pcmcia_device *link); | 114 | static void das08_pcmcia_release(struct pcmcia_device *link); |
| 134 | static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); | 115 | static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); |
| @@ -181,7 +162,7 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) | |||
| 181 | { | 162 | { |
| 182 | struct local_info_t *local; | 163 | struct local_info_t *local; |
| 183 | 164 | ||
| 184 | DEBUG(0, "das08_pcmcia_attach()\n"); | 165 | dev_dbg(&link->dev, "das08_pcmcia_attach()\n"); |
| 185 | 166 | ||
| 186 | /* Allocate space for private device-specific data */ | 167 | /* Allocate space for private device-specific data */ |
| 187 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 168 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -224,7 +205,7 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) | |||
| 224 | static void das08_pcmcia_detach(struct pcmcia_device *link) | 205 | static void das08_pcmcia_detach(struct pcmcia_device *link) |
| 225 | { | 206 | { |
| 226 | 207 | ||
| 227 | DEBUG(0, "das08_pcmcia_detach(0x%p)\n", link); | 208 | dev_dbg(&link->dev, "das08_pcmcia_detach\n"); |
| 228 | 209 | ||
| 229 | if (link->dev_node) { | 210 | if (link->dev_node) { |
| 230 | ((struct local_info_t *)link->priv)->stop = 1; | 211 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -237,6 +218,44 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) | |||
| 237 | 218 | ||
| 238 | } /* das08_pcmcia_detach */ | 219 | } /* das08_pcmcia_detach */ |
| 239 | 220 | ||
| 221 | |||
| 222 | static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, | ||
| 223 | cistpl_cftable_entry_t *cfg, | ||
| 224 | cistpl_cftable_entry_t *dflt, | ||
| 225 | unsigned int vcc, | ||
| 226 | void *priv_data) | ||
| 227 | { | ||
| 228 | if (cfg->index == 0) | ||
| 229 | return -ENODEV; | ||
| 230 | |||
| 231 | /* Do we need to allocate an interrupt? */ | ||
| 232 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) | ||
| 233 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 234 | |||
| 235 | /* IO window settings */ | ||
| 236 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 237 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 238 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 239 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 240 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 241 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 242 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 243 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 244 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 245 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 246 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 247 | if (io->nwin > 1) { | ||
| 248 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 249 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 250 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 251 | } | ||
| 252 | /* This reserves IO space but doesn't actually enable it */ | ||
| 253 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
| 254 | } | ||
| 255 | return 0; | ||
| 256 | } | ||
| 257 | |||
| 258 | |||
| 240 | /*====================================================================== | 259 | /*====================================================================== |
| 241 | 260 | ||
| 242 | das08_pcmcia_config() is scheduled to run after a CARD_INSERTION event | 261 | das08_pcmcia_config() is scheduled to run after a CARD_INSERTION event |
| @@ -248,128 +267,20 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) | |||
| 248 | static void das08_pcmcia_config(struct pcmcia_device *link) | 267 | static void das08_pcmcia_config(struct pcmcia_device *link) |
| 249 | { | 268 | { |
| 250 | struct local_info_t *dev = link->priv; | 269 | struct local_info_t *dev = link->priv; |
| 251 | tuple_t tuple; | 270 | int ret; |
| 252 | cisparse_t parse; | ||
| 253 | int last_fn, last_ret; | ||
| 254 | u_char buf[64]; | ||
| 255 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 256 | |||
| 257 | DEBUG(0, "das08_pcmcia_config(0x%p)\n", link); | ||
| 258 | |||
| 259 | /* | ||
| 260 | This reads the card's CONFIG tuple to find its configuration | ||
| 261 | registers. | ||
| 262 | */ | ||
| 263 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 264 | tuple.Attributes = 0; | ||
| 265 | tuple.TupleData = buf; | ||
| 266 | tuple.TupleDataMax = sizeof(buf); | ||
| 267 | tuple.TupleOffset = 0; | ||
| 268 | last_fn = GetFirstTuple; | ||
| 269 | |||
| 270 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 271 | if (last_ret) | ||
| 272 | goto cs_failed; | ||
| 273 | |||
| 274 | last_fn = GetTupleData; | ||
| 275 | |||
| 276 | last_ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 277 | if (last_ret) | ||
| 278 | goto cs_failed; | ||
| 279 | |||
| 280 | last_fn = ParseTuple; | ||
| 281 | |||
| 282 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 283 | if (last_ret) | ||
| 284 | goto cs_failed; | ||
| 285 | |||
| 286 | link->conf.ConfigBase = parse.config.base; | ||
| 287 | link->conf.Present = parse.config.rmask[0]; | ||
| 288 | |||
| 289 | /* | ||
| 290 | In this loop, we scan the CIS for configuration table entries, | ||
| 291 | each of which describes a valid card configuration, including | ||
| 292 | voltage, IO window, memory window, and interrupt settings. | ||
| 293 | |||
| 294 | We make no assumptions about the card to be configured: we use | ||
| 295 | just the information available in the CIS. In an ideal world, | ||
| 296 | this would work for any PCMCIA card, but it requires a complete | ||
| 297 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 298 | these things without consulting the CIS, and most client drivers | ||
| 299 | will only use the CIS to fill in implementation-defined details. | ||
| 300 | */ | ||
| 301 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 302 | last_fn = GetFirstTuple; | ||
| 303 | |||
| 304 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 305 | if (last_ret) | ||
| 306 | goto cs_failed; | ||
| 307 | |||
| 308 | while (1) { | ||
| 309 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 310 | |||
| 311 | last_ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 312 | if (last_ret) | ||
| 313 | goto next_entry; | ||
| 314 | |||
| 315 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 316 | if (last_ret) | ||
| 317 | goto next_entry; | ||
| 318 | |||
| 319 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 320 | dflt = *cfg; | ||
| 321 | if (cfg->index == 0) | ||
| 322 | goto next_entry; | ||
| 323 | link->conf.ConfigIndex = cfg->index; | ||
| 324 | |||
| 325 | /* Does this card need audio output? */ | ||
| 326 | /* if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 327 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 328 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 329 | } | ||
| 330 | */ | ||
| 331 | /* Do we need to allocate an interrupt? */ | ||
| 332 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | ||
| 333 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 334 | |||
| 335 | /* IO window settings */ | ||
| 336 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 337 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 338 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 339 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 340 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 341 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 342 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 343 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 344 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 345 | link->io.BasePort1 = io->win[0].base; | ||
| 346 | link->io.NumPorts1 = io->win[0].len; | ||
| 347 | if (io->nwin > 1) { | ||
| 348 | link->io.Attributes2 = link->io.Attributes1; | ||
| 349 | link->io.BasePort2 = io->win[1].base; | ||
| 350 | link->io.NumPorts2 = io->win[1].len; | ||
| 351 | } | ||
| 352 | /* This reserves IO space but doesn't actually enable it */ | ||
| 353 | if (pcmcia_request_io(link, &link->io) != 0) | ||
| 354 | goto next_entry; | ||
| 355 | } | ||
| 356 | |||
| 357 | /* If we got this far, we're cool! */ | ||
| 358 | break; | ||
| 359 | 271 | ||
| 360 | next_entry: | 272 | dev_dbg(&link->dev, "das08_pcmcia_config\n"); |
| 361 | last_fn = GetNextTuple; | ||
| 362 | 273 | ||
| 363 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 274 | ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); |
| 364 | if (last_ret) | 275 | if (ret) { |
| 365 | goto cs_failed; | 276 | dev_warn(&link->dev, "no configuration found\n"); |
| 277 | goto failed; | ||
| 366 | } | 278 | } |
| 367 | 279 | ||
| 368 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 280 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 369 | last_fn = RequestIRQ; | 281 | ret = pcmcia_request_irq(link, &link->irq); |
| 370 | last_ret = pcmcia_request_irq(link, &link->irq); | 282 | if (ret) |
| 371 | if (last_ret) | 283 | goto failed; |
| 372 | goto cs_failed; | ||
| 373 | } | 284 | } |
| 374 | 285 | ||
| 375 | /* | 286 | /* |
| @@ -377,10 +288,9 @@ next_entry: | |||
| 377 | the I/O windows and the interrupt mapping, and putting the | 288 | the I/O windows and the interrupt mapping, and putting the |
| 378 | card and host interface into "Memory and IO" mode. | 289 | card and host interface into "Memory and IO" mode. |
| 379 | */ | 290 | */ |
| 380 | last_fn = RequestConfiguration; | 291 | ret = pcmcia_request_configuration(link, &link->conf); |
| 381 | last_ret = pcmcia_request_configuration(link, &link->conf); | 292 | if (ret) |
| 382 | if (last_ret) | 293 | goto failed; |
| 383 | goto cs_failed; | ||
| 384 | 294 | ||
| 385 | /* | 295 | /* |
| 386 | At this point, the dev_node_t structure(s) need to be | 296 | At this point, the dev_node_t structure(s) need to be |
| @@ -405,8 +315,7 @@ next_entry: | |||
| 405 | 315 | ||
| 406 | return; | 316 | return; |
| 407 | 317 | ||
| 408 | cs_failed: | 318 | failed: |
| 409 | cs_error(link, last_fn, last_ret); | ||
| 410 | das08_pcmcia_release(link); | 319 | das08_pcmcia_release(link); |
| 411 | 320 | ||
| 412 | } /* das08_pcmcia_config */ | 321 | } /* das08_pcmcia_config */ |
| @@ -421,7 +330,7 @@ cs_failed: | |||
| 421 | 330 | ||
| 422 | static void das08_pcmcia_release(struct pcmcia_device *link) | 331 | static void das08_pcmcia_release(struct pcmcia_device *link) |
| 423 | { | 332 | { |
| 424 | DEBUG(0, "das08_pcmcia_release(0x%p)\n", link); | 333 | dev_dbg(&link->dev, "das08_pcmcia_release\n"); |
| 425 | pcmcia_disable_device(link); | 334 | pcmcia_disable_device(link); |
| 426 | } /* das08_pcmcia_release */ | 335 | } /* das08_pcmcia_release */ |
| 427 | 336 | ||
| @@ -477,14 +386,13 @@ struct pcmcia_driver das08_cs_driver = { | |||
| 477 | 386 | ||
| 478 | static int __init init_das08_pcmcia_cs(void) | 387 | static int __init init_das08_pcmcia_cs(void) |
| 479 | { | 388 | { |
| 480 | DEBUG(0, "%s\n", version); | ||
| 481 | pcmcia_register_driver(&das08_cs_driver); | 389 | pcmcia_register_driver(&das08_cs_driver); |
| 482 | return 0; | 390 | return 0; |
| 483 | } | 391 | } |
| 484 | 392 | ||
| 485 | static void __exit exit_das08_pcmcia_cs(void) | 393 | static void __exit exit_das08_pcmcia_cs(void) |
| 486 | { | 394 | { |
| 487 | DEBUG(0, "das08_pcmcia_cs: unloading\n"); | 395 | pr_debug("das08_pcmcia_cs: unloading\n"); |
| 488 | pcmcia_unregister_driver(&das08_cs_driver); | 396 | pcmcia_unregister_driver(&das08_cs_driver); |
| 489 | } | 397 | } |
| 490 | 398 | ||
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index ec31a3970664..e06d5b2bc336 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c | |||
| @@ -436,25 +436,7 @@ static int dio700_detach(struct comedi_device *dev) | |||
| 436 | return 0; | 436 | return 0; |
| 437 | }; | 437 | }; |
| 438 | 438 | ||
| 439 | /* PCMCIA crap */ | 439 | /* PCMCIA crap -- watch your words, please! */ |
| 440 | |||
| 441 | /* | ||
| 442 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 443 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 444 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 445 | be present but disabled -- but it can then be enabled for specific | ||
| 446 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 447 | */ | ||
| 448 | #ifdef PCMCIA_DEBUG | ||
| 449 | static int pc_debug = PCMCIA_DEBUG; | ||
| 450 | module_param(pc_debug, int, 0644); | ||
| 451 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 452 | static char *version = "ni_daq_700.c, based on dummy_cs.c"; | ||
| 453 | #else | ||
| 454 | #define DEBUG(n, args...) | ||
| 455 | #endif | ||
| 456 | |||
| 457 | /*====================================================================*/ | ||
| 458 | 440 | ||
| 459 | static void dio700_config(struct pcmcia_device *link); | 441 | static void dio700_config(struct pcmcia_device *link); |
| 460 | static void dio700_release(struct pcmcia_device *link); | 442 | static void dio700_release(struct pcmcia_device *link); |
| @@ -510,7 +492,7 @@ static int dio700_cs_attach(struct pcmcia_device *link) | |||
| 510 | 492 | ||
| 511 | printk(KERN_INFO "ni_daq_700: cs-attach\n"); | 493 | printk(KERN_INFO "ni_daq_700: cs-attach\n"); |
| 512 | 494 | ||
| 513 | DEBUG(0, "dio700_cs_attach()\n"); | 495 | dev_dbg(&link->dev, "dio700_cs_attach()\n"); |
| 514 | 496 | ||
| 515 | /* Allocate space for private device-specific data */ | 497 | /* Allocate space for private device-specific data */ |
| 516 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 498 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -555,7 +537,7 @@ static void dio700_cs_detach(struct pcmcia_device *link) | |||
| 555 | 537 | ||
| 556 | printk(KERN_INFO "ni_daq_700: cs-detach!\n"); | 538 | printk(KERN_INFO "ni_daq_700: cs-detach!\n"); |
| 557 | 539 | ||
| 558 | DEBUG(0, "dio700_cs_detach(0x%p)\n", link); | 540 | dev_dbg(&link->dev, "dio700_cs_detach\n"); |
| 559 | 541 | ||
| 560 | if (link->dev_node) { | 542 | if (link->dev_node) { |
| 561 | ((struct local_info_t *)link->priv)->stop = 1; | 543 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -576,141 +558,85 @@ static void dio700_cs_detach(struct pcmcia_device *link) | |||
| 576 | 558 | ||
| 577 | ======================================================================*/ | 559 | ======================================================================*/ |
| 578 | 560 | ||
| 579 | static void dio700_config(struct pcmcia_device *link) | 561 | static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 562 | cistpl_cftable_entry_t *cfg, | ||
| 563 | cistpl_cftable_entry_t *dflt, | ||
| 564 | unsigned int vcc, | ||
| 565 | void *priv_data) | ||
| 580 | { | 566 | { |
| 581 | struct local_info_t *dev = link->priv; | 567 | win_req_t *req = priv_data; |
| 582 | tuple_t tuple; | ||
| 583 | cisparse_t parse; | ||
| 584 | int last_ret; | ||
| 585 | u_char buf[64]; | ||
| 586 | win_req_t req; | ||
| 587 | memreq_t map; | 568 | memreq_t map; |
| 588 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 589 | 569 | ||
| 590 | printk(KERN_INFO "ni_daq_700: cs-config\n"); | 570 | if (cfg->index == 0) |
| 591 | 571 | return -ENODEV; | |
| 592 | DEBUG(0, "dio700_config(0x%p)\n", link); | ||
| 593 | 572 | ||
| 594 | /* | 573 | /* Does this card need audio output? */ |
| 595 | This reads the card's CONFIG tuple to find its configuration | 574 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { |
| 596 | registers. | 575 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; |
| 597 | */ | 576 | p_dev->conf.Status = CCSR_AUDIO_ENA; |
| 598 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 599 | tuple.Attributes = 0; | ||
| 600 | tuple.TupleData = buf; | ||
| 601 | tuple.TupleDataMax = sizeof(buf); | ||
| 602 | tuple.TupleOffset = 0; | ||
| 603 | |||
| 604 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 605 | if (last_ret) { | ||
| 606 | cs_error(link, GetFirstTuple, last_ret); | ||
| 607 | goto cs_failed; | ||
| 608 | } | 577 | } |
| 609 | 578 | ||
| 610 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 579 | /* Do we need to allocate an interrupt? */ |
| 611 | if (last_ret) { | 580 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 612 | cs_error(link, GetTupleData, last_ret); | 581 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 613 | goto cs_failed; | 582 | |
| 583 | /* IO window settings */ | ||
| 584 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 585 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 586 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 587 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 588 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 589 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 590 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 591 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 592 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 593 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 594 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 595 | if (io->nwin > 1) { | ||
| 596 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 597 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 598 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 599 | } | ||
| 600 | /* This reserves IO space but doesn't actually enable it */ | ||
| 601 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | ||
| 602 | return -ENODEV; | ||
| 614 | } | 603 | } |
| 615 | 604 | ||
| 616 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 605 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
| 617 | if (last_ret) { | 606 | cistpl_mem_t *mem = |
| 618 | cs_error(link, ParseTuple, last_ret); | 607 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
| 619 | goto cs_failed; | 608 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; |
| 609 | req->Attributes |= WIN_ENABLE; | ||
| 610 | req->Base = mem->win[0].host_addr; | ||
| 611 | req->Size = mem->win[0].len; | ||
| 612 | if (req->Size < 0x1000) | ||
| 613 | req->Size = 0x1000; | ||
| 614 | req->AccessSpeed = 0; | ||
| 615 | if (pcmcia_request_window(&p_dev, req, &p_dev->win)) | ||
| 616 | return -ENODEV; | ||
| 617 | map.Page = 0; | ||
| 618 | map.CardOffset = mem->win[0].card_addr; | ||
| 619 | if (pcmcia_map_mem_page(p_dev->win, &map)) | ||
| 620 | return -ENODEV; | ||
| 620 | } | 621 | } |
| 621 | link->conf.ConfigBase = parse.config.base; | 622 | /* If we got this far, we're cool! */ |
| 622 | link->conf.Present = parse.config.rmask[0]; | 623 | return 0; |
| 623 | 624 | } | |
| 624 | /* | ||
| 625 | In this loop, we scan the CIS for configuration table entries, | ||
| 626 | each of which describes a valid card configuration, including | ||
| 627 | voltage, IO window, memory window, and interrupt settings. | ||
| 628 | |||
| 629 | We make no assumptions about the card to be configured: we use | ||
| 630 | just the information available in the CIS. In an ideal world, | ||
| 631 | this would work for any PCMCIA card, but it requires a complete | ||
| 632 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 633 | these things without consulting the CIS, and most client drivers | ||
| 634 | will only use the CIS to fill in implementation-defined details. | ||
| 635 | */ | ||
| 636 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 637 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 638 | if (last_ret != 0) { | ||
| 639 | cs_error(link, GetFirstTuple, last_ret); | ||
| 640 | goto cs_failed; | ||
| 641 | } | ||
| 642 | while (1) { | ||
| 643 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 644 | if (pcmcia_get_tuple_data(link, &tuple) != 0) | ||
| 645 | goto next_entry; | ||
| 646 | if (pcmcia_parse_tuple(&tuple, &parse) != 0) | ||
| 647 | goto next_entry; | ||
| 648 | |||
| 649 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 650 | dflt = *cfg; | ||
| 651 | if (cfg->index == 0) | ||
| 652 | goto next_entry; | ||
| 653 | link->conf.ConfigIndex = cfg->index; | ||
| 654 | |||
| 655 | /* Does this card need audio output? */ | ||
| 656 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 657 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 658 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 659 | } | ||
| 660 | 625 | ||
| 661 | /* Do we need to allocate an interrupt? */ | 626 | static void dio700_config(struct pcmcia_device *link) |
| 662 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | 627 | { |
| 663 | link->conf.Attributes |= CONF_ENABLE_IRQ; | 628 | struct local_info_t *dev = link->priv; |
| 664 | 629 | win_req_t req; | |
| 665 | /* IO window settings */ | 630 | int ret; |
| 666 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 667 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 668 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 669 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 670 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 671 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 672 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 673 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 674 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 675 | link->io.BasePort1 = io->win[0].base; | ||
| 676 | link->io.NumPorts1 = io->win[0].len; | ||
| 677 | if (io->nwin > 1) { | ||
| 678 | link->io.Attributes2 = link->io.Attributes1; | ||
| 679 | link->io.BasePort2 = io->win[1].base; | ||
| 680 | link->io.NumPorts2 = io->win[1].len; | ||
| 681 | } | ||
| 682 | /* This reserves IO space but doesn't actually enable it */ | ||
| 683 | if (pcmcia_request_io(link, &link->io) != 0) | ||
| 684 | goto next_entry; | ||
| 685 | } | ||
| 686 | 631 | ||
| 687 | if ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) { | 632 | printk(KERN_INFO "ni_daq_700: cs-config\n"); |
| 688 | cistpl_mem_t *mem = | ||
| 689 | (cfg->mem.nwin) ? &cfg->mem : &dflt.mem; | ||
| 690 | req.Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
| 691 | req.Attributes |= WIN_ENABLE; | ||
| 692 | req.Base = mem->win[0].host_addr; | ||
| 693 | req.Size = mem->win[0].len; | ||
| 694 | if (req.Size < 0x1000) | ||
| 695 | req.Size = 0x1000; | ||
| 696 | req.AccessSpeed = 0; | ||
| 697 | if (pcmcia_request_window(&link, &req, &link->win)) | ||
| 698 | goto next_entry; | ||
| 699 | map.Page = 0; | ||
| 700 | map.CardOffset = mem->win[0].card_addr; | ||
| 701 | if (pcmcia_map_mem_page(link->win, &map)) | ||
| 702 | goto next_entry; | ||
| 703 | } | ||
| 704 | /* If we got this far, we're cool! */ | ||
| 705 | break; | ||
| 706 | 633 | ||
| 707 | next_entry: | 634 | dev_dbg(&link->dev, "dio700_config\n"); |
| 708 | 635 | ||
| 709 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 636 | ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req); |
| 710 | if (last_ret) { | 637 | if (ret) { |
| 711 | cs_error(link, GetNextTuple, last_ret); | 638 | dev_warn(&link->dev, "no configuration found\n"); |
| 712 | goto cs_failed; | 639 | goto failed; |
| 713 | } | ||
| 714 | } | 640 | } |
| 715 | 641 | ||
| 716 | /* | 642 | /* |
| @@ -719,11 +645,9 @@ next_entry: | |||
| 719 | irq structure is initialized. | 645 | irq structure is initialized. |
| 720 | */ | 646 | */ |
| 721 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 647 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 722 | last_ret = pcmcia_request_irq(link, &link->irq); | 648 | ret = pcmcia_request_irq(link, &link->irq); |
| 723 | if (last_ret) { | 649 | if (ret) |
| 724 | cs_error(link, RequestIRQ, last_ret); | 650 | goto failed; |
| 725 | goto cs_failed; | ||
| 726 | } | ||
| 727 | } | 651 | } |
| 728 | 652 | ||
| 729 | /* | 653 | /* |
| @@ -731,11 +655,9 @@ next_entry: | |||
| 731 | the I/O windows and the interrupt mapping, and putting the | 655 | the I/O windows and the interrupt mapping, and putting the |
| 732 | card and host interface into "Memory and IO" mode. | 656 | card and host interface into "Memory and IO" mode. |
| 733 | */ | 657 | */ |
| 734 | last_ret = pcmcia_request_configuration(link, &link->conf); | 658 | ret = pcmcia_request_configuration(link, &link->conf); |
| 735 | if (last_ret != 0) { | 659 | if (ret != 0) |
| 736 | cs_error(link, RequestConfiguration, last_ret); | 660 | goto failed; |
| 737 | goto cs_failed; | ||
| 738 | } | ||
| 739 | 661 | ||
| 740 | /* | 662 | /* |
| 741 | At this point, the dev_node_t structure(s) need to be | 663 | At this point, the dev_node_t structure(s) need to be |
| @@ -763,7 +685,7 @@ next_entry: | |||
| 763 | 685 | ||
| 764 | return; | 686 | return; |
| 765 | 687 | ||
| 766 | cs_failed: | 688 | failed: |
| 767 | printk(KERN_INFO "ni_daq_700 cs failed"); | 689 | printk(KERN_INFO "ni_daq_700 cs failed"); |
| 768 | dio700_release(link); | 690 | dio700_release(link); |
| 769 | 691 | ||
| @@ -771,7 +693,7 @@ cs_failed: | |||
| 771 | 693 | ||
| 772 | static void dio700_release(struct pcmcia_device *link) | 694 | static void dio700_release(struct pcmcia_device *link) |
| 773 | { | 695 | { |
| 774 | DEBUG(0, "dio700_release(0x%p)\n", link); | 696 | dev_dbg(&link->dev, "dio700_release\n"); |
| 775 | 697 | ||
| 776 | pcmcia_disable_device(link); | 698 | pcmcia_disable_device(link); |
| 777 | } /* dio700_release */ | 699 | } /* dio700_release */ |
| @@ -830,15 +752,13 @@ struct pcmcia_driver dio700_cs_driver = { | |||
| 830 | 752 | ||
| 831 | static int __init init_dio700_cs(void) | 753 | static int __init init_dio700_cs(void) |
| 832 | { | 754 | { |
| 833 | printk("ni_daq_700: cs-init \n"); | ||
| 834 | DEBUG(0, "%s\n", version); | ||
| 835 | pcmcia_register_driver(&dio700_cs_driver); | 755 | pcmcia_register_driver(&dio700_cs_driver); |
| 836 | return 0; | 756 | return 0; |
| 837 | } | 757 | } |
| 838 | 758 | ||
| 839 | static void __exit exit_dio700_cs(void) | 759 | static void __exit exit_dio700_cs(void) |
| 840 | { | 760 | { |
| 841 | DEBUG(0, "ni_daq_700: unloading\n"); | 761 | pr_debug("ni_daq_700: unloading\n"); |
| 842 | pcmcia_unregister_driver(&dio700_cs_driver); | 762 | pcmcia_unregister_driver(&dio700_cs_driver); |
| 843 | } | 763 | } |
| 844 | 764 | ||
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 0700a8bddd1e..9257a4224eab 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c | |||
| @@ -187,25 +187,7 @@ static int dio24_detach(struct comedi_device *dev) | |||
| 187 | return 0; | 187 | return 0; |
| 188 | }; | 188 | }; |
| 189 | 189 | ||
| 190 | /* PCMCIA crap */ | 190 | /* PCMCIA crap -- watch your words! */ |
| 191 | |||
| 192 | /* | ||
| 193 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 194 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 195 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 196 | be present but disabled -- but it can then be enabled for specific | ||
| 197 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 198 | */ | ||
| 199 | #ifdef PCMCIA_DEBUG | ||
| 200 | static int pc_debug = PCMCIA_DEBUG; | ||
| 201 | module_param(pc_debug, int, 0644); | ||
| 202 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 203 | static char *version = "ni_daq_dio24.c, based on dummy_cs.c"; | ||
| 204 | #else | ||
| 205 | #define DEBUG(n, args...) | ||
| 206 | #endif | ||
| 207 | |||
| 208 | /*====================================================================*/ | ||
| 209 | 191 | ||
| 210 | static void dio24_config(struct pcmcia_device *link); | 192 | static void dio24_config(struct pcmcia_device *link); |
| 211 | static void dio24_release(struct pcmcia_device *link); | 193 | static void dio24_release(struct pcmcia_device *link); |
| @@ -261,7 +243,7 @@ static int dio24_cs_attach(struct pcmcia_device *link) | |||
| 261 | 243 | ||
| 262 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); | 244 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); |
| 263 | 245 | ||
| 264 | DEBUG(0, "dio24_cs_attach()\n"); | 246 | dev_dbg(&link->dev, "dio24_cs_attach()\n"); |
| 265 | 247 | ||
| 266 | /* Allocate space for private device-specific data */ | 248 | /* Allocate space for private device-specific data */ |
| 267 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 249 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -306,7 +288,7 @@ static void dio24_cs_detach(struct pcmcia_device *link) | |||
| 306 | 288 | ||
| 307 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - cs-detach!\n"); | 289 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - cs-detach!\n"); |
| 308 | 290 | ||
| 309 | DEBUG(0, "dio24_cs_detach(0x%p)\n", link); | 291 | dev_dbg(&link->dev, "dio24_cs_detach\n"); |
| 310 | 292 | ||
| 311 | if (link->dev_node) { | 293 | if (link->dev_node) { |
| 312 | ((struct local_info_t *)link->priv)->stop = 1; | 294 | ((struct local_info_t *)link->priv)->stop = 1; |
| @@ -327,142 +309,85 @@ static void dio24_cs_detach(struct pcmcia_device *link) | |||
| 327 | 309 | ||
| 328 | ======================================================================*/ | 310 | ======================================================================*/ |
| 329 | 311 | ||
| 330 | static void dio24_config(struct pcmcia_device *link) | 312 | static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 313 | cistpl_cftable_entry_t *cfg, | ||
| 314 | cistpl_cftable_entry_t *dflt, | ||
| 315 | unsigned int vcc, | ||
| 316 | void *priv_data) | ||
| 331 | { | 317 | { |
| 332 | struct local_info_t *dev = link->priv; | 318 | win_req_t *req = priv_data; |
| 333 | tuple_t tuple; | ||
| 334 | cisparse_t parse; | ||
| 335 | int last_ret; | ||
| 336 | u_char buf[64]; | ||
| 337 | win_req_t req; | ||
| 338 | memreq_t map; | 319 | memreq_t map; |
| 339 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 340 | 320 | ||
| 341 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); | 321 | if (cfg->index == 0) |
| 342 | 322 | return -ENODEV; | |
| 343 | DEBUG(0, "dio24_config(0x%p)\n", link); | ||
| 344 | |||
| 345 | /* | ||
| 346 | This reads the card's CONFIG tuple to find its configuration | ||
| 347 | registers. | ||
| 348 | */ | ||
| 349 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 350 | tuple.Attributes = 0; | ||
| 351 | tuple.TupleData = buf; | ||
| 352 | tuple.TupleDataMax = sizeof(buf); | ||
| 353 | tuple.TupleOffset = 0; | ||
| 354 | |||
| 355 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 356 | if (last_ret) { | ||
| 357 | cs_error(link, GetFirstTuple, last_ret); | ||
| 358 | goto cs_failed; | ||
| 359 | } | ||
| 360 | 323 | ||
| 361 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 324 | /* Does this card need audio output? */ |
| 362 | if (last_ret) { | 325 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { |
| 363 | cs_error(link, GetTupleData, last_ret); | 326 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; |
| 364 | goto cs_failed; | 327 | p_dev->conf.Status = CCSR_AUDIO_ENA; |
| 365 | } | 328 | } |
| 366 | 329 | ||
| 367 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 330 | /* Do we need to allocate an interrupt? */ |
| 368 | if (last_ret) { | 331 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 369 | cs_error(link, ParseTuple, last_ret); | 332 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 370 | goto cs_failed; | 333 | |
| 334 | /* IO window settings */ | ||
| 335 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 336 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 337 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 338 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 339 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 340 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 341 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 342 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 343 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 344 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 345 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 346 | if (io->nwin > 1) { | ||
| 347 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 348 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 349 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 350 | } | ||
| 351 | /* This reserves IO space but doesn't actually enable it */ | ||
| 352 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | ||
| 353 | return -ENODEV; | ||
| 371 | } | 354 | } |
| 372 | link->conf.ConfigBase = parse.config.base; | ||
| 373 | link->conf.Present = parse.config.rmask[0]; | ||
| 374 | |||
| 375 | /* | ||
| 376 | In this loop, we scan the CIS for configuration table entries, | ||
| 377 | each of which describes a valid card configuration, including | ||
| 378 | voltage, IO window, memory window, and interrupt settings. | ||
| 379 | |||
| 380 | We make no assumptions about the card to be configured: we use | ||
| 381 | just the information available in the CIS. In an ideal world, | ||
| 382 | this would work for any PCMCIA card, but it requires a complete | ||
| 383 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 384 | these things without consulting the CIS, and most client drivers | ||
| 385 | will only use the CIS to fill in implementation-defined details. | ||
| 386 | */ | ||
| 387 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 388 | 355 | ||
| 389 | last_ret = pcmcia_get_first_tuple(link, &tuple); | 356 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
| 390 | if (last_ret) { | 357 | cistpl_mem_t *mem = |
| 391 | cs_error(link, GetFirstTuple, last_ret); | 358 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
| 392 | goto cs_failed; | 359 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; |
| 360 | req->Attributes |= WIN_ENABLE; | ||
| 361 | req->Base = mem->win[0].host_addr; | ||
| 362 | req->Size = mem->win[0].len; | ||
| 363 | if (req->Size < 0x1000) | ||
| 364 | req->Size = 0x1000; | ||
| 365 | req->AccessSpeed = 0; | ||
| 366 | if (pcmcia_request_window(&p_dev, req, &p_dev->win)) | ||
| 367 | return -ENODEV; | ||
| 368 | map.Page = 0; | ||
| 369 | map.CardOffset = mem->win[0].card_addr; | ||
| 370 | if (pcmcia_map_mem_page(p_dev->win, &map)) | ||
| 371 | return -ENODEV; | ||
| 393 | } | 372 | } |
| 394 | while (1) { | 373 | /* If we got this far, we're cool! */ |
| 395 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 374 | return 0; |
| 396 | if (pcmcia_get_tuple_data(link, &tuple) != 0) | 375 | } |
| 397 | goto next_entry; | ||
| 398 | if (pcmcia_parse_tuple(&tuple, &parse) != 0) | ||
| 399 | goto next_entry; | ||
| 400 | |||
| 401 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 402 | dflt = *cfg; | ||
| 403 | if (cfg->index == 0) | ||
| 404 | goto next_entry; | ||
| 405 | link->conf.ConfigIndex = cfg->index; | ||
| 406 | |||
| 407 | /* Does this card need audio output? */ | ||
| 408 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 409 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 410 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 411 | } | ||
| 412 | 376 | ||
| 413 | /* Do we need to allocate an interrupt? */ | 377 | static void dio24_config(struct pcmcia_device *link) |
| 414 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | 378 | { |
| 415 | link->conf.Attributes |= CONF_ENABLE_IRQ; | 379 | struct local_info_t *dev = link->priv; |
| 416 | 380 | int ret; | |
| 417 | /* IO window settings */ | 381 | win_req_t req; |
| 418 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 419 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 420 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 421 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 422 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 423 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 424 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 425 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 426 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 427 | link->io.BasePort1 = io->win[0].base; | ||
| 428 | link->io.NumPorts1 = io->win[0].len; | ||
| 429 | if (io->nwin > 1) { | ||
| 430 | link->io.Attributes2 = link->io.Attributes1; | ||
| 431 | link->io.BasePort2 = io->win[1].base; | ||
| 432 | link->io.NumPorts2 = io->win[1].len; | ||
| 433 | } | ||
| 434 | /* This reserves IO space but doesn't actually enable it */ | ||
| 435 | if (pcmcia_request_io(link, &link->io) != 0) | ||
| 436 | goto next_entry; | ||
| 437 | } | ||
| 438 | 382 | ||
| 439 | if ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) { | 383 | printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO! - config\n"); |
| 440 | cistpl_mem_t *mem = | ||
| 441 | (cfg->mem.nwin) ? &cfg->mem : &dflt.mem; | ||
| 442 | req.Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
| 443 | req.Attributes |= WIN_ENABLE; | ||
| 444 | req.Base = mem->win[0].host_addr; | ||
| 445 | req.Size = mem->win[0].len; | ||
| 446 | if (req.Size < 0x1000) | ||
| 447 | req.Size = 0x1000; | ||
| 448 | req.AccessSpeed = 0; | ||
| 449 | if (pcmcia_request_window(&link, &req, &link->win)) | ||
| 450 | goto next_entry; | ||
| 451 | map.Page = 0; | ||
| 452 | map.CardOffset = mem->win[0].card_addr; | ||
| 453 | if (pcmcia_map_mem_page(link->win, &map)) | ||
| 454 | goto next_entry; | ||
| 455 | } | ||
| 456 | /* If we got this far, we're cool! */ | ||
| 457 | break; | ||
| 458 | 384 | ||
| 459 | next_entry: | 385 | dev_dbg(&link->dev, "dio24_config\n"); |
| 460 | 386 | ||
| 461 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 387 | ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, &req); |
| 462 | if (last_ret) { | 388 | if (ret) { |
| 463 | cs_error(link, GetNextTuple, last_ret); | 389 | dev_warn(&link->dev, "no configuration found\n"); |
| 464 | goto cs_failed; | 390 | goto failed; |
| 465 | } | ||
| 466 | } | 391 | } |
| 467 | 392 | ||
| 468 | /* | 393 | /* |
| @@ -471,11 +396,9 @@ next_entry: | |||
| 471 | irq structure is initialized. | 396 | irq structure is initialized. |
| 472 | */ | 397 | */ |
| 473 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 398 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 474 | last_ret = pcmcia_request_irq(link, &link->irq); | 399 | ret = pcmcia_request_irq(link, &link->irq); |
| 475 | if (last_ret) { | 400 | if (ret) |
| 476 | cs_error(link, RequestIRQ, last_ret); | 401 | goto failed; |
| 477 | goto cs_failed; | ||
| 478 | } | ||
| 479 | } | 402 | } |
| 480 | 403 | ||
| 481 | /* | 404 | /* |
| @@ -483,11 +406,9 @@ next_entry: | |||
| 483 | the I/O windows and the interrupt mapping, and putting the | 406 | the I/O windows and the interrupt mapping, and putting the |
| 484 | card and host interface into "Memory and IO" mode. | 407 | card and host interface into "Memory and IO" mode. |
| 485 | */ | 408 | */ |
| 486 | last_ret = pcmcia_request_configuration(link, &link->conf); | 409 | ret = pcmcia_request_configuration(link, &link->conf); |
| 487 | if (last_ret) { | 410 | if (ret) |
| 488 | cs_error(link, RequestConfiguration, last_ret); | 411 | goto failed; |
| 489 | goto cs_failed; | ||
| 490 | } | ||
| 491 | 412 | ||
| 492 | /* | 413 | /* |
| 493 | At this point, the dev_node_t structure(s) need to be | 414 | At this point, the dev_node_t structure(s) need to be |
| @@ -515,7 +436,7 @@ next_entry: | |||
| 515 | 436 | ||
| 516 | return; | 437 | return; |
| 517 | 438 | ||
| 518 | cs_failed: | 439 | failed: |
| 519 | printk(KERN_INFO "Fallo"); | 440 | printk(KERN_INFO "Fallo"); |
| 520 | dio24_release(link); | 441 | dio24_release(link); |
| 521 | 442 | ||
| @@ -523,7 +444,7 @@ cs_failed: | |||
| 523 | 444 | ||
| 524 | static void dio24_release(struct pcmcia_device *link) | 445 | static void dio24_release(struct pcmcia_device *link) |
| 525 | { | 446 | { |
| 526 | DEBUG(0, "dio24_release(0x%p)\n", link); | 447 | dev_dbg(&link->dev, "dio24_release\n"); |
| 527 | 448 | ||
| 528 | pcmcia_disable_device(link); | 449 | pcmcia_disable_device(link); |
| 529 | } /* dio24_release */ | 450 | } /* dio24_release */ |
| @@ -582,14 +503,12 @@ struct pcmcia_driver dio24_cs_driver = { | |||
| 582 | static int __init init_dio24_cs(void) | 503 | static int __init init_dio24_cs(void) |
| 583 | { | 504 | { |
| 584 | printk("ni_daq_dio24: HOLA SOY YO!\n"); | 505 | printk("ni_daq_dio24: HOLA SOY YO!\n"); |
| 585 | DEBUG(0, "%s\n", version); | ||
| 586 | pcmcia_register_driver(&dio24_cs_driver); | 506 | pcmcia_register_driver(&dio24_cs_driver); |
| 587 | return 0; | 507 | return 0; |
| 588 | } | 508 | } |
| 589 | 509 | ||
| 590 | static void __exit exit_dio24_cs(void) | 510 | static void __exit exit_dio24_cs(void) |
| 591 | { | 511 | { |
| 592 | DEBUG(0, "ni_dio24: unloading\n"); | ||
| 593 | pcmcia_unregister_driver(&dio24_cs_driver); | 512 | pcmcia_unregister_driver(&dio24_cs_driver); |
| 594 | } | 513 | } |
| 595 | 514 | ||
diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index a3053b8da1c6..28ff4a68cab3 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c | |||
| @@ -153,23 +153,6 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 153 | return labpc_common_attach(dev, iobase, irq, 0); | 153 | return labpc_common_attach(dev, iobase, irq, 0); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | /* | ||
| 157 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 158 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 159 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 160 | be present but disabled -- but it can then be enabled for specific | ||
| 161 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 162 | */ | ||
| 163 | #ifdef PCMCIA_DEBUG | ||
| 164 | static int pc_debug = PCMCIA_DEBUG; | ||
| 165 | module_param(pc_debug, int, 0644); | ||
| 166 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 167 | static const char *version = | ||
| 168 | "ni_labpc.c, based on dummy_cs.c 1.31 2001/08/24 12:13:13"; | ||
| 169 | #else | ||
| 170 | #define DEBUG(n, args...) | ||
| 171 | #endif | ||
| 172 | |||
| 173 | /*====================================================================*/ | 156 | /*====================================================================*/ |
| 174 | 157 | ||
| 175 | /* | 158 | /* |
| @@ -236,7 +219,7 @@ static int labpc_cs_attach(struct pcmcia_device *link) | |||
| 236 | { | 219 | { |
| 237 | struct local_info_t *local; | 220 | struct local_info_t *local; |
| 238 | 221 | ||
| 239 | DEBUG(0, "labpc_cs_attach()\n"); | 222 | dev_dbg(&link->dev, "labpc_cs_attach()\n"); |
| 240 | 223 | ||
| 241 | /* Allocate space for private device-specific data */ | 224 | /* Allocate space for private device-specific data */ |
| 242 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); | 225 | local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); |
| @@ -278,7 +261,7 @@ static int labpc_cs_attach(struct pcmcia_device *link) | |||
| 278 | 261 | ||
| 279 | static void labpc_cs_detach(struct pcmcia_device *link) | 262 | static void labpc_cs_detach(struct pcmcia_device *link) |
| 280 | { | 263 | { |
| 281 | DEBUG(0, "labpc_cs_detach(0x%p)\n", link); | 264 | dev_dbg(&link->dev, "labpc_cs_detach\n"); |
| 282 | 265 | ||
| 283 | /* | 266 | /* |
| 284 | If the device is currently configured and active, we won't | 267 | If the device is currently configured and active, we won't |
| @@ -305,135 +288,84 @@ static void labpc_cs_detach(struct pcmcia_device *link) | |||
| 305 | 288 | ||
| 306 | ======================================================================*/ | 289 | ======================================================================*/ |
| 307 | 290 | ||
| 308 | static void labpc_config(struct pcmcia_device *link) | 291 | static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 292 | cistpl_cftable_entry_t *cfg, | ||
| 293 | cistpl_cftable_entry_t *dflt, | ||
| 294 | unsigned int vcc, | ||
| 295 | void *priv_data) | ||
| 309 | { | 296 | { |
| 310 | struct local_info_t *dev = link->priv; | 297 | win_req_t *req = priv_data; |
| 311 | tuple_t tuple; | ||
| 312 | cisparse_t parse; | ||
| 313 | int last_ret; | ||
| 314 | u_char buf[64]; | ||
| 315 | win_req_t req; | ||
| 316 | memreq_t map; | 298 | memreq_t map; |
| 317 | cistpl_cftable_entry_t dflt = { 0 }; | ||
| 318 | 299 | ||
| 319 | DEBUG(0, "labpc_config(0x%p)\n", link); | 300 | if (cfg->index == 0) |
| 301 | return -ENODEV; | ||
| 320 | 302 | ||
| 321 | /* | 303 | /* Does this card need audio output? */ |
| 322 | This reads the card's CONFIG tuple to find its configuration | 304 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { |
| 323 | registers. | 305 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; |
| 324 | */ | 306 | p_dev->conf.Status = CCSR_AUDIO_ENA; |
| 325 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 326 | tuple.Attributes = 0; | ||
| 327 | tuple.TupleData = buf; | ||
| 328 | tuple.TupleDataMax = sizeof(buf); | ||
| 329 | tuple.TupleOffset = 0; | ||
| 330 | |||
| 331 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 332 | if (last_ret) { | ||
| 333 | cs_error(link, GetFirstTuple, last_ret); | ||
| 334 | goto cs_failed; | ||
| 335 | } | 307 | } |
| 336 | 308 | ||
| 337 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 309 | /* Do we need to allocate an interrupt? */ |
| 338 | if (last_ret) { | 310 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 339 | cs_error(link, GetTupleData, last_ret); | 311 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 340 | goto cs_failed; | 312 | |
| 313 | /* IO window settings */ | ||
| 314 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | ||
| 315 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
| 316 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
| 317 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 318 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 319 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 320 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 321 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 322 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 323 | p_dev->io.BasePort1 = io->win[0].base; | ||
| 324 | p_dev->io.NumPorts1 = io->win[0].len; | ||
| 325 | if (io->nwin > 1) { | ||
| 326 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 327 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 328 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 329 | } | ||
| 330 | /* This reserves IO space but doesn't actually enable it */ | ||
| 331 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | ||
| 332 | return -ENODEV; | ||
| 341 | } | 333 | } |
| 342 | 334 | ||
| 343 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 335 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
| 344 | if (last_ret) { | 336 | cistpl_mem_t *mem = |
| 345 | cs_error(link, ParseTuple, last_ret); | 337 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
| 346 | goto cs_failed; | 338 | req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; |
| 339 | req->Attributes |= WIN_ENABLE; | ||
| 340 | req->Base = mem->win[0].host_addr; | ||
| 341 | req->Size = mem->win[0].len; | ||
| 342 | if (req->Size < 0x1000) | ||
| 343 | req->Size = 0x1000; | ||
| 344 | req->AccessSpeed = 0; | ||
| 345 | if (pcmcia_request_window(&p_dev, req, &p_dev->win)) | ||
| 346 | return -ENODEV; | ||
| 347 | map.Page = 0; | ||
| 348 | map.CardOffset = mem->win[0].card_addr; | ||
| 349 | if (pcmcia_map_mem_page(p_dev->win, &map)) | ||
| 350 | return -ENODEV; | ||
| 347 | } | 351 | } |
| 348 | link->conf.ConfigBase = parse.config.base; | 352 | /* If we got this far, we're cool! */ |
| 349 | link->conf.Present = parse.config.rmask[0]; | 353 | return 0; |
| 354 | } | ||
| 350 | 355 | ||
| 351 | /* | ||
| 352 | In this loop, we scan the CIS for configuration table entries, | ||
| 353 | each of which describes a valid card configuration, including | ||
| 354 | voltage, IO window, memory window, and interrupt settings. | ||
| 355 | |||
| 356 | We make no assumptions about the card to be configured: we use | ||
| 357 | just the information available in the CIS. In an ideal world, | ||
| 358 | this would work for any PCMCIA card, but it requires a complete | ||
| 359 | and accurate CIS. In practice, a driver usually "knows" most of | ||
| 360 | these things without consulting the CIS, and most client drivers | ||
| 361 | will only use the CIS to fill in implementation-defined details. | ||
| 362 | */ | ||
| 363 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 364 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 365 | if (last_ret) { | ||
| 366 | cs_error(link, GetFirstTuple, last_ret); | ||
| 367 | goto cs_failed; | ||
| 368 | } | ||
| 369 | while (1) { | ||
| 370 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
| 371 | if (pcmcia_get_tuple_data(link, &tuple)) | ||
| 372 | goto next_entry; | ||
| 373 | if (pcmcia_parse_tuple(&tuple, &parse)) | ||
| 374 | goto next_entry; | ||
| 375 | |||
| 376 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 377 | dflt = *cfg; | ||
| 378 | if (cfg->index == 0) | ||
| 379 | goto next_entry; | ||
| 380 | link->conf.ConfigIndex = cfg->index; | ||
| 381 | |||
| 382 | /* Does this card need audio output? */ | ||
| 383 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
| 384 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
| 385 | link->conf.Status = CCSR_AUDIO_ENA; | ||
| 386 | } | ||
| 387 | 356 | ||
| 388 | /* Do we need to allocate an interrupt? */ | 357 | static void labpc_config(struct pcmcia_device *link) |
| 389 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | 358 | { |
| 390 | link->conf.Attributes |= CONF_ENABLE_IRQ; | 359 | struct local_info_t *dev = link->priv; |
| 391 | 360 | int ret; | |
| 392 | /* IO window settings */ | 361 | win_req_t req; |
| 393 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 394 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 395 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 396 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 397 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 398 | link->io.BasePort1 = io->win[0].base; | ||
| 399 | link->io.NumPorts1 = io->win[0].len; | ||
| 400 | if (io->nwin > 1) { | ||
| 401 | link->io.Attributes2 = link->io.Attributes1; | ||
| 402 | link->io.BasePort2 = io->win[1].base; | ||
| 403 | link->io.NumPorts2 = io->win[1].len; | ||
| 404 | } | ||
| 405 | /* This reserves IO space but doesn't actually enable it */ | ||
| 406 | if (pcmcia_request_io(link, &link->io)) | ||
| 407 | goto next_entry; | ||
| 408 | } | ||
| 409 | 362 | ||
| 410 | if ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) { | 363 | dev_dbg(&link->dev, "labpc_config\n"); |
| 411 | cistpl_mem_t *mem = | ||
| 412 | (cfg->mem.nwin) ? &cfg->mem : &dflt.mem; | ||
| 413 | req.Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM; | ||
| 414 | req.Attributes |= WIN_ENABLE; | ||
| 415 | req.Base = mem->win[0].host_addr; | ||
| 416 | req.Size = mem->win[0].len; | ||
| 417 | if (req.Size < 0x1000) | ||
| 418 | req.Size = 0x1000; | ||
| 419 | req.AccessSpeed = 0; | ||
| 420 | link->win = (window_handle_t) link; | ||
| 421 | if (pcmcia_request_window(&link, &req, &link->win)) | ||
| 422 | goto next_entry; | ||
| 423 | map.Page = 0; | ||
| 424 | map.CardOffset = mem->win[0].card_addr; | ||
| 425 | if (pcmcia_map_mem_page(link->win, &map)) | ||
| 426 | goto next_entry; | ||
| 427 | } | ||
| 428 | /* If we got this far, we're cool! */ | ||
| 429 | break; | ||
| 430 | 364 | ||
| 431 | next_entry: | 365 | ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, &req); |
| 432 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 366 | if (ret) { |
| 433 | if (last_ret) { | 367 | dev_warn(&link->dev, "no configuration found\n"); |
| 434 | cs_error(link, GetNextTuple, last_ret); | 368 | goto failed; |
| 435 | goto cs_failed; | ||
| 436 | } | ||
| 437 | } | 369 | } |
| 438 | 370 | ||
| 439 | /* | 371 | /* |
| @@ -442,11 +374,9 @@ next_entry: | |||
| 442 | irq structure is initialized. | 374 | irq structure is initialized. |
| 443 | */ | 375 | */ |
| 444 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 376 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 445 | last_ret = pcmcia_request_irq(link, &link->irq); | 377 | ret = pcmcia_request_irq(link, &link->irq); |
| 446 | if (last_ret) { | 378 | if (ret) |
| 447 | cs_error(link, RequestIRQ, last_ret); | 379 | goto failed; |
| 448 | goto cs_failed; | ||
| 449 | } | ||
| 450 | } | 380 | } |
| 451 | 381 | ||
| 452 | /* | 382 | /* |
| @@ -454,11 +384,9 @@ next_entry: | |||
| 454 | the I/O windows and the interrupt mapping, and putting the | 384 | the I/O windows and the interrupt mapping, and putting the |
| 455 | card and host interface into "Memory and IO" mode. | 385 | card and host interface into "Memory and IO" mode. |
| 456 | */ | 386 | */ |
| 457 | last_ret = pcmcia_request_configuration(link, &link->conf); | 387 | ret = pcmcia_request_configuration(link, &link->conf); |
| 458 | if (last_ret) { | 388 | if (ret) |
| 459 | cs_error(link, RequestConfiguration, last_ret); | 389 | goto failed; |
| 460 | goto cs_failed; | ||
| 461 | } | ||
| 462 | 390 | ||
| 463 | /* | 391 | /* |
| 464 | At this point, the dev_node_t structure(s) need to be | 392 | At this point, the dev_node_t structure(s) need to be |
| @@ -486,14 +414,14 @@ next_entry: | |||
| 486 | 414 | ||
| 487 | return; | 415 | return; |
| 488 | 416 | ||
| 489 | cs_failed: | 417 | failed: |
| 490 | labpc_release(link); | 418 | labpc_release(link); |
| 491 | 419 | ||
| 492 | } /* labpc_config */ | 420 | } /* labpc_config */ |
| 493 | 421 | ||
| 494 | static void labpc_release(struct pcmcia_device *link) | 422 | static void labpc_release(struct pcmcia_device *link) |
| 495 | { | 423 | { |
| 496 | DEBUG(0, "labpc_release(0x%p)\n", link); | 424 | dev_dbg(&link->dev, "labpc_release\n"); |
| 497 | 425 | ||
| 498 | pcmcia_disable_device(link); | 426 | pcmcia_disable_device(link); |
| 499 | } /* labpc_release */ | 427 | } /* labpc_release */ |
| @@ -551,14 +479,12 @@ struct pcmcia_driver labpc_cs_driver = { | |||
| 551 | 479 | ||
| 552 | static int __init init_labpc_cs(void) | 480 | static int __init init_labpc_cs(void) |
| 553 | { | 481 | { |
| 554 | DEBUG(0, "%s\n", version); | ||
| 555 | pcmcia_register_driver(&labpc_cs_driver); | 482 | pcmcia_register_driver(&labpc_cs_driver); |
| 556 | return 0; | 483 | return 0; |
| 557 | } | 484 | } |
| 558 | 485 | ||
| 559 | static void __exit exit_labpc_cs(void) | 486 | static void __exit exit_labpc_cs(void) |
| 560 | { | 487 | { |
| 561 | DEBUG(0, "ni_labpc: unloading\n"); | ||
| 562 | pcmcia_unregister_driver(&labpc_cs_driver); | 488 | pcmcia_unregister_driver(&labpc_cs_driver); |
| 563 | } | 489 | } |
| 564 | 490 | ||
diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 9aef87fc81dc..ca7ab4abdc2e 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c | |||
| @@ -312,96 +312,50 @@ static int mio_cs_resume(struct pcmcia_device *link) | |||
| 312 | return 0; | 312 | return 0; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | static void mio_cs_config(struct pcmcia_device *link) | ||
| 316 | { | ||
| 317 | tuple_t tuple; | ||
| 318 | u_short buf[128]; | ||
| 319 | cisparse_t parse; | ||
| 320 | int manfid = 0, prodid = 0; | ||
| 321 | int ret; | ||
| 322 | 315 | ||
| 323 | DPRINTK("mio_cs_config(link=%p)\n", link); | 316 | static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 324 | 317 | cistpl_cftable_entry_t *cfg, | |
| 325 | tuple.TupleData = (cisdata_t *) buf; | 318 | cistpl_cftable_entry_t *dflt, |
| 326 | tuple.TupleOffset = 0; | 319 | unsigned int vcc, |
| 327 | tuple.TupleDataMax = 255; | 320 | void *priv_data) |
| 328 | tuple.Attributes = 0; | 321 | { |
| 322 | int base, ret; | ||
| 329 | 323 | ||
| 330 | tuple.DesiredTuple = CISTPL_CONFIG; | 324 | p_dev->io.NumPorts1 = cfg->io.win[0].len; |
| 331 | ret = pcmcia_get_first_tuple(link, &tuple); | 325 | p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; |
| 332 | ret = pcmcia_get_tuple_data(link, &tuple); | 326 | p_dev->io.NumPorts2 = 0; |
| 333 | ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 334 | link->conf.ConfigBase = parse.config.base; | ||
| 335 | link->conf.Present = parse.config.rmask[0]; | ||
| 336 | 327 | ||
| 337 | #if 0 | 328 | p_dev->irq.IRQInfo1 = cfg->irq.IRQInfo1; |
| 338 | tuple.DesiredTuple = CISTPL_LONGLINK_MFC; | 329 | p_dev->irq.IRQInfo2 = cfg->irq.IRQInfo2; |
| 339 | tuple.Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | ||
| 340 | info->multi(first_tuple(link, &tuple, &parse) == 0); | ||
| 341 | #endif | ||
| 342 | 330 | ||
| 343 | tuple.DesiredTuple = CISTPL_MANFID; | 331 | for (base = 0x000; base < 0x400; base += 0x20) { |
| 344 | tuple.Attributes = TUPLE_RETURN_COMMON; | 332 | p_dev->io.BasePort1 = base; |
| 345 | if ((pcmcia_get_first_tuple(link, &tuple) == 0) && | 333 | ret = pcmcia_request_io(p_dev, &p_dev->io); |
| 346 | (pcmcia_get_tuple_data(link, &tuple) == 0)) { | 334 | if (!ret) |
| 347 | manfid = le16_to_cpu(buf[0]); | 335 | return 0; |
| 348 | prodid = le16_to_cpu(buf[1]); | ||
| 349 | } | 336 | } |
| 350 | /* printk("manfid = 0x%04x, 0x%04x\n",manfid,prodid); */ | 337 | return -ENODEV; |
| 338 | } | ||
| 351 | 339 | ||
| 352 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
| 353 | tuple.Attributes = 0; | ||
| 354 | ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 355 | ret = pcmcia_get_tuple_data(link, &tuple); | ||
| 356 | ret = pcmcia_parse_tuple(&tuple, &parse); | ||
| 357 | 340 | ||
| 358 | #if 0 | 341 | static void mio_cs_config(struct pcmcia_device *link) |
| 359 | printk(" index: 0x%x\n", parse.cftable_entry.index); | 342 | { |
| 360 | printk(" flags: 0x%x\n", parse.cftable_entry.flags); | 343 | int ret; |
| 361 | printk(" io flags: 0x%x\n", parse.cftable_entry.io.flags); | ||
| 362 | printk(" io nwin: 0x%x\n", parse.cftable_entry.io.nwin); | ||
| 363 | printk(" io base: 0x%x\n", parse.cftable_entry.io.win[0].base); | ||
| 364 | printk(" io len: 0x%x\n", parse.cftable_entry.io.win[0].len); | ||
| 365 | printk(" irq1: 0x%x\n", parse.cftable_entry.irq.IRQInfo1); | ||
| 366 | printk(" irq2: 0x%x\n", parse.cftable_entry.irq.IRQInfo2); | ||
| 367 | printk(" mem flags: 0x%x\n", parse.cftable_entry.mem.flags); | ||
| 368 | printk(" mem nwin: 0x%x\n", parse.cftable_entry.mem.nwin); | ||
| 369 | printk(" subtuples: 0x%x\n", parse.cftable_entry.subtuples); | ||
| 370 | #endif | ||
| 371 | 344 | ||
| 372 | #if 0 | 345 | DPRINTK("mio_cs_config(link=%p)\n", link); |
| 373 | link->io.NumPorts1 = 0x20; | ||
| 374 | link->io.IOAddrLines = 5; | ||
| 375 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 376 | #endif | ||
| 377 | link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; | ||
| 378 | link->io.IOAddrLines = | ||
| 379 | parse.cftable_entry.io.flags & CISTPL_IO_LINES_MASK; | ||
| 380 | link->io.NumPorts2 = 0; | ||
| 381 | 346 | ||
| 382 | { | 347 | ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); |
| 383 | int base; | 348 | if (ret) { |
| 384 | for (base = 0x000; base < 0x400; base += 0x20) { | 349 | dev_warn(&link->dev, "no configuration found\n"); |
| 385 | link->io.BasePort1 = base; | 350 | return; |
| 386 | ret = pcmcia_request_io(link, &link->io); | ||
| 387 | /* printk("RequestIO 0x%02x\n",ret); */ | ||
| 388 | if (!ret) | ||
| 389 | break; | ||
| 390 | } | ||
| 391 | } | 351 | } |
| 392 | 352 | ||
| 393 | link->irq.IRQInfo1 = parse.cftable_entry.irq.IRQInfo1; | ||
| 394 | link->irq.IRQInfo2 = parse.cftable_entry.irq.IRQInfo2; | ||
| 395 | ret = pcmcia_request_irq(link, &link->irq); | 353 | ret = pcmcia_request_irq(link, &link->irq); |
| 396 | if (ret) { | 354 | if (ret) { |
| 397 | printk("pcmcia_request_irq() returned error: %i\n", ret); | 355 | printk("pcmcia_request_irq() returned error: %i\n", ret); |
| 398 | } | 356 | } |
| 399 | /* printk("RequestIRQ 0x%02x\n",ret); */ | ||
| 400 | |||
| 401 | link->conf.ConfigIndex = 1; | ||
| 402 | 357 | ||
| 403 | ret = pcmcia_request_configuration(link, &link->conf); | 358 | ret = pcmcia_request_configuration(link, &link->conf); |
| 404 | /* printk("RequestConfiguration %d\n",ret); */ | ||
| 405 | 359 | ||
| 406 | link->dev_node = &dev_node; | 360 | link->dev_node = &dev_node; |
| 407 | } | 361 | } |
| @@ -475,40 +429,17 @@ static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 475 | return 0; | 429 | return 0; |
| 476 | } | 430 | } |
| 477 | 431 | ||
| 478 | static int get_prodid(struct comedi_device *dev, struct pcmcia_device *link) | ||
| 479 | { | ||
| 480 | tuple_t tuple; | ||
| 481 | u_short buf[128]; | ||
| 482 | int prodid = 0; | ||
| 483 | |||
| 484 | tuple.TupleData = (cisdata_t *) buf; | ||
| 485 | tuple.TupleOffset = 0; | ||
| 486 | tuple.TupleDataMax = 255; | ||
| 487 | tuple.DesiredTuple = CISTPL_MANFID; | ||
| 488 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
| 489 | if ((pcmcia_get_first_tuple(link, &tuple) == 0) && | ||
| 490 | (pcmcia_get_tuple_data(link, &tuple) == 0)) { | ||
| 491 | prodid = le16_to_cpu(buf[1]); | ||
| 492 | } | ||
| 493 | |||
| 494 | return prodid; | ||
| 495 | } | ||
| 496 | |||
| 497 | static int ni_getboardtype(struct comedi_device *dev, | 432 | static int ni_getboardtype(struct comedi_device *dev, |
| 498 | struct pcmcia_device *link) | 433 | struct pcmcia_device *link) |
| 499 | { | 434 | { |
| 500 | int id; | ||
| 501 | int i; | 435 | int i; |
| 502 | 436 | ||
| 503 | id = get_prodid(dev, link); | ||
| 504 | |||
| 505 | for (i = 0; i < n_ni_boards; i++) { | 437 | for (i = 0; i < n_ni_boards; i++) { |
| 506 | if (ni_boards[i].device_id == id) { | 438 | if (ni_boards[i].device_id == link->card_id) |
| 507 | return i; | 439 | return i; |
| 508 | } | ||
| 509 | } | 440 | } |
| 510 | 441 | ||
| 511 | printk("unknown board 0x%04x -- pretend it is a ", id); | 442 | printk("unknown board 0x%04x -- pretend it is a ", link->card_id); |
| 512 | 443 | ||
| 513 | return 0; | 444 | return 0; |
| 514 | } | 445 | } |
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 344b82353e08..48e7c27ed87a 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c | |||
| @@ -55,23 +55,6 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 | |||
| 55 | #include <pcmcia/cisreg.h> | 55 | #include <pcmcia/cisreg.h> |
| 56 | #include <pcmcia/ds.h> | 56 | #include <pcmcia/ds.h> |
| 57 | 57 | ||
| 58 | /* | ||
| 59 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
| 60 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
| 61 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
| 62 | be present but disabled -- but it can then be enabled for specific | ||
| 63 | modules at load time with a 'pc_debug=#' option to insmod. | ||
| 64 | */ | ||
| 65 | |||
| 66 | #ifdef PCMCIA_DEBUG | ||
| 67 | static int pc_debug = PCMCIA_DEBUG; | ||
| 68 | module_param(pc_debug, int, 0644); | ||
| 69 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
| 70 | static char *version = "quatech_daqp_cs.c 1.10 2003/04/21 (Brent Baccala)"; | ||
| 71 | #else | ||
| 72 | #define DEBUG(n, args...) | ||
| 73 | #endif | ||
| 74 | |||
| 75 | /* Maximum number of separate DAQP devices we'll allow */ | 58 | /* Maximum number of separate DAQP devices we'll allow */ |
| 76 | #define MAX_DEV 4 | 59 | #define MAX_DEV 4 |
| 77 | 60 | ||
| @@ -863,8 +846,6 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 863 | { | 846 | { |
| 864 | int ret; | 847 | int ret; |
| 865 | struct local_info_t *local = dev_table[it->options[0]]; | 848 | struct local_info_t *local = dev_table[it->options[0]]; |
| 866 | tuple_t tuple; | ||
| 867 | int i; | ||
| 868 | struct comedi_subdevice *s; | 849 | struct comedi_subdevice *s; |
| 869 | 850 | ||
| 870 | if (it->options[0] < 0 || it->options[0] >= MAX_DEV || !local) { | 851 | if (it->options[0] < 0 || it->options[0] >= MAX_DEV || !local) { |
| @@ -883,29 +864,10 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
| 883 | 864 | ||
| 884 | strcpy(local->board_name, "DAQP"); | 865 | strcpy(local->board_name, "DAQP"); |
| 885 | dev->board_name = local->board_name; | 866 | dev->board_name = local->board_name; |
| 886 | 867 | if (local->link->prod_id[2]) { | |
| 887 | tuple.DesiredTuple = CISTPL_VERS_1; | 868 | if (strncmp(local->link->prod_id[2], "DAQP", 4) == 0) { |
| 888 | if (pcmcia_get_first_tuple(local->link, &tuple) == 0) { | 869 | strncpy(local->board_name, local->link->prod_id[2], |
| 889 | u_char buf[128]; | 870 | sizeof(local->board_name)); |
| 890 | |||
| 891 | buf[0] = buf[sizeof(buf) - 1] = 0; | ||
| 892 | tuple.TupleData = buf; | ||
| 893 | tuple.TupleDataMax = sizeof(buf); | ||
| 894 | tuple.TupleOffset = 2; | ||
| 895 | if (pcmcia_get_tuple_data(local->link, &tuple) == 0) { | ||
| 896 | |||
| 897 | for (i = 0; i < tuple.TupleDataLen - 4; i++) | ||
| 898 | if (buf[i] == 0) | ||
| 899 | break; | ||
| 900 | for (i++; i < tuple.TupleDataLen - 4; i++) | ||
| 901 | if (buf[i] == 0) | ||
| 902 | break; | ||
| 903 | i++; | ||
| 904 | if ((i < tuple.TupleDataLen - 4) | ||
| 905 | && (strncmp(buf + i, "DAQP", 4) == 0)) { | ||
| 906 | strncpy(local->board_name, buf + i, | ||
| 907 | sizeof(local->board_name)); | ||
| 908 | } | ||
| 909 | } | 871 | } |
| 910 | } | 872 | } |
| 911 | 873 | ||
| @@ -1058,7 +1020,7 @@ static int daqp_cs_attach(struct pcmcia_device *link) | |||
| 1058 | struct local_info_t *local; | 1020 | struct local_info_t *local; |
| 1059 | int i; | 1021 | int i; |
| 1060 | 1022 | ||
| 1061 | DEBUG(0, "daqp_cs_attach()\n"); | 1023 | dev_dbg(&link->dev, "daqp_cs_attach()\n"); |
| 1062 | 1024 | ||
| 1063 | for (i = 0; i < MAX_DEV; i++) | 1025 | for (i = 0; i < MAX_DEV; i++) |
| 1064 | if (dev_table[i] == NULL) | 1026 | if (dev_table[i] == NULL) |
| @@ -1112,7 +1074,7 @@ static void daqp_cs_detach(struct pcmcia_device *link) | |||
| 1112 | { | 1074 | { |
| 1113 | struct local_info_t *dev = link->priv; | 1075 | struct local_info_t *dev = link->priv; |
| 1114 | 1076 | ||
| 1115 | DEBUG(0, "daqp_cs_detach(0x%p)\n", link); | 1077 | dev_dbg(&link->dev, "daqp_cs_detach\n"); |
| 1116 | 1078 | ||
| 1117 | if (link->dev_node) { | 1079 | if (link->dev_node) { |
| 1118 | dev->stop = 1; | 1080 | dev->stop = 1; |
| @@ -1134,115 +1096,54 @@ static void daqp_cs_detach(struct pcmcia_device *link) | |||
| 1134 | 1096 | ||
| 1135 | ======================================================================*/ | 1097 | ======================================================================*/ |
| 1136 | 1098 | ||
| 1137 | static void daqp_cs_config(struct pcmcia_device *link) | ||
| 1138 | { | ||
| 1139 | struct local_info_t *dev = link->priv; | ||
| 1140 | tuple_t tuple; | ||
| 1141 | cisparse_t parse; | ||
| 1142 | int last_ret; | ||
| 1143 | u_char buf[64]; | ||
| 1144 | |||
| 1145 | DEBUG(0, "daqp_cs_config(0x%p)\n", link); | ||
| 1146 | |||
| 1147 | /* | ||
| 1148 | This reads the card's CONFIG tuple to find its configuration | ||
| 1149 | registers. | ||
| 1150 | */ | ||
| 1151 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
| 1152 | tuple.Attributes = 0; | ||
| 1153 | tuple.TupleData = buf; | ||
| 1154 | tuple.TupleDataMax = sizeof(buf); | ||
| 1155 | tuple.TupleOffset = 0; | ||
| 1156 | |||
| 1157 | last_ret = pcmcia_get_first_tuple(link, &tuple); | ||
| 1158 | if (last_ret) { | ||
| 1159 | cs_error(link, GetFirstTuple, last_ret); | ||
| 1160 | goto cs_failed; | ||
| 1161 | } | ||
| 1162 | 1099 | ||
| 1163 | last_ret = pcmcia_get_tuple_data(link, &tuple); | 1100 | static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, |
| 1164 | if (last_ret) { | 1101 | cistpl_cftable_entry_t *cfg, |
| 1165 | cs_error(link, GetTupleData, last_ret); | 1102 | cistpl_cftable_entry_t *dflt, |
| 1166 | goto cs_failed; | 1103 | unsigned int vcc, |
| 1167 | } | 1104 | void *priv_data) |
| 1168 | 1105 | { | |
| 1169 | last_ret = pcmcia_parse_tuple(&tuple, &parse); | 1106 | if (cfg->index == 0) |
| 1170 | if (last_ret) { | 1107 | return -ENODEV; |
| 1171 | cs_error(link, ParseTuple, last_ret); | ||
| 1172 | goto cs_failed; | ||
| 1173 | } | ||
| 1174 | link->conf.ConfigBase = parse.config.base; | ||
| 1175 | link->conf.Present = parse.config.rmask[0]; | ||
| 1176 | 1108 | ||
| 1177 | /* | 1109 | /* Do we need to allocate an interrupt? */ |
| 1178 | In this loop, we scan the CIS for configuration table entries, | 1110 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
| 1179 | each of which describes a valid card configuration, including | 1111 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
| 1180 | voltage, IO window, memory window, and interrupt settings. | 1112 | |
| 1181 | 1113 | /* IO window settings */ | |
| 1182 | We make no assumptions about the card to be configured: we use | 1114 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; |
| 1183 | just the information available in the CIS. In an ideal world, | 1115 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
| 1184 | this would work for any PCMCIA card, but it requires a complete | 1116 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
| 1185 | and accurate CIS. In practice, a driver usually "knows" most of | 1117 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
| 1186 | these things without consulting the CIS, and most client drivers | 1118 | if (!(io->flags & CISTPL_IO_8BIT)) |
| 1187 | will only use the CIS to fill in implementation-defined details. | 1119 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
| 1188 | */ | 1120 | if (!(io->flags & CISTPL_IO_16BIT)) |
| 1189 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 1121 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
| 1190 | last_ret = pcmcia_get_first_tuple(link, &tuple); | 1122 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; |
| 1191 | if (last_ret) { | 1123 | p_dev->io.BasePort1 = io->win[0].base; |
| 1192 | cs_error(link, GetFirstTuple, last_ret); | 1124 | p_dev->io.NumPorts1 = io->win[0].len; |
| 1193 | goto cs_failed; | 1125 | if (io->nwin > 1) { |
| 1126 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | ||
| 1127 | p_dev->io.BasePort2 = io->win[1].base; | ||
| 1128 | p_dev->io.NumPorts2 = io->win[1].len; | ||
| 1129 | } | ||
| 1194 | } | 1130 | } |
| 1195 | 1131 | ||
| 1196 | while (1) { | 1132 | /* This reserves IO space but doesn't actually enable it */ |
| 1197 | cistpl_cftable_entry_t dflt = { 0 }; | 1133 | return pcmcia_request_io(p_dev, &p_dev->io); |
| 1198 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | 1134 | } |
| 1199 | if (pcmcia_get_tuple_data(link, &tuple)) | ||
| 1200 | goto next_entry; | ||
| 1201 | if (pcmcia_parse_tuple(&tuple, &parse)) | ||
| 1202 | goto next_entry; | ||
| 1203 | |||
| 1204 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
| 1205 | dflt = *cfg; | ||
| 1206 | if (cfg->index == 0) | ||
| 1207 | goto next_entry; | ||
| 1208 | link->conf.ConfigIndex = cfg->index; | ||
| 1209 | |||
| 1210 | /* Do we need to allocate an interrupt? */ | ||
| 1211 | if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) | ||
| 1212 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
| 1213 | |||
| 1214 | /* IO window settings */ | ||
| 1215 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
| 1216 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
| 1217 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
| 1218 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
| 1219 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
| 1220 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
| 1221 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
| 1222 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
| 1223 | link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | ||
| 1224 | link->io.BasePort1 = io->win[0].base; | ||
| 1225 | link->io.NumPorts1 = io->win[0].len; | ||
| 1226 | if (io->nwin > 1) { | ||
| 1227 | link->io.Attributes2 = link->io.Attributes1; | ||
| 1228 | link->io.BasePort2 = io->win[1].base; | ||
| 1229 | link->io.NumPorts2 = io->win[1].len; | ||
| 1230 | } | ||
| 1231 | } | ||
| 1232 | 1135 | ||
| 1233 | /* This reserves IO space but doesn't actually enable it */ | 1136 | static void daqp_cs_config(struct pcmcia_device *link) |
| 1234 | if (pcmcia_request_io(link, &link->io)) | 1137 | { |
| 1235 | goto next_entry; | 1138 | struct local_info_t *dev = link->priv; |
| 1139 | int ret; | ||
| 1236 | 1140 | ||
| 1237 | /* If we got this far, we're cool! */ | 1141 | dev_dbg(&link->dev, "daqp_cs_config\n"); |
| 1238 | break; | ||
| 1239 | 1142 | ||
| 1240 | next_entry: | 1143 | ret = pcmcia_loop_config(link, daqp_pcmcia_config_loop, NULL); |
| 1241 | last_ret = pcmcia_get_next_tuple(link, &tuple); | 1144 | if (ret) { |
| 1242 | if (last_ret) { | 1145 | dev_warn(&link->dev, "no configuration found\n"); |
| 1243 | cs_error(link, GetNextTuple, last_ret); | 1146 | goto failed; |
| 1244 | goto cs_failed; | ||
| 1245 | } | ||
| 1246 | } | 1147 | } |
| 1247 | 1148 | ||
| 1248 | /* | 1149 | /* |
| @@ -1251,11 +1152,9 @@ next_entry: | |||
| 1251 | irq structure is initialized. | 1152 | irq structure is initialized. |
| 1252 | */ | 1153 | */ |
| 1253 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 1154 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
| 1254 | last_ret = pcmcia_request_irq(link, &link->irq); | 1155 | ret = pcmcia_request_irq(link, &link->irq); |
| 1255 | if (last_ret) { | 1156 | if (ret) |
| 1256 | cs_error(link, RequestIRQ, last_ret); | 1157 | goto failed; |
| 1257 | goto cs_failed; | ||
| 1258 | } | ||
| 1259 | } | 1158 | } |
| 1260 | 1159 | ||
| 1261 | /* | 1160 | /* |
| @@ -1263,11 +1162,9 @@ next_entry: | |||
| 1263 | the I/O windows and the interrupt mapping, and putting the | 1162 | the I/O windows and the interrupt mapping, and putting the |
| 1264 | card and host interface into "Memory and IO" mode. | 1163 | card and host interface into "Memory and IO" mode. |
| 1265 | */ | 1164 | */ |
| 1266 | last_ret = pcmcia_request_configuration(link, &link->conf); | 1165 | ret = pcmcia_request_configuration(link, &link->conf); |
| 1267 | if (last_ret) { | 1166 | if (ret) |
| 1268 | cs_error(link, RequestConfiguration, last_ret); | 1167 | goto failed; |
| 1269 | goto cs_failed; | ||
| 1270 | } | ||
| 1271 | 1168 | ||
| 1272 | /* | 1169 | /* |
| 1273 | At this point, the dev_node_t structure(s) need to be | 1170 | At this point, the dev_node_t structure(s) need to be |
| @@ -1296,14 +1193,14 @@ next_entry: | |||
| 1296 | 1193 | ||
| 1297 | return; | 1194 | return; |
| 1298 | 1195 | ||
| 1299 | cs_failed: | 1196 | failed: |
| 1300 | daqp_cs_release(link); | 1197 | daqp_cs_release(link); |
| 1301 | 1198 | ||
| 1302 | } /* daqp_cs_config */ | 1199 | } /* daqp_cs_config */ |
| 1303 | 1200 | ||
| 1304 | static void daqp_cs_release(struct pcmcia_device *link) | 1201 | static void daqp_cs_release(struct pcmcia_device *link) |
| 1305 | { | 1202 | { |
| 1306 | DEBUG(0, "daqp_cs_release(0x%p)\n", link); | 1203 | dev_dbg(&link->dev, "daqp_cs_release\n"); |
| 1307 | 1204 | ||
| 1308 | pcmcia_disable_device(link); | 1205 | pcmcia_disable_device(link); |
| 1309 | } /* daqp_cs_release */ | 1206 | } /* daqp_cs_release */ |
| @@ -1363,7 +1260,6 @@ struct pcmcia_driver daqp_cs_driver = { | |||
| 1363 | 1260 | ||
| 1364 | int __init init_module(void) | 1261 | int __init init_module(void) |
| 1365 | { | 1262 | { |
| 1366 | DEBUG(0, "%s\n", version); | ||
| 1367 | pcmcia_register_driver(&daqp_cs_driver); | 1263 | pcmcia_register_driver(&daqp_cs_driver); |
| 1368 | comedi_driver_register(&driver_daqp); | 1264 | comedi_driver_register(&driver_daqp); |
| 1369 | return 0; | 1265 | return 0; |
| @@ -1371,7 +1267,6 @@ int __init init_module(void) | |||
| 1371 | 1267 | ||
| 1372 | void __exit cleanup_module(void) | 1268 | void __exit cleanup_module(void) |
| 1373 | { | 1269 | { |
| 1374 | DEBUG(0, "daqp_cs: unloading\n"); | ||
| 1375 | comedi_driver_unregister(&driver_daqp); | 1270 | comedi_driver_unregister(&driver_daqp); |
| 1376 | pcmcia_unregister_driver(&daqp_cs_driver); | 1271 | pcmcia_unregister_driver(&daqp_cs_driver); |
| 1377 | } | 1272 | } |
