aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/btuart_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
commitfba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch)
tree5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/bluetooth/btuart_cs.c
parentfd238232cd0ff4840ae6946bb338502154096d88 (diff)
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/bluetooth/btuart_cs.c')
-rw-r--r--drivers/bluetooth/btuart_cs.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index cfe1d74a9185..594839061360 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -84,8 +84,8 @@ typedef struct btuart_info_t {
84} btuart_info_t; 84} btuart_info_t;
85 85
86 86
87static void btuart_config(dev_link_t *link); 87static void btuart_config(struct pcmcia_device *link);
88static void btuart_release(dev_link_t *link); 88static void btuart_release(struct pcmcia_device *link);
89 89
90static void btuart_detach(struct pcmcia_device *p_dev); 90static void btuart_detach(struct pcmcia_device *p_dev);
91 91
@@ -576,17 +576,16 @@ static int btuart_close(btuart_info_t *info)
576 return 0; 576 return 0;
577} 577}
578 578
579static int btuart_attach(struct pcmcia_device *p_dev) 579static int btuart_attach(struct pcmcia_device *link)
580{ 580{
581 btuart_info_t *info; 581 btuart_info_t *info;
582 dev_link_t *link = dev_to_instance(p_dev);
583 582
584 /* Create new info device */ 583 /* Create new info device */
585 info = kzalloc(sizeof(*info), GFP_KERNEL); 584 info = kzalloc(sizeof(*info), GFP_KERNEL);
586 if (!info) 585 if (!info)
587 return -ENOMEM; 586 return -ENOMEM;
588 587
589 info->p_dev = p_dev; 588 info->p_dev = link;
590 link->priv = info; 589 link->priv = info;
591 590
592 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 591 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -607,9 +606,8 @@ static int btuart_attach(struct pcmcia_device *p_dev)
607} 606}
608 607
609 608
610static void btuart_detach(struct pcmcia_device *p_dev) 609static void btuart_detach(struct pcmcia_device *link)
611{ 610{
612 dev_link_t *link = dev_to_instance(p_dev);
613 btuart_info_t *info = link->priv; 611 btuart_info_t *info = link->priv;
614 612
615 if (link->state & DEV_CONFIG) 613 if (link->state & DEV_CONFIG)
@@ -618,7 +616,7 @@ static void btuart_detach(struct pcmcia_device *p_dev)
618 kfree(info); 616 kfree(info);
619} 617}
620 618
621static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) 619static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
622{ 620{
623 int i; 621 int i;
624 622
@@ -629,24 +627,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
629 return pcmcia_parse_tuple(handle, tuple, parse); 627 return pcmcia_parse_tuple(handle, tuple, parse);
630} 628}
631 629
632static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) 630static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
633{ 631{
634 if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) 632 if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS)
635 return CS_NO_MORE_ITEMS; 633 return CS_NO_MORE_ITEMS;
636 return get_tuple(handle, tuple, parse); 634 return get_tuple(handle, tuple, parse);
637} 635}
638 636
639static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) 637static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
640{ 638{
641 if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) 639 if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS)
642 return CS_NO_MORE_ITEMS; 640 return CS_NO_MORE_ITEMS;
643 return get_tuple(handle, tuple, parse); 641 return get_tuple(handle, tuple, parse);
644} 642}
645 643
646static void btuart_config(dev_link_t *link) 644static void btuart_config(struct pcmcia_device *link)
647{ 645{
648 static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 646 static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
649 client_handle_t handle = link->handle;
650 btuart_info_t *info = link->priv; 647 btuart_info_t *info = link->priv;
651 tuple_t tuple; 648 tuple_t tuple;
652 u_short buf[256]; 649 u_short buf[256];
@@ -661,7 +658,7 @@ static void btuart_config(dev_link_t *link)
661 658
662 /* Get configuration register information */ 659 /* Get configuration register information */
663 tuple.DesiredTuple = CISTPL_CONFIG; 660 tuple.DesiredTuple = CISTPL_CONFIG;
664 last_ret = first_tuple(handle, &tuple, &parse); 661 last_ret = first_tuple(link, &tuple, &parse);
665 if (last_ret != CS_SUCCESS) { 662 if (last_ret != CS_SUCCESS) {
666 last_fn = ParseTuple; 663 last_fn = ParseTuple;
667 goto cs_failed; 664 goto cs_failed;
@@ -680,7 +677,7 @@ static void btuart_config(dev_link_t *link)
680 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 677 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
681 /* Two tries: without IO aliases, then with aliases */ 678 /* Two tries: without IO aliases, then with aliases */
682 for (try = 0; try < 2; try++) { 679 for (try = 0; try < 2; try++) {
683 i = first_tuple(handle, &tuple, &parse); 680 i = first_tuple(link, &tuple, &parse);
684 while (i != CS_NO_MORE_ITEMS) { 681 while (i != CS_NO_MORE_ITEMS) {
685 if (i != CS_SUCCESS) 682 if (i != CS_SUCCESS)
686 goto next_entry; 683 goto next_entry;
@@ -690,19 +687,19 @@ static void btuart_config(dev_link_t *link)
690 link->conf.ConfigIndex = cf->index; 687 link->conf.ConfigIndex = cf->index;
691 link->io.BasePort1 = cf->io.win[0].base; 688 link->io.BasePort1 = cf->io.win[0].base;
692 link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 689 link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
693 i = pcmcia_request_io(link->handle, &link->io); 690 i = pcmcia_request_io(link, &link->io);
694 if (i == CS_SUCCESS) 691 if (i == CS_SUCCESS)
695 goto found_port; 692 goto found_port;
696 } 693 }
697next_entry: 694next_entry:
698 i = next_tuple(handle, &tuple, &parse); 695 i = next_tuple(link, &tuple, &parse);
699 } 696 }
700 } 697 }
701 698
702 /* Second pass: try to find an entry that isn't picky about 699 /* Second pass: try to find an entry that isn't picky about
703 its base address, then try to grab any standard serial port 700 its base address, then try to grab any standard serial port
704 address, and finally try to get any free port. */ 701 address, and finally try to get any free port. */
705 i = first_tuple(handle, &tuple, &parse); 702 i = first_tuple(link, &tuple, &parse);
706 while (i != CS_NO_MORE_ITEMS) { 703 while (i != CS_NO_MORE_ITEMS) {
707 if ((i == CS_SUCCESS) && (cf->io.nwin > 0) 704 if ((i == CS_SUCCESS) && (cf->io.nwin > 0)
708 && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 705 && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
@@ -710,30 +707,30 @@ next_entry:
710 for (j = 0; j < 5; j++) { 707 for (j = 0; j < 5; j++) {
711 link->io.BasePort1 = base[j]; 708 link->io.BasePort1 = base[j];
712 link->io.IOAddrLines = base[j] ? 16 : 3; 709 link->io.IOAddrLines = base[j] ? 16 : 3;
713 i = pcmcia_request_io(link->handle, &link->io); 710 i = pcmcia_request_io(link, &link->io);
714 if (i == CS_SUCCESS) 711 if (i == CS_SUCCESS)
715 goto found_port; 712 goto found_port;
716 } 713 }
717 } 714 }
718 i = next_tuple(handle, &tuple, &parse); 715 i = next_tuple(link, &tuple, &parse);
719 } 716 }
720 717
721found_port: 718found_port:
722 if (i != CS_SUCCESS) { 719 if (i != CS_SUCCESS) {
723 BT_ERR("No usable port range found"); 720 BT_ERR("No usable port range found");
724 cs_error(link->handle, RequestIO, i); 721 cs_error(link, RequestIO, i);
725 goto failed; 722 goto failed;
726 } 723 }
727 724
728 i = pcmcia_request_irq(link->handle, &link->irq); 725 i = pcmcia_request_irq(link, &link->irq);
729 if (i != CS_SUCCESS) { 726 if (i != CS_SUCCESS) {
730 cs_error(link->handle, RequestIRQ, i); 727 cs_error(link, RequestIRQ, i);
731 link->irq.AssignedIRQ = 0; 728 link->irq.AssignedIRQ = 0;
732 } 729 }
733 730
734 i = pcmcia_request_configuration(link->handle, &link->conf); 731 i = pcmcia_request_configuration(link, &link->conf);
735 if (i != CS_SUCCESS) { 732 if (i != CS_SUCCESS) {
736 cs_error(link->handle, RequestConfiguration, i); 733 cs_error(link, RequestConfiguration, i);
737 goto failed; 734 goto failed;
738 } 735 }
739 736
@@ -747,21 +744,21 @@ found_port:
747 return; 744 return;
748 745
749cs_failed: 746cs_failed:
750 cs_error(link->handle, last_fn, last_ret); 747 cs_error(link, last_fn, last_ret);
751 748
752failed: 749failed:
753 btuart_release(link); 750 btuart_release(link);
754} 751}
755 752
756 753
757static void btuart_release(dev_link_t *link) 754static void btuart_release(struct pcmcia_device *link)
758{ 755{
759 btuart_info_t *info = link->priv; 756 btuart_info_t *info = link->priv;
760 757
761 if (link->state & DEV_PRESENT) 758 if (link->state & DEV_PRESENT)
762 btuart_close(info); 759 btuart_close(info);
763 760
764 pcmcia_disable_device(link->handle); 761 pcmcia_disable_device(link);
765} 762}
766 763
767static struct pcmcia_device_id btuart_ids[] = { 764static struct pcmcia_device_id btuart_ids[] = {