aboutsummaryrefslogtreecommitdiff
path: root/drivers/isdn/hisax/teles_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hisax/teles_cs.c')
-rw-r--r--drivers/isdn/hisax/teles_cs.c79
1 files changed, 26 insertions, 53 deletions
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index ab4bd455450..623d111544d 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -193,82 +193,55 @@ static void teles_detach(struct pcmcia_device *link)
device available to the system.
======================================================================*/
-static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
- cisparse_t *parse)
-{
- int i = pcmcia_get_tuple_data(handle, tuple);
- if (i != CS_SUCCESS) return i;
- return pcmcia_parse_tuple(handle, tuple, parse);
-}
-
-static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
- cisparse_t *parse)
-{
- int i = pcmcia_get_first_tuple(handle, tuple);
- if (i != CS_SUCCESS) return i;
- return get_tuple(handle, tuple, parse);
-}
-static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
- cisparse_t *parse)
+static int teles_cs_configcheck(struct pcmcia_device *p_dev,
+ cistpl_cftable_entry_t *cf,
+ cistpl_cftable_entry_t *dflt,
+ unsigned int vcc,
+ void *priv_data)
{
- int i = pcmcia_get_next_tuple(handle, tuple);
- if (i != CS_SUCCESS) return i;
- return get_tuple(handle, tuple, parse);
+ int j;
+
+ if ((cf->io.nwin > 0) && cf->io.win[0].base) {
+ printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
+ p_dev->io.BasePort1 = cf->io.win[0].base;
+ if (!pcmcia_request_io(p_dev, &p_dev->io))
+ return 0;
+ } else {
+ printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
+ for (j = 0x2f0; j > 0x100; j -= 0x10) {
+ p_dev->io.BasePort1 = j;
+ if (!pcmcia_request_io(p_dev, &p_dev->io))
+ return 0;
+ }
+ }
+ return -ENODEV;
}
static int teles_cs_config(struct pcmcia_device *link)
{
- tuple_t tuple;
- cisparse_t parse;
local_info_t *dev;
- int i, j, last_fn;
- u_short buf[128];
- cistpl_cftable_entry_t *cf = &parse.cftable_entry;
+ int i, last_fn;
IsdnCard_t icard;
DEBUG(0, "teles_config(0x%p)\n", link);
dev = link->priv;
- tuple.TupleData = (cisdata_t *)buf;
- tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
- tuple.Attributes = 0;
- tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
- i = first_tuple(link, &tuple, &parse);
- while (i == CS_SUCCESS) {
- if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
- printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
- link->conf.ConfigIndex = cf->index;
- link->io.BasePort1 = cf->io.win[0].base;
- i = pcmcia_request_io(link, &link->io);
- if (i == CS_SUCCESS) break;
- } else {
- printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
- link->conf.ConfigIndex = cf->index;
- for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
- link->io.BasePort1 = j;
- i = pcmcia_request_io(link, &link->io);
- if (i == CS_SUCCESS) break;
- }
- break;
- }
- i = next_tuple(link, &tuple, &parse);
- }
-
- if (i != CS_SUCCESS) {
+ i = pcmcia_loop_config(link, teles_cs_configcheck, NULL);
+ if (i != 0) {
last_fn = RequestIO;
goto cs_failed;
}
i = pcmcia_request_irq(link, &link->irq);
- if (i != CS_SUCCESS) {
+ if (i != 0) {
link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ;
goto cs_failed;
}
i = pcmcia_request_configuration(link, &link->conf);
- if (i != CS_SUCCESS) {
+ if (i != 0) {
last_fn = RequestConfiguration;
goto cs_failed;
}