aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:23:14 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:10 -0500
commitcc3b4866bee996c922e875b8c8efe9f0d8803aae (patch)
tree6632837b6986f33566f75ed971cecbdc210e3201 /drivers/bluetooth
parent8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (diff)
[PATCH] pcmcia: unify detach, REMOVAL_EVENT handlers into one remove callback
Unify the "detach" and REMOVAL_EVENT handlers to one "remove" function. Old functionality is preserved, for the moment. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/bluecard_cs.c24
-rw-r--r--drivers/bluetooth/bt3c_cs.c24
-rw-r--r--drivers/bluetooth/btuart_cs.c24
-rw-r--r--drivers/bluetooth/dtl1_cs.c24
4 files changed, 20 insertions, 76 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 5b24131e5430..f5088cb3812b 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -92,7 +92,7 @@ static int bluecard_event(event_t event, int priority, event_callback_args_t *ar
92static dev_info_t dev_info = "bluecard_cs"; 92static dev_info_t dev_info = "bluecard_cs";
93 93
94static dev_link_t *bluecard_attach(void); 94static dev_link_t *bluecard_attach(void);
95static void bluecard_detach(dev_link_t *); 95static void bluecard_detach(struct pcmcia_device *p_dev);
96 96
97static dev_link_t *dev_list = NULL; 97static dev_link_t *dev_list = NULL;
98 98
@@ -899,7 +899,7 @@ static dev_link_t *bluecard_attach(void)
899 ret = pcmcia_register_client(&link->handle, &client_reg); 899 ret = pcmcia_register_client(&link->handle, &client_reg);
900 if (ret != CS_SUCCESS) { 900 if (ret != CS_SUCCESS) {
901 cs_error(link->handle, RegisterClient, ret); 901 cs_error(link->handle, RegisterClient, ret);
902 bluecard_detach(link); 902 bluecard_detach(link->handle);
903 return NULL; 903 return NULL;
904 } 904 }
905 905
@@ -907,11 +907,11 @@ static dev_link_t *bluecard_attach(void)
907} 907}
908 908
909 909
910static void bluecard_detach(dev_link_t *link) 910static void bluecard_detach(struct pcmcia_device *p_dev)
911{ 911{
912 dev_link_t *link = dev_to_instance(p_dev);
912 bluecard_info_t *info = link->priv; 913 bluecard_info_t *info = link->priv;
913 dev_link_t **linkp; 914 dev_link_t **linkp;
914 int ret;
915 915
916 /* Locate device structure */ 916 /* Locate device structure */
917 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 917 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -924,12 +924,6 @@ static void bluecard_detach(dev_link_t *link)
924 if (link->state & DEV_CONFIG) 924 if (link->state & DEV_CONFIG)
925 bluecard_release(link); 925 bluecard_release(link);
926 926
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 */ 927 /* Unlink device structure, free bits */
934 *linkp = link->next; 928 *linkp = link->next;
935 929
@@ -1070,16 +1064,8 @@ static int bluecard_resume(struct pcmcia_device *dev)
1070static int bluecard_event(event_t event, int priority, event_callback_args_t *args) 1064static int bluecard_event(event_t event, int priority, event_callback_args_t *args)
1071{ 1065{
1072 dev_link_t *link = args->client_data; 1066 dev_link_t *link = args->client_data;
1073 bluecard_info_t *info = link->priv;
1074 1067
1075 switch (event) { 1068 switch (event) {
1076 case CS_EVENT_CARD_REMOVAL:
1077 link->state &= ~DEV_PRESENT;
1078 if (link->state & DEV_CONFIG) {
1079 bluecard_close(info);
1080 bluecard_release(link);
1081 }
1082 break;
1083 case CS_EVENT_CARD_INSERTION: 1069 case CS_EVENT_CARD_INSERTION:
1084 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1070 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1085 bluecard_config(link); 1071 bluecard_config(link);
@@ -1104,7 +1090,7 @@ static struct pcmcia_driver bluecard_driver = {
1104 }, 1090 },
1105 .attach = bluecard_attach, 1091 .attach = bluecard_attach,
1106 .event = bluecard_event, 1092 .event = bluecard_event,
1107 .detach = bluecard_detach, 1093 .remove = bluecard_detach,
1108 .id_table = bluecard_ids, 1094 .id_table = bluecard_ids,
1109 .suspend = bluecard_suspend, 1095 .suspend = bluecard_suspend,
1110 .resume = bluecard_resume, 1096 .resume = bluecard_resume,
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 1d524baa24a0..02ce38e33d32 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -95,7 +95,7 @@ static int bt3c_event(event_t event, int priority, event_callback_args_t *args);
95static dev_info_t dev_info = "bt3c_cs"; 95static dev_info_t dev_info = "bt3c_cs";
96 96
97static dev_link_t *bt3c_attach(void); 97static dev_link_t *bt3c_attach(void);
98static void bt3c_detach(dev_link_t *); 98static void bt3c_detach(struct pcmcia_device *p_dev);
99 99
100static dev_link_t *dev_list = NULL; 100static dev_link_t *dev_list = NULL;
101 101
@@ -700,7 +700,7 @@ static dev_link_t *bt3c_attach(void)
700 ret = pcmcia_register_client(&link->handle, &client_reg); 700 ret = pcmcia_register_client(&link->handle, &client_reg);
701 if (ret != CS_SUCCESS) { 701 if (ret != CS_SUCCESS) {
702 cs_error(link->handle, RegisterClient, ret); 702 cs_error(link->handle, RegisterClient, ret);
703 bt3c_detach(link); 703 bt3c_detach(link->handle);
704 return NULL; 704 return NULL;
705 } 705 }
706 706
@@ -708,11 +708,11 @@ static dev_link_t *bt3c_attach(void)
708} 708}
709 709
710 710
711static void bt3c_detach(dev_link_t *link) 711static void bt3c_detach(struct pcmcia_device *p_dev)
712{ 712{
713 dev_link_t *link = dev_to_instance(p_dev);
713 bt3c_info_t *info = link->priv; 714 bt3c_info_t *info = link->priv;
714 dev_link_t **linkp; 715 dev_link_t **linkp;
715 int ret;
716 716
717 /* Locate device structure */ 717 /* Locate device structure */
718 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 718 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -725,12 +725,6 @@ static void bt3c_detach(dev_link_t *link)
725 if (link->state & DEV_CONFIG) 725 if (link->state & DEV_CONFIG)
726 bt3c_release(link); 726 bt3c_release(link);
727 727
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 */ 728 /* Unlink device structure, free bits */
735 *linkp = link->next; 729 *linkp = link->next;
736 730
@@ -916,16 +910,8 @@ static int bt3c_resume(struct pcmcia_device *dev)
916static int bt3c_event(event_t event, int priority, event_callback_args_t *args) 910static int bt3c_event(event_t event, int priority, event_callback_args_t *args)
917{ 911{
918 dev_link_t *link = args->client_data; 912 dev_link_t *link = args->client_data;
919 bt3c_info_t *info = link->priv;
920 913
921 switch (event) { 914 switch (event) {
922 case CS_EVENT_CARD_REMOVAL:
923 link->state &= ~DEV_PRESENT;
924 if (link->state & DEV_CONFIG) {
925 bt3c_close(info);
926 bt3c_release(link);
927 }
928 break;
929 case CS_EVENT_CARD_INSERTION: 915 case CS_EVENT_CARD_INSERTION:
930 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 916 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
931 bt3c_config(link); 917 bt3c_config(link);
@@ -948,7 +934,7 @@ static struct pcmcia_driver bt3c_driver = {
948 }, 934 },
949 .attach = bt3c_attach, 935 .attach = bt3c_attach,
950 .event = bt3c_event, 936 .event = bt3c_event,
951 .detach = bt3c_detach, 937 .remove = bt3c_detach,
952 .id_table = bt3c_ids, 938 .id_table = bt3c_ids,
953 .suspend = bt3c_suspend, 939 .suspend = bt3c_suspend,
954 .resume = bt3c_resume, 940 .resume = bt3c_resume,
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 1828ba6ca25e..63221d383fda 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -91,7 +91,7 @@ static int btuart_event(event_t event, int priority, event_callback_args_t *args
91static dev_info_t dev_info = "btuart_cs"; 91static dev_info_t dev_info = "btuart_cs";
92 92
93static dev_link_t *btuart_attach(void); 93static dev_link_t *btuart_attach(void);
94static void btuart_detach(dev_link_t *); 94static void btuart_detach(struct pcmcia_device *p_dev);
95 95
96static dev_link_t *dev_list = NULL; 96static dev_link_t *dev_list = NULL;
97 97
@@ -619,7 +619,7 @@ static dev_link_t *btuart_attach(void)
619 ret = pcmcia_register_client(&link->handle, &client_reg); 619 ret = pcmcia_register_client(&link->handle, &client_reg);
620 if (ret != CS_SUCCESS) { 620 if (ret != CS_SUCCESS) {
621 cs_error(link->handle, RegisterClient, ret); 621 cs_error(link->handle, RegisterClient, ret);
622 btuart_detach(link); 622 btuart_detach(link->handle);
623 return NULL; 623 return NULL;
624 } 624 }
625 625
@@ -627,11 +627,11 @@ static dev_link_t *btuart_attach(void)
627} 627}
628 628
629 629
630static void btuart_detach(dev_link_t *link) 630static void btuart_detach(struct pcmcia_device *p_dev)
631{ 631{
632 dev_link_t *link = dev_to_instance(p_dev);
632 btuart_info_t *info = link->priv; 633 btuart_info_t *info = link->priv;
633 dev_link_t **linkp; 634 dev_link_t **linkp;
634 int ret;
635 635
636 /* Locate device structure */ 636 /* Locate device structure */
637 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 637 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -644,12 +644,6 @@ static void btuart_detach(dev_link_t *link)
644 if (link->state & DEV_CONFIG) 644 if (link->state & DEV_CONFIG)
645 btuart_release(link); 645 btuart_release(link);
646 646
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 */ 647 /* Unlink device structure, free bits */
654 *linkp = link->next; 648 *linkp = link->next;
655 649
@@ -837,16 +831,8 @@ static int btuart_resume(struct pcmcia_device *dev)
837static int btuart_event(event_t event, int priority, event_callback_args_t *args) 831static int btuart_event(event_t event, int priority, event_callback_args_t *args)
838{ 832{
839 dev_link_t *link = args->client_data; 833 dev_link_t *link = args->client_data;
840 btuart_info_t *info = link->priv;
841 834
842 switch (event) { 835 switch (event) {
843 case CS_EVENT_CARD_REMOVAL:
844 link->state &= ~DEV_PRESENT;
845 if (link->state & DEV_CONFIG) {
846 btuart_close(info);
847 btuart_release(link);
848 }
849 break;
850 case CS_EVENT_CARD_INSERTION: 836 case CS_EVENT_CARD_INSERTION:
851 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 837 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
852 btuart_config(link); 838 btuart_config(link);
@@ -869,7 +855,7 @@ static struct pcmcia_driver btuart_driver = {
869 }, 855 },
870 .attach = btuart_attach, 856 .attach = btuart_attach,
871 .event = btuart_event, 857 .event = btuart_event,
872 .detach = btuart_detach, 858 .remove = btuart_detach,
873 .id_table = btuart_ids, 859 .id_table = btuart_ids,
874 .suspend = btuart_suspend, 860 .suspend = btuart_suspend,
875 .resume = btuart_resume, 861 .resume = btuart_resume,
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 9f9d3f91f455..2874d8722be9 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -94,7 +94,7 @@ static int dtl1_event(event_t event, int priority, event_callback_args_t *args);
94static dev_info_t dev_info = "dtl1_cs"; 94static dev_info_t dev_info = "dtl1_cs";
95 95
96static dev_link_t *dtl1_attach(void); 96static dev_link_t *dtl1_attach(void);
97static void dtl1_detach(dev_link_t *); 97static void dtl1_detach(struct pcmcia_device *p_dev);
98 98
99static dev_link_t *dev_list = NULL; 99static dev_link_t *dev_list = NULL;
100 100
@@ -598,7 +598,7 @@ static dev_link_t *dtl1_attach(void)
598 ret = pcmcia_register_client(&link->handle, &client_reg); 598 ret = pcmcia_register_client(&link->handle, &client_reg);
599 if (ret != CS_SUCCESS) { 599 if (ret != CS_SUCCESS) {
600 cs_error(link->handle, RegisterClient, ret); 600 cs_error(link->handle, RegisterClient, ret);
601 dtl1_detach(link); 601 dtl1_detach(link->handle);
602 return NULL; 602 return NULL;
603 } 603 }
604 604
@@ -606,11 +606,11 @@ static dev_link_t *dtl1_attach(void)
606} 606}
607 607
608 608
609static void dtl1_detach(dev_link_t *link) 609static void dtl1_detach(struct pcmcia_device *p_dev)
610{ 610{
611 dev_link_t *link = dev_to_instance(p_dev);
611 dtl1_info_t *info = link->priv; 612 dtl1_info_t *info = link->priv;
612 dev_link_t **linkp; 613 dev_link_t **linkp;
613 int ret;
614 614
615 /* Locate device structure */ 615 /* Locate device structure */
616 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 616 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -623,12 +623,6 @@ static void dtl1_detach(dev_link_t *link)
623 if (link->state & DEV_CONFIG) 623 if (link->state & DEV_CONFIG)
624 dtl1_release(link); 624 dtl1_release(link);
625 625
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 */ 626 /* Unlink device structure, free bits */
633 *linkp = link->next; 627 *linkp = link->next;
634 628
@@ -788,16 +782,8 @@ static int dtl1_resume(struct pcmcia_device *dev)
788static int dtl1_event(event_t event, int priority, event_callback_args_t *args) 782static int dtl1_event(event_t event, int priority, event_callback_args_t *args)
789{ 783{
790 dev_link_t *link = args->client_data; 784 dev_link_t *link = args->client_data;
791 dtl1_info_t *info = link->priv;
792 785
793 switch (event) { 786 switch (event) {
794 case CS_EVENT_CARD_REMOVAL:
795 link->state &= ~DEV_PRESENT;
796 if (link->state & DEV_CONFIG) {
797 dtl1_close(info);
798 dtl1_release(link);
799 }
800 break;
801 case CS_EVENT_CARD_INSERTION: 787 case CS_EVENT_CARD_INSERTION:
802 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 788 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
803 dtl1_config(link); 789 dtl1_config(link);
@@ -821,7 +807,7 @@ static struct pcmcia_driver dtl1_driver = {
821 }, 807 },
822 .attach = dtl1_attach, 808 .attach = dtl1_attach,
823 .event = dtl1_event, 809 .event = dtl1_event,
824 .detach = dtl1_detach, 810 .remove = dtl1_detach,
825 .id_table = dtl1_ids, 811 .id_table = dtl1_ids,
826 .suspend = dtl1_suspend, 812 .suspend = dtl1_suspend,
827 .resume = dtl1_resume, 813 .resume = dtl1_resume,