summaryrefslogtreecommitdiff
path: root/drivers/net/pcmcia/pcnet_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 21:23:14 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-06 00:03:10 +0100
commitcc3b4866bee996c922e875b8c8efe9f0d8803aae (patch)
tree6632837b6986f33566f75ed971cecbdc210e3201 /drivers/net/pcmcia/pcnet_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/net/pcmcia/pcnet_cs.c')
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 7db4d6f3db45..fb3e411d6daf 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -121,7 +121,7 @@ static int setup_dma_config(dev_link_t *link, int start_pg,
int stop_pg);
static dev_link_t *pcnet_attach(void);
-static void pcnet_detach(dev_link_t *);
+static void pcnet_detach(struct pcmcia_device *p_dev);
static dev_info_t dev_info = "pcnet_cs";
static dev_link_t *dev_list;
@@ -280,7 +280,7 @@ static dev_link_t *pcnet_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
- pcnet_detach(link);
+ pcnet_detach(link->handle);
return NULL;
}
@@ -296,31 +296,29 @@ static dev_link_t *pcnet_attach(void)
======================================================================*/
-static void pcnet_detach(dev_link_t *link)
+static void pcnet_detach(struct pcmcia_device *p_dev)
{
- struct net_device *dev = link->priv;
- dev_link_t **linkp;
-
- DEBUG(0, "pcnet_detach(0x%p)\n", link);
+ dev_link_t *link = dev_to_instance(p_dev);
+ struct net_device *dev = link->priv;
+ dev_link_t **linkp;
- /* Locate device structure */
- for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
- if (*linkp == link) break;
- if (*linkp == NULL)
- return;
+ DEBUG(0, "pcnet_detach(0x%p)\n", link);
- if (link->dev)
- unregister_netdev(dev);
+ /* Locate device structure */
+ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+ if (*linkp == link) break;
+ if (*linkp == NULL)
+ return;
- if (link->state & DEV_CONFIG)
- pcnet_release(link);
+ if (link->dev)
+ unregister_netdev(dev);
- if (link->handle)
- pcmcia_deregister_client(link->handle);
+ if (link->state & DEV_CONFIG)
+ pcnet_release(link);
- /* Unlink device structure, free bits */
- *linkp = link->next;
- free_netdev(dev);
+ /* Unlink device structure, free bits */
+ *linkp = link->next;
+ free_netdev(dev);
} /* pcnet_detach */
/*======================================================================
@@ -817,16 +815,10 @@ static int pcnet_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- struct net_device *dev = link->priv;
DEBUG(2, "pcnet_event(0x%06x)\n", event);
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG)
- netif_device_detach(dev);
- break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
pcnet_config(link);
@@ -1856,7 +1848,7 @@ static struct pcmcia_driver pcnet_driver = {
},
.attach = pcnet_attach,
.event = pcnet_event,
- .detach = pcnet_detach,
+ .remove = pcnet_detach,
.owner = THIS_MODULE,
.id_table = pcnet_ids,
.suspend = pcnet_suspend,