aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/telephony/ixj_pcmcia.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/telephony/ixj_pcmcia.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/telephony/ixj_pcmcia.c')
-rw-r--r--drivers/telephony/ixj_pcmcia.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index 7cca46be0c0f..c58140dc7a73 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -35,7 +35,7 @@ typedef struct ixj_info_t {
35} ixj_info_t; 35} ixj_info_t;
36 36
37static dev_link_t *ixj_attach(void); 37static dev_link_t *ixj_attach(void);
38static void ixj_detach(dev_link_t *); 38static void ixj_detach(struct pcmcia_device *p_dev);
39static void ixj_config(dev_link_t * link); 39static void ixj_config(dev_link_t * link);
40static void ixj_cs_release(dev_link_t * link); 40static void ixj_cs_release(dev_link_t * link);
41static int ixj_event(event_t event, int priority, event_callback_args_t * args); 41static int ixj_event(event_t event, int priority, event_callback_args_t * args);
@@ -73,16 +73,17 @@ static dev_link_t *ixj_attach(void)
73 ret = pcmcia_register_client(&link->handle, &client_reg); 73 ret = pcmcia_register_client(&link->handle, &client_reg);
74 if (ret != CS_SUCCESS) { 74 if (ret != CS_SUCCESS) {
75 cs_error(link->handle, RegisterClient, ret); 75 cs_error(link->handle, RegisterClient, ret);
76 ixj_detach(link); 76 ixj_detach(link->handle);
77 return NULL; 77 return NULL;
78 } 78 }
79 return link; 79 return link;
80} 80}
81 81
82static void ixj_detach(dev_link_t * link) 82static void ixj_detach(struct pcmcia_device *p_dev)
83{ 83{
84 dev_link_t *link = dev_to_instance(p_dev);
84 dev_link_t **linkp; 85 dev_link_t **linkp;
85 int ret; 86
86 DEBUG(0, "ixj_detach(0x%p)\n", link); 87 DEBUG(0, "ixj_detach(0x%p)\n", link);
87 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 88 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
88 if (*linkp == link) 89 if (*linkp == link)
@@ -92,11 +93,7 @@ static void ixj_detach(dev_link_t * link)
92 link->state &= ~DEV_RELEASE_PENDING; 93 link->state &= ~DEV_RELEASE_PENDING;
93 if (link->state & DEV_CONFIG) 94 if (link->state & DEV_CONFIG)
94 ixj_cs_release(link); 95 ixj_cs_release(link);
95 if (link->handle) { 96
96 ret = pcmcia_deregister_client(link->handle);
97 if (ret != CS_SUCCESS)
98 cs_error(link->handle, DeregisterClient, ret);
99 }
100 /* Unlink device structure, free bits */ 97 /* Unlink device structure, free bits */
101 *linkp = link->next; 98 *linkp = link->next;
102 kfree(link->priv); 99 kfree(link->priv);
@@ -282,13 +279,6 @@ static int ixj_event(event_t event, int priority, event_callback_args_t * args)
282 dev_link_t *link = args->client_data; 279 dev_link_t *link = args->client_data;
283 DEBUG(1, "ixj_event(0x%06x)\n", event); 280 DEBUG(1, "ixj_event(0x%06x)\n", event);
284 switch (event) { 281 switch (event) {
285 case CS_EVENT_CARD_REMOVAL:
286 link->state &= ~DEV_PRESENT;
287 if (link->state & DEV_CONFIG) {
288 link->state |= DEV_RELEASE_PENDING;
289 ixj_cs_release(link);
290 }
291 break;
292 case CS_EVENT_CARD_INSERTION: 282 case CS_EVENT_CARD_INSERTION:
293 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 283 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
294 ixj_config(link); 284 ixj_config(link);
@@ -310,7 +300,7 @@ static struct pcmcia_driver ixj_driver = {
310 }, 300 },
311 .attach = ixj_attach, 301 .attach = ixj_attach,
312 .event = ixj_event, 302 .event = ixj_event,
313 .detach = ixj_detach, 303 .remove = ixj_detach,
314 .id_table = ixj_ids, 304 .id_table = ixj_ids,
315 .suspend = ixj_suspend, 305 .suspend = ixj_suspend,
316 .resume = ixj_resume, 306 .resume = ixj_resume,