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