aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/bcm203x.c1
-rw-r--r--drivers/bluetooth/bfusb.c1
-rw-r--r--drivers/bluetooth/bluecard_cs.c109
-rw-r--r--drivers/bluetooth/bpa10x.c1
-rw-r--r--drivers/bluetooth/bt3c_cs.c110
-rw-r--r--drivers/bluetooth/btuart_cs.c110
-rw-r--r--drivers/bluetooth/dtl1_cs.c111
-rw-r--r--drivers/bluetooth/hci_usb.c1
8 files changed, 124 insertions, 320 deletions
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c
index 8e7fb3551775..3e7a067cc087 100644
--- a/drivers/bluetooth/bcm203x.c
+++ b/drivers/bluetooth/bcm203x.c
@@ -275,7 +275,6 @@ static void bcm203x_disconnect(struct usb_interface *intf)
275} 275}
276 276
277static struct usb_driver bcm203x_driver = { 277static struct usb_driver bcm203x_driver = {
278 .owner = THIS_MODULE,
279 .name = "bcm203x", 278 .name = "bcm203x",
280 .probe = bcm203x_probe, 279 .probe = bcm203x_probe,
281 .disconnect = bcm203x_disconnect, 280 .disconnect = bcm203x_disconnect,
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 067e27893e4a..8947c8837dac 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -768,7 +768,6 @@ static void bfusb_disconnect(struct usb_interface *intf)
768} 768}
769 769
770static struct usb_driver bfusb_driver = { 770static struct usb_driver bfusb_driver = {
771 .owner = THIS_MODULE,
772 .name = "bfusb", 771 .name = "bfusb",
773 .probe = bfusb_probe, 772 .probe = bfusb_probe,
774 .disconnect = bfusb_disconnect, 773 .disconnect = bfusb_disconnect,
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index f36c563d72c4..9888bc151755 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -87,14 +87,8 @@ typedef struct bluecard_info_t {
87 87
88static void bluecard_config(dev_link_t *link); 88static void bluecard_config(dev_link_t *link);
89static void bluecard_release(dev_link_t *link); 89static void bluecard_release(dev_link_t *link);
90static int bluecard_event(event_t event, int priority, event_callback_args_t *args);
91 90
92static dev_info_t dev_info = "bluecard_cs"; 91static void bluecard_detach(struct pcmcia_device *p_dev);
93
94static dev_link_t *bluecard_attach(void);
95static void bluecard_detach(dev_link_t *);
96
97static dev_link_t *dev_list = NULL;
98 92
99 93
100/* Default baud rate: 57600, 115200, 230400 or 460800 */ 94/* Default baud rate: 57600, 115200, 230400 or 460800 */
@@ -862,17 +856,15 @@ static int bluecard_close(bluecard_info_t *info)
862 return 0; 856 return 0;
863} 857}
864 858
865static dev_link_t *bluecard_attach(void) 859static int bluecard_attach(struct pcmcia_device *p_dev)
866{ 860{
867 bluecard_info_t *info; 861 bluecard_info_t *info;
868 client_reg_t client_reg;
869 dev_link_t *link; 862 dev_link_t *link;
870 int ret;
871 863
872 /* Create new info device */ 864 /* Create new info device */
873 info = kzalloc(sizeof(*info), GFP_KERNEL); 865 info = kzalloc(sizeof(*info), GFP_KERNEL);
874 if (!info) 866 if (!info)
875 return NULL; 867 return -ENOMEM;
876 868
877 link = &info->link; 869 link = &info->link;
878 link->priv = info; 870 link->priv = info;
@@ -889,50 +881,24 @@ static dev_link_t *bluecard_attach(void)
889 link->conf.Vcc = 50; 881 link->conf.Vcc = 50;
890 link->conf.IntType = INT_MEMORY_AND_IO; 882 link->conf.IntType = INT_MEMORY_AND_IO;
891 883
892 /* Register with Card Services */ 884 link->handle = p_dev;
893 link->next = dev_list; 885 p_dev->instance = link;
894 dev_list = link;
895 client_reg.dev_info = &dev_info;
896 client_reg.Version = 0x0210;
897 client_reg.event_callback_args.client_data = link;
898
899 ret = pcmcia_register_client(&link->handle, &client_reg);
900 if (ret != CS_SUCCESS) {
901 cs_error(link->handle, RegisterClient, ret);
902 bluecard_detach(link);
903 return NULL;
904 }
905 886
906 return link; 887 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
888 bluecard_config(link);
889
890 return 0;
907} 891}
908 892
909 893
910static void bluecard_detach(dev_link_t *link) 894static void bluecard_detach(struct pcmcia_device *p_dev)
911{ 895{
896 dev_link_t *link = dev_to_instance(p_dev);
912 bluecard_info_t *info = link->priv; 897 bluecard_info_t *info = link->priv;
913 dev_link_t **linkp;
914 int ret;
915
916 /* Locate device structure */
917 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
918 if (*linkp == link)
919 break;
920
921 if (*linkp == NULL)
922 return;
923 898
924 if (link->state & DEV_CONFIG) 899 if (link->state & DEV_CONFIG)
925 bluecard_release(link); 900 bluecard_release(link);
926 901
927 if (link->handle) {
928 ret = pcmcia_deregister_client(link->handle);
929 if (ret != CS_SUCCESS)
930 cs_error(link->handle, DeregisterClient, ret);
931 }
932
933 /* Unlink device structure, free bits */
934 *linkp = link->next;
935
936 kfree(info); 902 kfree(info);
937} 903}
938 904
@@ -1045,39 +1011,24 @@ static void bluecard_release(dev_link_t *link)
1045 link->state &= ~DEV_CONFIG; 1011 link->state &= ~DEV_CONFIG;
1046} 1012}
1047 1013
1014static int bluecard_suspend(struct pcmcia_device *dev)
1015{
1016 dev_link_t *link = dev_to_instance(dev);
1017
1018 link->state |= DEV_SUSPEND;
1019 if (link->state & DEV_CONFIG)
1020 pcmcia_release_configuration(link->handle);
1048 1021
1049static int bluecard_event(event_t event, int priority, event_callback_args_t *args) 1022 return 0;
1023}
1024
1025static int bluecard_resume(struct pcmcia_device *dev)
1050{ 1026{
1051 dev_link_t *link = args->client_data; 1027 dev_link_t *link = dev_to_instance(dev);
1052 bluecard_info_t *info = link->priv;
1053 1028
1054 switch (event) { 1029 link->state &= ~DEV_SUSPEND;
1055 case CS_EVENT_CARD_REMOVAL: 1030 if (DEV_OK(link))
1056 link->state &= ~DEV_PRESENT; 1031 pcmcia_request_configuration(link->handle, &link->conf);
1057 if (link->state & DEV_CONFIG) {
1058 bluecard_close(info);
1059 bluecard_release(link);
1060 }
1061 break;
1062 case CS_EVENT_CARD_INSERTION:
1063 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1064 bluecard_config(link);
1065 break;
1066 case CS_EVENT_PM_SUSPEND:
1067 link->state |= DEV_SUSPEND;
1068 /* Fall through... */
1069 case CS_EVENT_RESET_PHYSICAL:
1070 if (link->state & DEV_CONFIG)
1071 pcmcia_release_configuration(link->handle);
1072 break;
1073 case CS_EVENT_PM_RESUME:
1074 link->state &= ~DEV_SUSPEND;
1075 /* Fall through... */
1076 case CS_EVENT_CARD_RESET:
1077 if (DEV_OK(link))
1078 pcmcia_request_configuration(link->handle, &link->conf);
1079 break;
1080 }
1081 1032
1082 return 0; 1033 return 0;
1083} 1034}
@@ -1095,10 +1046,11 @@ static struct pcmcia_driver bluecard_driver = {
1095 .drv = { 1046 .drv = {
1096 .name = "bluecard_cs", 1047 .name = "bluecard_cs",
1097 }, 1048 },
1098 .attach = bluecard_attach, 1049 .probe = bluecard_attach,
1099 .event = bluecard_event, 1050 .remove = bluecard_detach,
1100 .detach = bluecard_detach,
1101 .id_table = bluecard_ids, 1051 .id_table = bluecard_ids,
1052 .suspend = bluecard_suspend,
1053 .resume = bluecard_resume,
1102}; 1054};
1103 1055
1104static int __init init_bluecard_cs(void) 1056static int __init init_bluecard_cs(void)
@@ -1110,7 +1062,6 @@ static int __init init_bluecard_cs(void)
1110static void __exit exit_bluecard_cs(void) 1062static void __exit exit_bluecard_cs(void)
1111{ 1063{
1112 pcmcia_unregister_driver(&bluecard_driver); 1064 pcmcia_unregister_driver(&bluecard_driver);
1113 BUG_ON(dev_list != NULL);
1114} 1065}
1115 1066
1116module_init(init_bluecard_cs); 1067module_init(init_bluecard_cs);
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 394796315adc..9446960ac742 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -619,7 +619,6 @@ static void bpa10x_disconnect(struct usb_interface *intf)
619} 619}
620 620
621static struct usb_driver bpa10x_driver = { 621static struct usb_driver bpa10x_driver = {
622 .owner = THIS_MODULE,
623 .name = "bpa10x", 622 .name = "bpa10x",
624 .probe = bpa10x_probe, 623 .probe = bpa10x_probe,
625 .disconnect = bpa10x_disconnect, 624 .disconnect = bpa10x_disconnect,
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index d2a0add19cc8..e522d19ad886 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -90,14 +90,8 @@ typedef struct bt3c_info_t {
90 90
91static void bt3c_config(dev_link_t *link); 91static void bt3c_config(dev_link_t *link);
92static void bt3c_release(dev_link_t *link); 92static void bt3c_release(dev_link_t *link);
93static int bt3c_event(event_t event, int priority, event_callback_args_t *args);
94 93
95static dev_info_t dev_info = "bt3c_cs"; 94static void bt3c_detach(struct pcmcia_device *p_dev);
96
97static dev_link_t *bt3c_attach(void);
98static void bt3c_detach(dev_link_t *);
99
100static dev_link_t *dev_list = NULL;
101 95
102 96
103/* Transmit states */ 97/* Transmit states */
@@ -663,17 +657,15 @@ static int bt3c_close(bt3c_info_t *info)
663 return 0; 657 return 0;
664} 658}
665 659
666static dev_link_t *bt3c_attach(void) 660static int bt3c_attach(struct pcmcia_device *p_dev)
667{ 661{
668 bt3c_info_t *info; 662 bt3c_info_t *info;
669 client_reg_t client_reg;
670 dev_link_t *link; 663 dev_link_t *link;
671 int ret;
672 664
673 /* Create new info device */ 665 /* Create new info device */
674 info = kzalloc(sizeof(*info), GFP_KERNEL); 666 info = kzalloc(sizeof(*info), GFP_KERNEL);
675 if (!info) 667 if (!info)
676 return NULL; 668 return -ENOMEM;
677 669
678 link = &info->link; 670 link = &info->link;
679 link->priv = info; 671 link->priv = info;
@@ -690,50 +682,24 @@ static dev_link_t *bt3c_attach(void)
690 link->conf.Vcc = 50; 682 link->conf.Vcc = 50;
691 link->conf.IntType = INT_MEMORY_AND_IO; 683 link->conf.IntType = INT_MEMORY_AND_IO;
692 684
693 /* Register with Card Services */ 685 link->handle = p_dev;
694 link->next = dev_list; 686 p_dev->instance = link;
695 dev_list = link;
696 client_reg.dev_info = &dev_info;
697 client_reg.Version = 0x0210;
698 client_reg.event_callback_args.client_data = link;
699
700 ret = pcmcia_register_client(&link->handle, &client_reg);
701 if (ret != CS_SUCCESS) {
702 cs_error(link->handle, RegisterClient, ret);
703 bt3c_detach(link);
704 return NULL;
705 }
706 687
707 return link; 688 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
689 bt3c_config(link);
690
691 return 0;
708} 692}
709 693
710 694
711static void bt3c_detach(dev_link_t *link) 695static void bt3c_detach(struct pcmcia_device *p_dev)
712{ 696{
697 dev_link_t *link = dev_to_instance(p_dev);
713 bt3c_info_t *info = link->priv; 698 bt3c_info_t *info = link->priv;
714 dev_link_t **linkp;
715 int ret;
716
717 /* Locate device structure */
718 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
719 if (*linkp == link)
720 break;
721
722 if (*linkp == NULL)
723 return;
724 699
725 if (link->state & DEV_CONFIG) 700 if (link->state & DEV_CONFIG)
726 bt3c_release(link); 701 bt3c_release(link);
727 702
728 if (link->handle) {
729 ret = pcmcia_deregister_client(link->handle);
730 if (ret != CS_SUCCESS)
731 cs_error(link->handle, DeregisterClient, ret);
732 }
733
734 /* Unlink device structure, free bits */
735 *linkp = link->next;
736
737 kfree(info); 703 kfree(info);
738} 704}
739 705
@@ -891,43 +857,29 @@ static void bt3c_release(dev_link_t *link)
891 link->state &= ~DEV_CONFIG; 857 link->state &= ~DEV_CONFIG;
892} 858}
893 859
860static int bt3c_suspend(struct pcmcia_device *dev)
861{
862 dev_link_t *link = dev_to_instance(dev);
894 863
895static int bt3c_event(event_t event, int priority, event_callback_args_t *args) 864 link->state |= DEV_SUSPEND;
865 if (link->state & DEV_CONFIG)
866 pcmcia_release_configuration(link->handle);
867
868 return 0;
869}
870
871static int bt3c_resume(struct pcmcia_device *dev)
896{ 872{
897 dev_link_t *link = args->client_data; 873 dev_link_t *link = dev_to_instance(dev);
898 bt3c_info_t *info = link->priv;
899 874
900 switch (event) { 875 link->state &= ~DEV_SUSPEND;
901 case CS_EVENT_CARD_REMOVAL: 876 if (DEV_OK(link))
902 link->state &= ~DEV_PRESENT; 877 pcmcia_request_configuration(link->handle, &link->conf);
903 if (link->state & DEV_CONFIG) {
904 bt3c_close(info);
905 bt3c_release(link);
906 }
907 break;
908 case CS_EVENT_CARD_INSERTION:
909 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
910 bt3c_config(link);
911 break;
912 case CS_EVENT_PM_SUSPEND:
913 link->state |= DEV_SUSPEND;
914 /* Fall through... */
915 case CS_EVENT_RESET_PHYSICAL:
916 if (link->state & DEV_CONFIG)
917 pcmcia_release_configuration(link->handle);
918 break;
919 case CS_EVENT_PM_RESUME:
920 link->state &= ~DEV_SUSPEND;
921 /* Fall through... */
922 case CS_EVENT_CARD_RESET:
923 if (DEV_OK(link))
924 pcmcia_request_configuration(link->handle, &link->conf);
925 break;
926 }
927 878
928 return 0; 879 return 0;
929} 880}
930 881
882
931static struct pcmcia_device_id bt3c_ids[] = { 883static struct pcmcia_device_id bt3c_ids[] = {
932 PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02), 884 PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02),
933 PCMCIA_DEVICE_NULL 885 PCMCIA_DEVICE_NULL
@@ -939,10 +891,11 @@ static struct pcmcia_driver bt3c_driver = {
939 .drv = { 891 .drv = {
940 .name = "bt3c_cs", 892 .name = "bt3c_cs",
941 }, 893 },
942 .attach = bt3c_attach, 894 .probe = bt3c_attach,
943 .event = bt3c_event, 895 .remove = bt3c_detach,
944 .detach = bt3c_detach,
945 .id_table = bt3c_ids, 896 .id_table = bt3c_ids,
897 .suspend = bt3c_suspend,
898 .resume = bt3c_resume,
946}; 899};
947 900
948static int __init init_bt3c_cs(void) 901static int __init init_bt3c_cs(void)
@@ -954,7 +907,6 @@ static int __init init_bt3c_cs(void)
954static void __exit exit_bt3c_cs(void) 907static void __exit exit_bt3c_cs(void)
955{ 908{
956 pcmcia_unregister_driver(&bt3c_driver); 909 pcmcia_unregister_driver(&bt3c_driver);
957 BUG_ON(dev_list != NULL);
958} 910}
959 911
960module_init(init_bt3c_cs); 912module_init(init_bt3c_cs);
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 529a28a3209d..7b4bff4cfa2d 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -86,14 +86,8 @@ typedef struct btuart_info_t {
86 86
87static void btuart_config(dev_link_t *link); 87static void btuart_config(dev_link_t *link);
88static void btuart_release(dev_link_t *link); 88static void btuart_release(dev_link_t *link);
89static int btuart_event(event_t event, int priority, event_callback_args_t *args);
90 89
91static dev_info_t dev_info = "btuart_cs"; 90static void btuart_detach(struct pcmcia_device *p_dev);
92
93static dev_link_t *btuart_attach(void);
94static void btuart_detach(dev_link_t *);
95
96static dev_link_t *dev_list = NULL;
97 91
98 92
99/* Maximum baud rate */ 93/* Maximum baud rate */
@@ -582,17 +576,15 @@ static int btuart_close(btuart_info_t *info)
582 return 0; 576 return 0;
583} 577}
584 578
585static dev_link_t *btuart_attach(void) 579static int btuart_attach(struct pcmcia_device *p_dev)
586{ 580{
587 btuart_info_t *info; 581 btuart_info_t *info;
588 client_reg_t client_reg;
589 dev_link_t *link; 582 dev_link_t *link;
590 int ret;
591 583
592 /* Create new info device */ 584 /* Create new info device */
593 info = kzalloc(sizeof(*info), GFP_KERNEL); 585 info = kzalloc(sizeof(*info), GFP_KERNEL);
594 if (!info) 586 if (!info)
595 return NULL; 587 return -ENOMEM;
596 588
597 link = &info->link; 589 link = &info->link;
598 link->priv = info; 590 link->priv = info;
@@ -609,50 +601,24 @@ static dev_link_t *btuart_attach(void)
609 link->conf.Vcc = 50; 601 link->conf.Vcc = 50;
610 link->conf.IntType = INT_MEMORY_AND_IO; 602 link->conf.IntType = INT_MEMORY_AND_IO;
611 603
612 /* Register with Card Services */ 604 link->handle = p_dev;
613 link->next = dev_list; 605 p_dev->instance = link;
614 dev_list = link;
615 client_reg.dev_info = &dev_info;
616 client_reg.Version = 0x0210;
617 client_reg.event_callback_args.client_data = link;
618
619 ret = pcmcia_register_client(&link->handle, &client_reg);
620 if (ret != CS_SUCCESS) {
621 cs_error(link->handle, RegisterClient, ret);
622 btuart_detach(link);
623 return NULL;
624 }
625 606
626 return link; 607 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
608 btuart_config(link);
609
610 return 0;
627} 611}
628 612
629 613
630static void btuart_detach(dev_link_t *link) 614static void btuart_detach(struct pcmcia_device *p_dev)
631{ 615{
616 dev_link_t *link = dev_to_instance(p_dev);
632 btuart_info_t *info = link->priv; 617 btuart_info_t *info = link->priv;
633 dev_link_t **linkp;
634 int ret;
635
636 /* Locate device structure */
637 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
638 if (*linkp == link)
639 break;
640
641 if (*linkp == NULL)
642 return;
643 618
644 if (link->state & DEV_CONFIG) 619 if (link->state & DEV_CONFIG)
645 btuart_release(link); 620 btuart_release(link);
646 621
647 if (link->handle) {
648 ret = pcmcia_deregister_client(link->handle);
649 if (ret != CS_SUCCESS)
650 cs_error(link->handle, DeregisterClient, ret);
651 }
652
653 /* Unlink device structure, free bits */
654 *linkp = link->next;
655
656 kfree(info); 622 kfree(info);
657} 623}
658 624
@@ -811,43 +777,29 @@ static void btuart_release(dev_link_t *link)
811 link->state &= ~DEV_CONFIG; 777 link->state &= ~DEV_CONFIG;
812} 778}
813 779
780static int btuart_suspend(struct pcmcia_device *dev)
781{
782 dev_link_t *link = dev_to_instance(dev);
814 783
815static int btuart_event(event_t event, int priority, event_callback_args_t *args) 784 link->state |= DEV_SUSPEND;
785 if (link->state & DEV_CONFIG)
786 pcmcia_release_configuration(link->handle);
787
788 return 0;
789}
790
791static int btuart_resume(struct pcmcia_device *dev)
816{ 792{
817 dev_link_t *link = args->client_data; 793 dev_link_t *link = dev_to_instance(dev);
818 btuart_info_t *info = link->priv;
819 794
820 switch (event) { 795 link->state &= ~DEV_SUSPEND;
821 case CS_EVENT_CARD_REMOVAL: 796 if (DEV_OK(link))
822 link->state &= ~DEV_PRESENT; 797 pcmcia_request_configuration(link->handle, &link->conf);
823 if (link->state & DEV_CONFIG) {
824 btuart_close(info);
825 btuart_release(link);
826 }
827 break;
828 case CS_EVENT_CARD_INSERTION:
829 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
830 btuart_config(link);
831 break;
832 case CS_EVENT_PM_SUSPEND:
833 link->state |= DEV_SUSPEND;
834 /* Fall through... */
835 case CS_EVENT_RESET_PHYSICAL:
836 if (link->state & DEV_CONFIG)
837 pcmcia_release_configuration(link->handle);
838 break;
839 case CS_EVENT_PM_RESUME:
840 link->state &= ~DEV_SUSPEND;
841 /* Fall through... */
842 case CS_EVENT_CARD_RESET:
843 if (DEV_OK(link))
844 pcmcia_request_configuration(link->handle, &link->conf);
845 break;
846 }
847 798
848 return 0; 799 return 0;
849} 800}
850 801
802
851static struct pcmcia_device_id btuart_ids[] = { 803static struct pcmcia_device_id btuart_ids[] = {
852 /* don't use this driver. Use serial_cs + hci_uart instead */ 804 /* don't use this driver. Use serial_cs + hci_uart instead */
853 PCMCIA_DEVICE_NULL 805 PCMCIA_DEVICE_NULL
@@ -859,10 +811,11 @@ static struct pcmcia_driver btuart_driver = {
859 .drv = { 811 .drv = {
860 .name = "btuart_cs", 812 .name = "btuart_cs",
861 }, 813 },
862 .attach = btuart_attach, 814 .probe = btuart_attach,
863 .event = btuart_event, 815 .remove = btuart_detach,
864 .detach = btuart_detach,
865 .id_table = btuart_ids, 816 .id_table = btuart_ids,
817 .suspend = btuart_suspend,
818 .resume = btuart_resume,
866}; 819};
867 820
868static int __init init_btuart_cs(void) 821static int __init init_btuart_cs(void)
@@ -874,7 +827,6 @@ static int __init init_btuart_cs(void)
874static void __exit exit_btuart_cs(void) 827static void __exit exit_btuart_cs(void)
875{ 828{
876 pcmcia_unregister_driver(&btuart_driver); 829 pcmcia_unregister_driver(&btuart_driver);
877 BUG_ON(dev_list != NULL);
878} 830}
879 831
880module_init(init_btuart_cs); 832module_init(init_btuart_cs);
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index dec5980a1cd6..0449bc45ae5e 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -89,14 +89,8 @@ typedef struct dtl1_info_t {
89 89
90static void dtl1_config(dev_link_t *link); 90static void dtl1_config(dev_link_t *link);
91static void dtl1_release(dev_link_t *link); 91static void dtl1_release(dev_link_t *link);
92static int dtl1_event(event_t event, int priority, event_callback_args_t *args);
93 92
94static dev_info_t dev_info = "dtl1_cs"; 93static void dtl1_detach(struct pcmcia_device *p_dev);
95
96static dev_link_t *dtl1_attach(void);
97static void dtl1_detach(dev_link_t *);
98
99static dev_link_t *dev_list = NULL;
100 94
101 95
102/* Transmit states */ 96/* Transmit states */
@@ -561,17 +555,15 @@ static int dtl1_close(dtl1_info_t *info)
561 return 0; 555 return 0;
562} 556}
563 557
564static dev_link_t *dtl1_attach(void) 558static int dtl1_attach(struct pcmcia_device *p_dev)
565{ 559{
566 dtl1_info_t *info; 560 dtl1_info_t *info;
567 client_reg_t client_reg;
568 dev_link_t *link; 561 dev_link_t *link;
569 int ret;
570 562
571 /* Create new info device */ 563 /* Create new info device */
572 info = kzalloc(sizeof(*info), GFP_KERNEL); 564 info = kzalloc(sizeof(*info), GFP_KERNEL);
573 if (!info) 565 if (!info)
574 return NULL; 566 return -ENOMEM;
575 567
576 link = &info->link; 568 link = &info->link;
577 link->priv = info; 569 link->priv = info;
@@ -588,50 +580,24 @@ static dev_link_t *dtl1_attach(void)
588 link->conf.Vcc = 50; 580 link->conf.Vcc = 50;
589 link->conf.IntType = INT_MEMORY_AND_IO; 581 link->conf.IntType = INT_MEMORY_AND_IO;
590 582
591 /* Register with Card Services */ 583 link->handle = p_dev;
592 link->next = dev_list; 584 p_dev->instance = link;
593 dev_list = link;
594 client_reg.dev_info = &dev_info;
595 client_reg.Version = 0x0210;
596 client_reg.event_callback_args.client_data = link;
597
598 ret = pcmcia_register_client(&link->handle, &client_reg);
599 if (ret != CS_SUCCESS) {
600 cs_error(link->handle, RegisterClient, ret);
601 dtl1_detach(link);
602 return NULL;
603 }
604 585
605 return link; 586 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
587 dtl1_config(link);
588
589 return 0;
606} 590}
607 591
608 592
609static void dtl1_detach(dev_link_t *link) 593static void dtl1_detach(struct pcmcia_device *p_dev)
610{ 594{
595 dev_link_t *link = dev_to_instance(p_dev);
611 dtl1_info_t *info = link->priv; 596 dtl1_info_t *info = link->priv;
612 dev_link_t **linkp;
613 int ret;
614
615 /* Locate device structure */
616 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
617 if (*linkp == link)
618 break;
619
620 if (*linkp == NULL)
621 return;
622 597
623 if (link->state & DEV_CONFIG) 598 if (link->state & DEV_CONFIG)
624 dtl1_release(link); 599 dtl1_release(link);
625 600
626 if (link->handle) {
627 ret = pcmcia_deregister_client(link->handle);
628 if (ret != CS_SUCCESS)
629 cs_error(link->handle, DeregisterClient, ret);
630 }
631
632 /* Unlink device structure, free bits */
633 *linkp = link->next;
634
635 kfree(info); 601 kfree(info);
636} 602}
637 603
@@ -763,46 +729,33 @@ static void dtl1_release(dev_link_t *link)
763 link->state &= ~DEV_CONFIG; 729 link->state &= ~DEV_CONFIG;
764} 730}
765 731
732static int dtl1_suspend(struct pcmcia_device *dev)
733{
734 dev_link_t *link = dev_to_instance(dev);
766 735
767static int dtl1_event(event_t event, int priority, event_callback_args_t *args) 736 link->state |= DEV_SUSPEND;
737 if (link->state & DEV_CONFIG)
738 pcmcia_release_configuration(link->handle);
739
740 return 0;
741}
742
743static int dtl1_resume(struct pcmcia_device *dev)
768{ 744{
769 dev_link_t *link = args->client_data; 745 dev_link_t *link = dev_to_instance(dev);
770 dtl1_info_t *info = link->priv;
771 746
772 switch (event) { 747 link->state &= ~DEV_SUSPEND;
773 case CS_EVENT_CARD_REMOVAL: 748 if (DEV_OK(link))
774 link->state &= ~DEV_PRESENT; 749 pcmcia_request_configuration(link->handle, &link->conf);
775 if (link->state & DEV_CONFIG) {
776 dtl1_close(info);
777 dtl1_release(link);
778 }
779 break;
780 case CS_EVENT_CARD_INSERTION:
781 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
782 dtl1_config(link);
783 break;
784 case CS_EVENT_PM_SUSPEND:
785 link->state |= DEV_SUSPEND;
786 /* Fall through... */
787 case CS_EVENT_RESET_PHYSICAL:
788 if (link->state & DEV_CONFIG)
789 pcmcia_release_configuration(link->handle);
790 break;
791 case CS_EVENT_PM_RESUME:
792 link->state &= ~DEV_SUSPEND;
793 /* Fall through... */
794 case CS_EVENT_CARD_RESET:
795 if (DEV_OK(link))
796 pcmcia_request_configuration(link->handle, &link->conf);
797 break;
798 }
799 750
800 return 0; 751 return 0;
801} 752}
802 753
754
803static struct pcmcia_device_id dtl1_ids[] = { 755static struct pcmcia_device_id dtl1_ids[] = {
804 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), 756 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
805 PCMCIA_DEVICE_PROD_ID12("Socket", "CF", 0xb38bcc2e, 0x44ebf863), 757 PCMCIA_DEVICE_PROD_ID12("Socket", "CF", 0xb38bcc2e, 0x44ebf863),
758 PCMCIA_DEVICE_PROD_ID12("Socket", "CF+ Personal Network Card", 0xb38bcc2e, 0xe732bae3),
806 PCMCIA_DEVICE_NULL 759 PCMCIA_DEVICE_NULL
807}; 760};
808MODULE_DEVICE_TABLE(pcmcia, dtl1_ids); 761MODULE_DEVICE_TABLE(pcmcia, dtl1_ids);
@@ -812,10 +765,11 @@ static struct pcmcia_driver dtl1_driver = {
812 .drv = { 765 .drv = {
813 .name = "dtl1_cs", 766 .name = "dtl1_cs",
814 }, 767 },
815 .attach = dtl1_attach, 768 .probe = dtl1_attach,
816 .event = dtl1_event, 769 .remove = dtl1_detach,
817 .detach = dtl1_detach,
818 .id_table = dtl1_ids, 770 .id_table = dtl1_ids,
771 .suspend = dtl1_suspend,
772 .resume = dtl1_resume,
819}; 773};
820 774
821static int __init init_dtl1_cs(void) 775static int __init init_dtl1_cs(void)
@@ -827,7 +781,6 @@ static int __init init_dtl1_cs(void)
827static void __exit exit_dtl1_cs(void) 781static void __exit exit_dtl1_cs(void)
828{ 782{
829 pcmcia_unregister_driver(&dtl1_driver); 783 pcmcia_unregister_driver(&dtl1_driver);
830 BUG_ON(dev_list != NULL);
831} 784}
832 785
833module_init(init_dtl1_cs); 786module_init(init_dtl1_cs);
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 057cb2b6e6d1..92382e823285 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -1044,7 +1044,6 @@ static void hci_usb_disconnect(struct usb_interface *intf)
1044} 1044}
1045 1045
1046static struct usb_driver hci_usb_driver = { 1046static struct usb_driver hci_usb_driver = {
1047 .owner = THIS_MODULE,
1048 .name = "hci_usb", 1047 .name = "hci_usb",
1049 .probe = hci_usb_probe, 1048 .probe = hci_usb_probe,
1050 .disconnect = hci_usb_disconnect, 1049 .disconnect = hci_usb_disconnect,