diff options
Diffstat (limited to 'drivers/bluetooth/dtl1_cs.c')
-rw-r--r-- | drivers/bluetooth/dtl1_cs.c | 62 |
1 files changed, 13 insertions, 49 deletions
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index dae45cdf02b2..e30a6332c6c6 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -590,66 +590,30 @@ static void dtl1_detach(struct pcmcia_device *link) | |||
590 | kfree(info); | 590 | kfree(info); |
591 | } | 591 | } |
592 | 592 | ||
593 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | 593 | static int dtl1_confcheck(struct pcmcia_device *p_dev, |
594 | cistpl_cftable_entry_t *cf, | ||
595 | void *priv_data) | ||
594 | { | 596 | { |
595 | int i; | 597 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { |
596 | 598 | p_dev->conf.ConfigIndex = cf->index; | |
597 | i = pcmcia_get_tuple_data(handle, tuple); | 599 | p_dev->io.BasePort1 = cf->io.win[0].base; |
598 | if (i != CS_SUCCESS) | 600 | p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */ |
599 | return i; | 601 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; |
600 | 602 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | |
601 | return pcmcia_parse_tuple(handle, tuple, parse); | 603 | return 0; |
602 | } | 604 | } |
603 | 605 | return -ENODEV; | |
604 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
605 | { | ||
606 | if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) | ||
607 | return CS_NO_MORE_ITEMS; | ||
608 | return get_tuple(handle, tuple, parse); | ||
609 | } | ||
610 | |||
611 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
612 | { | ||
613 | if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) | ||
614 | return CS_NO_MORE_ITEMS; | ||
615 | return get_tuple(handle, tuple, parse); | ||
616 | } | 606 | } |
617 | 607 | ||
618 | static int dtl1_config(struct pcmcia_device *link) | 608 | static int dtl1_config(struct pcmcia_device *link) |
619 | { | 609 | { |
620 | dtl1_info_t *info = link->priv; | 610 | dtl1_info_t *info = link->priv; |
621 | tuple_t tuple; | ||
622 | u_short buf[256]; | ||
623 | cisparse_t parse; | ||
624 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | ||
625 | int i; | 611 | int i; |
626 | 612 | ||
627 | tuple.TupleData = (cisdata_t *)buf; | ||
628 | tuple.TupleOffset = 0; | ||
629 | tuple.TupleDataMax = 255; | ||
630 | tuple.Attributes = 0; | ||
631 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
632 | |||
633 | /* Look for a generic full-sized window */ | 613 | /* Look for a generic full-sized window */ |
634 | link->io.NumPorts1 = 8; | 614 | link->io.NumPorts1 = 8; |
635 | i = first_tuple(link, &tuple, &parse); | 615 | if (!pcmcia_loop_config(link, dtl1_confcheck, NULL)) |
636 | while (i != CS_NO_MORE_ITEMS) { | ||
637 | if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { | ||
638 | link->conf.ConfigIndex = cf->index; | ||
639 | link->io.BasePort1 = cf->io.win[0].base; | ||
640 | link->io.NumPorts1 = cf->io.win[0].len; /*yo */ | ||
641 | link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | ||
642 | i = pcmcia_request_io(link, &link->io); | ||
643 | if (i == CS_SUCCESS) | ||
644 | break; | ||
645 | } | ||
646 | i = next_tuple(link, &tuple, &parse); | ||
647 | } | ||
648 | |||
649 | if (i != CS_SUCCESS) { | ||
650 | cs_error(link, RequestIO, i); | ||
651 | goto failed; | 616 | goto failed; |
652 | } | ||
653 | 617 | ||
654 | i = pcmcia_request_irq(link, &link->irq); | 618 | i = pcmcia_request_irq(link, &link->irq); |
655 | if (i != CS_SUCCESS) { | 619 | if (i != CS_SUCCESS) { |