diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 21:23:14 +0100 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-06 00:03:10 +0100 |
commit | cc3b4866bee996c922e875b8c8efe9f0d8803aae (patch) | |
tree | 6632837b6986f33566f75ed971cecbdc210e3201 /drivers/isdn/hardware | |
parent | 8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (diff) | |
download | kernel_samsung_crespo-cc3b4866bee996c922e875b8c8efe9f0d8803aae.zip kernel_samsung_crespo-cc3b4866bee996c922e875b8c8efe9f0d8803aae.tar.gz kernel_samsung_crespo-cc3b4866bee996c922e875b8c8efe9f0d8803aae.tar.bz2 |
[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/hardware')
-rw-r--r-- | drivers/isdn/hardware/avm/avm_cs.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 6d9816e..2d898d3 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -63,7 +63,7 @@ static int avmcs_event(event_t event, int priority, */ static dev_link_t *avmcs_attach(void); -static void avmcs_detach(dev_link_t *); +static void avmcs_detach(struct pcmcia_device *p_dev); /* The dev_info variable is the "key" that is used to match up this @@ -165,7 +165,7 @@ static dev_link_t *avmcs_attach(void) ret = pcmcia_register_client(&link->handle, &client_reg); if (ret != 0) { cs_error(link->handle, RegisterClient, ret); - avmcs_detach(link); + avmcs_detach(link->handle); goto err; } return link; @@ -185,8 +185,9 @@ static dev_link_t *avmcs_attach(void) ======================================================================*/ -static void avmcs_detach(dev_link_t *link) +static void avmcs_detach(struct pcmcia_device *p_dev) { + dev_link_t *link = dev_to_instance(p_dev); dev_link_t **linkp; /* Locate device structure */ @@ -195,21 +196,9 @@ static void avmcs_detach(dev_link_t *link) if (*linkp == NULL) return; - /* - If the device is currently configured and active, we won't - actually delete it yet. Instead, it is marked so that when - the release() function is called, that will trigger a proper - detach(). - */ - if (link->state & DEV_CONFIG) { - link->state |= DEV_STALE_LINK; - return; - } + if (link->state & DEV_CONFIG) + avmcs_release(link); - /* Break the link with Card Services */ - if (link->handle) - pcmcia_deregister_client(link->handle); - /* Unlink device structure, free pieces */ *linkp = link->next; kfree(link->priv); @@ -424,10 +413,6 @@ static void avmcs_release(dev_link_t *link) pcmcia_release_io(link->handle, &link->io); pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; - - if (link->state & DEV_STALE_LINK) - avmcs_detach(link); - } /* avmcs_release */ static int avmcs_suspend(struct pcmcia_device *dev) @@ -472,11 +457,6 @@ static int avmcs_event(event_t event, int priority, dev_link_t *link = args->client_data; switch (event) { - case CS_EVENT_CARD_REMOVAL: - link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) - avmcs_release(link); - break; case CS_EVENT_CARD_INSERTION: link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; avmcs_config(link); @@ -500,7 +480,7 @@ static struct pcmcia_driver avmcs_driver = { }, .attach = avmcs_attach, .event = avmcs_event, - .detach = avmcs_detach, + .remove = avmcs_detach, .id_table = avmcs_ids, .suspend= avmcs_suspend, .resume = avmcs_resume, |