diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:23:14 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:10 -0500 |
commit | cc3b4866bee996c922e875b8c8efe9f0d8803aae (patch) | |
tree | 6632837b6986f33566f75ed971cecbdc210e3201 /drivers/bluetooth/bluecard_cs.c | |
parent | 8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (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/bluecard_cs.c')
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 24 |
1 files changed, 5 insertions, 19 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 | |||
92 | static dev_info_t dev_info = "bluecard_cs"; | 92 | static dev_info_t dev_info = "bluecard_cs"; |
93 | 93 | ||
94 | static dev_link_t *bluecard_attach(void); | 94 | static dev_link_t *bluecard_attach(void); |
95 | static void bluecard_detach(dev_link_t *); | 95 | static void bluecard_detach(struct pcmcia_device *p_dev); |
96 | 96 | ||
97 | static dev_link_t *dev_list = NULL; | 97 | static 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 | ||
910 | static void bluecard_detach(dev_link_t *link) | 910 | static 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) | |||
1070 | static int bluecard_event(event_t event, int priority, event_callback_args_t *args) | 1064 | static 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, |