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