aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/sedlbauer_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/isdn/hisax/sedlbauer_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/isdn/hisax/sedlbauer_cs.c')
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 27dce7c7b760..d2386f6867b7 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -107,7 +107,7 @@ static int sedlbauer_event(event_t event, int priority,
107*/ 107*/
108 108
109static dev_link_t *sedlbauer_attach(void); 109static dev_link_t *sedlbauer_attach(void);
110static void sedlbauer_detach(dev_link_t *); 110static void sedlbauer_detach(struct pcmcia_device *p_dev);
111 111
112/* 112/*
113 You'll also need to prototype all the functions that will actually 113 You'll also need to prototype all the functions that will actually
@@ -230,7 +230,7 @@ static dev_link_t *sedlbauer_attach(void)
230 ret = pcmcia_register_client(&link->handle, &client_reg); 230 ret = pcmcia_register_client(&link->handle, &client_reg);
231 if (ret != CS_SUCCESS) { 231 if (ret != CS_SUCCESS) {
232 cs_error(link->handle, RegisterClient, ret); 232 cs_error(link->handle, RegisterClient, ret);
233 sedlbauer_detach(link); 233 sedlbauer_detach(link->handle);
234 return NULL; 234 return NULL;
235 } 235 }
236 236
@@ -246,8 +246,9 @@ static dev_link_t *sedlbauer_attach(void)
246 246
247======================================================================*/ 247======================================================================*/
248 248
249static void sedlbauer_detach(dev_link_t *link) 249static void sedlbauer_detach(struct pcmcia_device *p_dev)
250{ 250{
251 dev_link_t *link = dev_to_instance(p_dev);
251 dev_link_t **linkp; 252 dev_link_t **linkp;
252 253
253 DEBUG(0, "sedlbauer_detach(0x%p)\n", link); 254 DEBUG(0, "sedlbauer_detach(0x%p)\n", link);
@@ -258,25 +259,11 @@ static void sedlbauer_detach(dev_link_t *link)
258 if (*linkp == NULL) 259 if (*linkp == NULL)
259 return; 260 return;
260 261
261 /*
262 If the device is currently configured and active, we won't
263 actually delete it yet. Instead, it is marked so that when
264 the release() function is called, that will trigger a proper
265 detach().
266 */
267 if (link->state & DEV_CONFIG) { 262 if (link->state & DEV_CONFIG) {
268#ifdef PCMCIA_DEBUG 263 ((local_info_t *)link->priv)->stop = 1;
269 printk(KERN_DEBUG "sedlbauer_cs: detach postponed, '%s' " 264 sedlbauer_release(link);
270 "still locked\n", link->dev->dev_name);
271#endif
272 link->state |= DEV_STALE_LINK;
273 return;
274 } 265 }
275 266
276 /* Break the link with Card Services */
277 if (link->handle)
278 pcmcia_deregister_client(link->handle);
279
280 /* Unlink device structure, and free it */ 267 /* Unlink device structure, and free it */
281 *linkp = link->next; 268 *linkp = link->next;
282 /* This points to the parent local_info_t struct */ 269 /* This points to the parent local_info_t struct */
@@ -547,10 +534,6 @@ static void sedlbauer_release(dev_link_t *link)
547 if (link->irq.AssignedIRQ) 534 if (link->irq.AssignedIRQ)
548 pcmcia_release_irq(link->handle, &link->irq); 535 pcmcia_release_irq(link->handle, &link->irq);
549 link->state &= ~DEV_CONFIG; 536 link->state &= ~DEV_CONFIG;
550
551 if (link->state & DEV_STALE_LINK)
552 sedlbauer_detach(link);
553
554} /* sedlbauer_release */ 537} /* sedlbauer_release */
555 538
556static int sedlbauer_suspend(struct pcmcia_device *p_dev) 539static int sedlbauer_suspend(struct pcmcia_device *p_dev)
@@ -599,13 +582,6 @@ static int sedlbauer_event(event_t event, int priority,
599 DEBUG(1, "sedlbauer_event(0x%06x)\n", event); 582 DEBUG(1, "sedlbauer_event(0x%06x)\n", event);
600 583
601 switch (event) { 584 switch (event) {
602 case CS_EVENT_CARD_REMOVAL:
603 link->state &= ~DEV_PRESENT;
604 if (link->state & DEV_CONFIG) {
605 ((local_info_t *)link->priv)->stop = 1;
606 sedlbauer_release(link);
607 }
608 break;
609 case CS_EVENT_CARD_INSERTION: 585 case CS_EVENT_CARD_INSERTION:
610 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 586 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
611 sedlbauer_config(link); 587 sedlbauer_config(link);
@@ -633,7 +609,7 @@ static struct pcmcia_driver sedlbauer_driver = {
633 }, 609 },
634 .attach = sedlbauer_attach, 610 .attach = sedlbauer_attach,
635 .event = sedlbauer_event, 611 .event = sedlbauer_event,
636 .detach = sedlbauer_detach, 612 .remove = sedlbauer_detach,
637 .id_table = sedlbauer_ids, 613 .id_table = sedlbauer_ids,
638 .suspend = sedlbauer_suspend, 614 .suspend = sedlbauer_suspend,
639 .resume = sedlbauer_resume, 615 .resume = sedlbauer_resume,