aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/bt3c_cs.c
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/bt3c_cs.c
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/bt3c_cs.c')
-rw-r--r--drivers/bluetooth/bt3c_cs.c24
1 files changed, 5 insertions, 19 deletions
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,