summaryrefslogtreecommitdiffstats
path: root/drivers/net
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
parent8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (diff)
downloadblackbird-op-linux-cc3b4866bee996c922e875b8c8efe9f0d8803aae.tar.gz
blackbird-op-linux-cc3b4866bee996c922e875b8c8efe9f0d8803aae.zip
[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')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c18
-rw-r--r--drivers/net/pcmcia/3c589_cs.c20
-rw-r--r--drivers/net/pcmcia/axnet_cs.c18
-rw-r--r--drivers/net/pcmcia/com20020_cs.c19
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c19
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c23
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c18
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c48
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c18
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c28
-rw-r--r--drivers/net/wireless/airo_cs.c31
-rw-r--r--drivers/net/wireless/atmel_cs.c25
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c28
-rw-r--r--drivers/net/wireless/netwave_cs.c31
-rw-r--r--drivers/net/wireless/orinoco_cs.c30
-rw-r--r--drivers/net/wireless/ray_cs.c43
-rw-r--r--drivers/net/wireless/spectrum_cs.c37
-rw-r--r--drivers/net/wireless/wavelan_cs.c31
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h2
-rw-r--r--drivers/net/wireless/wl3501_cs.c32
20 files changed, 138 insertions, 381 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 80414a77fe75..60a3bc2b8fc4 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -253,7 +253,7 @@ static void set_rx_mode(struct net_device *dev);
static dev_info_t dev_info = "3c574_cs";
static dev_link_t *tc574_attach(void);
-static void tc574_detach(dev_link_t *);
+static void tc574_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list;
@@ -316,7 +316,7 @@ static dev_link_t *tc574_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- tc574_detach(link);
+ tc574_detach(link->handle);
return NULL;
}
@@ -332,8 +332,9 @@ static dev_link_t *tc574_attach(void)
*/
-static void tc574_detach(dev_link_t *link)
+static void tc574_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -351,9 +352,6 @@ static void tc574_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
tc574_release(link);
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free bits */
*linkp = link->next;
free_netdev(dev);
@@ -590,16 +588,10 @@ static int tc574_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(1, "3c574_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;
tc574_config(link);
@@ -1304,7 +1296,7 @@ static struct pcmcia_driver tc574_driver = {
},
.attach = tc574_attach,
.event = tc574_event,
- .detach = tc574_detach,
+ .remove = tc574_detach,
.id_table = tc574_ids,
.suspend = tc574_suspend,
.resume = tc574_resume,
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index bbda681ac102..09b96c76216e 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -164,7 +164,7 @@ static struct ethtool_ops netdev_ethtool_ops;
static dev_info_t dev_info = "3c589_cs";
static dev_link_t *tc589_attach(void);
-static void tc589_detach(dev_link_t *);
+static void tc589_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list;
@@ -230,7 +230,7 @@ static dev_link_t *tc589_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- tc589_detach(link);
+ tc589_detach(link->handle);
return NULL;
}
@@ -246,8 +246,9 @@ static dev_link_t *tc589_attach(void)
======================================================================*/
-static void tc589_detach(dev_link_t *link)
+static void tc589_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -264,10 +265,7 @@ static void tc589_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
tc589_release(link);
-
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
+
/* Unlink device structure, free bits */
*linkp = link->next;
free_netdev(dev);
@@ -466,16 +464,10 @@ static int tc589_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(1, "3c589_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;
tc589_config(link);
@@ -1079,7 +1071,7 @@ static struct pcmcia_driver tc589_driver = {
},
.attach = tc589_attach,
.event = tc589_event,
- .detach = tc589_detach,
+ .remove = tc589_detach,
.id_table = tc589_ids,
.suspend = tc589_suspend,
.resume = tc589_resume,
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 6c6b25265659..11f701a8ff02 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -108,7 +108,7 @@ static void block_output(struct net_device *dev, int count,
const u_char *buf, const int start_page);
static dev_link_t *axnet_attach(void);
-static void axnet_detach(dev_link_t *);
+static void axnet_detach(struct pcmcia_device *p_dev);
static dev_info_t dev_info = "axnet_cs";
static dev_link_t *dev_list;
@@ -185,7 +185,7 @@ static dev_link_t *axnet_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
- axnet_detach(link);
+ axnet_detach(link->handle);
return NULL;
}
@@ -201,8 +201,9 @@ static dev_link_t *axnet_attach(void)
======================================================================*/
-static void axnet_detach(dev_link_t *link)
+static void axnet_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -220,9 +221,6 @@ static void axnet_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
axnet_release(link);
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free bits */
*linkp = link->next;
free_netdev(dev);
@@ -537,16 +535,10 @@ static int axnet_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, "axnet_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;
axnet_config(link);
@@ -890,7 +882,7 @@ static struct pcmcia_driver axnet_cs_driver = {
},
.attach = axnet_attach,
.event = axnet_event,
- .detach = axnet_detach,
+ .remove = axnet_detach,
.id_table = axnet_ids,
.suspend = axnet_suspend,
.resume = axnet_resume,
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 68612222de6e..6970888cba10 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -126,7 +126,7 @@ static int com20020_event(event_t event, int priority,
static dev_info_t dev_info = "com20020_cs";
static dev_link_t *com20020_attach(void);
-static void com20020_detach(dev_link_t *);
+static void com20020_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list;
@@ -204,7 +204,7 @@ static dev_link_t *com20020_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- com20020_detach(link);
+ com20020_detach(link->handle);
return NULL;
}
@@ -226,8 +226,9 @@ fail_alloc_info:
======================================================================*/
-static void com20020_detach(dev_link_t *link)
+static void com20020_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct com20020_dev_t *info = link->priv;
dev_link_t **linkp;
struct net_device *dev;
@@ -260,9 +261,6 @@ static void com20020_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
com20020_release(link);
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free bits */
DEBUG(1,"unlinking...\n");
*linkp = link->next;
@@ -470,17 +468,10 @@ static int com20020_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- com20020_dev_t *info = link->priv;
- struct net_device *dev = info->dev;
DEBUG(1, "com20020_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;
com20020_config(link);
@@ -502,7 +493,7 @@ static struct pcmcia_driver com20020_cs_driver = {
},
.attach = com20020_attach,
.event = com20020_event,
- .detach = com20020_detach,
+ .remove = com20020_detach,
.id_table = com20020_ids,
.suspend = com20020_suspend,
.resume = com20020_resume,
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 388ecade13de..560d4ee22803 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -91,7 +91,7 @@ static void fmvj18x_release(dev_link_t *link);
static int fmvj18x_event(event_t event, int priority,
event_callback_args_t *args);
static dev_link_t *fmvj18x_attach(void);
-static void fmvj18x_detach(dev_link_t *);
+static void fmvj18x_detach(struct pcmcia_device *p_dev);
/*
LAN controller(MBH86960A) specific routines
@@ -291,7 +291,7 @@ static dev_link_t *fmvj18x_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- fmvj18x_detach(link);
+ fmvj18x_detach(link->handle);
return NULL;
}
@@ -300,8 +300,9 @@ static dev_link_t *fmvj18x_attach(void)
/*====================================================================*/
-static void fmvj18x_detach(dev_link_t *link)
+static void fmvj18x_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -319,10 +320,6 @@ static void fmvj18x_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
fmvj18x_release(link);
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free pieces */
*linkp = link->next;
free_netdev(dev);
@@ -752,16 +749,10 @@ static int fmvj18x_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(1, "fmvj18x_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;
fmvj18x_config(link);
@@ -802,7 +793,7 @@ static struct pcmcia_driver fmvj18x_cs_driver = {
},
.attach = fmvj18x_attach,
.event = fmvj18x_event,
- .detach = fmvj18x_detach,
+ .remove = fmvj18x_detach,
.id_table = fmvj18x_ids,
.suspend = fmvj18x_suspend,
.resume = fmvj18x_resume,
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 3a7218e51b73..961294983354 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -114,7 +114,7 @@ static int ibmtr_event(event_t event, int priority,
static dev_info_t dev_info = "ibmtr_cs";
static dev_link_t *ibmtr_attach(void);
-static void ibmtr_detach(dev_link_t *);
+static void ibmtr_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list;
@@ -201,7 +201,7 @@ out:
return link;
out_detach:
- ibmtr_detach(link);
+ ibmtr_detach(link->handle);
link = NULL;
goto out;
} /* ibmtr_attach */
@@ -215,8 +215,9 @@ out_detach:
======================================================================*/
-static void ibmtr_detach(dev_link_t *link)
+static void ibmtr_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct ibmtr_dev_t *info = link->priv;
dev_link_t **linkp;
struct net_device *dev;
@@ -241,9 +242,6 @@ static void ibmtr_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
ibmtr_release(link);
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free bits */
*linkp = link->next;
free_netdev(dev);
@@ -449,21 +447,10 @@ static int ibmtr_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- ibmtr_dev_t *info = link->priv;
- struct net_device *dev = info->dev;
DEBUG(1, "ibmtr_event(0x%06x)\n", event);
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- /* set flag to bypass normal interrupt code */
- struct tok_info *priv = netdev_priv(dev);
- priv->sram_phys |= 1;
- netif_device_detach(dev);
- }
- break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT;
ibmtr_config(link);
@@ -529,7 +516,7 @@ static struct pcmcia_driver ibmtr_cs_driver = {
},
.attach = ibmtr_attach,
.event = ibmtr_event,
- .detach = ibmtr_detach,
+ .remove = ibmtr_detach,
.id_table = ibmtr_ids,
.suspend = ibmtr_suspend,
.resume = ibmtr_resume,
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index fa4921f8b9fc..011ceb090320 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -440,7 +440,7 @@ static struct ethtool_ops netdev_ethtool_ops;
static dev_link_t *nmclan_attach(void);
-static void nmclan_detach(dev_link_t *);
+static void nmclan_detach(struct pcmcia_device *p_dev);
/* ----------------------------------------------------------------------------
nmclan_attach
@@ -506,7 +506,7 @@ static dev_link_t *nmclan_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- nmclan_detach(link);
+ nmclan_detach(link->handle);
return NULL;
}
@@ -521,8 +521,9 @@ nmclan_detach
when the device is released.
---------------------------------------------------------------------------- */
-static void nmclan_detach(dev_link_t *link)
+static void nmclan_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -540,9 +541,6 @@ static void nmclan_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
nmclan_release(link);
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free bits */
*linkp = link->next;
free_netdev(dev);
@@ -845,16 +843,10 @@ static int nmclan_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(1, "nmclan_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;
nmclan_config(link);
@@ -1694,7 +1686,7 @@ static struct pcmcia_driver nmclan_cs_driver = {
},
.attach = nmclan_attach,
.event = nmclan_event,
- .detach = nmclan_detach,
+ .remove = nmclan_detach,
.id_table = nmclan_ids,
.suspend = nmclan_suspend,
.resume = nmclan_resume,
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,
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 7c61ec90c2c3..6cb5198d6094 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -282,7 +282,7 @@ enum RxCfg { RxAllMulti = 0x0004, RxPromisc = 0x0002,
/*====================================================================*/
static dev_link_t *smc91c92_attach(void);
-static void smc91c92_detach(dev_link_t *);
+static void smc91c92_detach(struct pcmcia_device *p_dev);
static void smc91c92_config(dev_link_t *link);
static void smc91c92_release(dev_link_t *link);
static int smc91c92_event(event_t event, int priority,
@@ -375,7 +375,7 @@ static dev_link_t *smc91c92_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- smc91c92_detach(link);
+ smc91c92_detach(link->handle);
return NULL;
}
@@ -391,8 +391,9 @@ static dev_link_t *smc91c92_attach(void)
======================================================================*/
-static void smc91c92_detach(dev_link_t *link)
+static void smc91c92_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -410,9 +411,6 @@ static void smc91c92_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
smc91c92_release(link);
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free bits */
*linkp = link->next;
free_netdev(dev);
@@ -1237,16 +1235,10 @@ static int smc91c92_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(1, "smc91c92_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;
smc91c92_config(link);
@@ -2371,7 +2363,7 @@ static struct pcmcia_driver smc91c92_cs_driver = {
},
.attach = smc91c92_attach,
.event = smc91c92_event,
- .detach = smc91c92_detach,
+ .remove = smc91c92_detach,
.id_table = smc91c92_ids,
.suspend = smc91c92_suspend,
.resume = smc91c92_resume,
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 917e50ac37f3..804e56771baf 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -302,7 +302,7 @@ static int xirc2ps_event(event_t event, int priority,
*/
static dev_link_t *xirc2ps_attach(void);
-static void xirc2ps_detach(dev_link_t *);
+static void xirc2ps_detach(struct pcmcia_device *p_dev);
/****************
* You'll also need to prototype all the functions that will actually
@@ -622,7 +622,7 @@ xirc2ps_attach(void)
client_reg.event_callback_args.client_data = link;
if ((err = pcmcia_register_client(&link->handle, &client_reg))) {
cs_error(link->handle, RegisterClient, err);
- xirc2ps_detach(link);
+ xirc2ps_detach(link->handle);
return NULL;
}
@@ -637,8 +637,9 @@ xirc2ps_attach(void)
*/
static void
-xirc2ps_detach(dev_link_t * link)
+xirc2ps_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -656,19 +657,9 @@ xirc2ps_detach(dev_link_t * link)
if (link->dev)
unregister_netdev(dev);
- /*
- * 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)
xirc2ps_release(link);
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free it */
*linkp = link->next;
free_netdev(dev);
@@ -1209,19 +1200,10 @@ xirc2ps_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(0, "event(%d)\n", (int)event);
switch (event) {
- case CS_EVENT_REGISTRATION_COMPLETE:
- DEBUG(0, "registration complete\n");
- break;
- 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;
xirc2ps_config(link);
@@ -2022,7 +2004,7 @@ static struct pcmcia_driver xirc2ps_cs_driver = {
},
.attach = xirc2ps_attach,
.event = xirc2ps_event,
- .detach = xirc2ps_detach,
+ .remove = xirc2ps_detach,
.id_table = xirc2ps_ids,
.suspend = xirc2ps_suspend,
.resume = xirc2ps_resume,
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 80c9de749b52..7a28139544c0 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -92,7 +92,7 @@ static int airo_event(event_t event, int priority,
*/
static dev_link_t *airo_attach(void);
-static void airo_detach(dev_link_t *);
+static void airo_detach(struct pcmcia_device *p_dev);
/*
You'll also need to prototype all the functions that will actually
@@ -210,7 +210,7 @@ static dev_link_t *airo_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- airo_detach(link);
+ airo_detach(link->handle);
return NULL;
}
@@ -226,8 +226,9 @@ static dev_link_t *airo_attach(void)
======================================================================*/
-static void airo_detach(dev_link_t *link)
+static void airo_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
DEBUG(0, "airo_detach(0x%p)\n", link);
@@ -244,14 +245,8 @@ static void airo_detach(dev_link_t *link)
if ( ((local_info_t*)link->priv)->eth_dev ) {
stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
}
- ((local_info_t*)link->priv)->eth_dev = NULL;
-
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
-
-
+ ((local_info_t*)link->priv)->eth_dev = NULL;
+
/* Unlink device structure, free pieces */
*linkp = link->next;
kfree(link->priv);
@@ -537,18 +532,10 @@ static int airo_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- local_info_t *local = link->priv;
-
+
DEBUG(1, "airo_event(0x%06x)\n", event);
-
+
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- netif_device_detach(local->eth_dev);
- airo_release(link);
- }
- break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
airo_config(link);
@@ -573,7 +560,7 @@ static struct pcmcia_driver airo_driver = {
},
.attach = airo_attach,
.event = airo_event,
- .detach = airo_detach,
+ .remove = airo_detach,
.id_table = airo_ids,
.suspend = airo_suspend,
.resume = airo_resume,
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 598a9cd0f83e..3ab33dd49ea2 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -103,7 +103,7 @@ static int atmel_event(event_t event, int priority,
*/
static dev_link_t *atmel_attach(void);
-static void atmel_detach(dev_link_t *);
+static void atmel_detach(struct pcmcia_device *p_dev);
/*
You'll also need to prototype all the functions that will actually
@@ -221,7 +221,7 @@ static dev_link_t *atmel_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- atmel_detach(link);
+ atmel_detach(link->handle);
return NULL;
}
@@ -237,8 +237,9 @@ static dev_link_t *atmel_attach(void)
======================================================================*/
-static void atmel_detach(dev_link_t *link)
+static void atmel_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
DEBUG(0, "atmel_detach(0x%p)\n", link);
@@ -252,10 +253,6 @@ static void atmel_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
atmel_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);
@@ -522,18 +519,10 @@ static int atmel_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- local_info_t *local = link->priv;
-
+
DEBUG(1, "atmel_event(0x%06x)\n", event);
-
+
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- netif_device_detach(local->eth_dev);
- atmel_release(link);
- }
- break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
atmel_config(link);
@@ -593,7 +582,7 @@ static struct pcmcia_driver atmel_driver = {
},
.attach = atmel_attach,
.event = atmel_event,
- .detach = atmel_detach,
+ .remove = atmel_detach,
.id_table = atmel_ids,
.suspend = atmel_suspend,
.resume = atmel_resume,
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index ba4a7da98ccd..866142af7d92 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -203,7 +203,7 @@ static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
-static void prism2_detach(dev_link_t *link);
+static void prism2_detach(struct pcmcia_device *p_dev);
static void prism2_release(u_long arg);
static int prism2_event(event_t event, int priority,
event_callback_args_t *args);
@@ -528,15 +528,16 @@ static dev_link_t *prism2_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
- prism2_detach(link);
+ prism2_detach(link->handle);
return NULL;
}
return link;
}
-static void prism2_detach(dev_link_t *link)
+static void prism2_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
PDEBUG(DEBUG_FLOW, "prism2_detach\n");
@@ -554,14 +555,6 @@ static void prism2_detach(dev_link_t *link)
prism2_release((u_long)link);
}
- if (link->handle) {
- int res = pcmcia_deregister_client(link->handle);
- if (res) {
- printk("CardService(DeregisterClient) => %d\n", res);
- cs_error(link->handle, DeregisterClient, res);
- }
- }
-
*linkp = link->next;
/* release net devices */
if (link->priv) {
@@ -902,7 +895,6 @@ static int prism2_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- struct net_device *dev = (struct net_device *) link->priv;
switch (event) {
case CS_EVENT_CARD_INSERTION:
@@ -913,16 +905,6 @@ static int prism2_event(event_t event, int priority,
}
break;
- case CS_EVENT_CARD_REMOVAL:
- PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_CARD_REMOVAL\n", dev_info);
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- netif_stop_queue(dev);
- netif_device_detach(dev);
- prism2_release((u_long) link);
- }
- break;
-
default:
PDEBUG(DEBUG_EXTRA, "%s: prism2_event() - unknown event %d\n",
dev_info, event);
@@ -991,7 +973,7 @@ static struct pcmcia_driver hostap_driver = {
.name = "hostap_cs",
},
.attach = prism2_attach,
- .detach = prism2_detach,
+ .remove = prism2_detach,
.owner = THIS_MODULE,
.event = prism2_event,
.id_table = hostap_cs_ids,
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 7ab2d70ffddf..1770677d9e10 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -200,7 +200,7 @@ static int netwave_event(event_t event, int priority,
static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card
insertion */
static dev_link_t *netwave_attach(void); /* Create instance */
-static void netwave_detach(dev_link_t *); /* Destroy instance */
+static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */
/* Hardware configuration */
static void netwave_doreset(kio_addr_t iobase, u_char __iomem *ramBase);
@@ -459,7 +459,7 @@ static dev_link_t *netwave_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
- netwave_detach(link);
+ netwave_detach(link->handle);
return NULL;
}
@@ -474,8 +474,9 @@ static dev_link_t *netwave_attach(void)
* structures are freed. Otherwise, the structures will be freed
* when the device is released.
*/
-static void netwave_detach(dev_link_t *link)
+static void netwave_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
dev_link_t **linkp;
@@ -489,11 +490,7 @@ static void netwave_detach(dev_link_t *link)
*/
if (link->state & DEV_CONFIG)
netwave_release(link);
-
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
+
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
@@ -986,22 +983,10 @@ static int netwave_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(1, "netwave_event(0x%06x)\n", event);
-
- switch (event) {
- case CS_EVENT_REGISTRATION_COMPLETE:
- DEBUG(0, "netwave_cs: registration complete\n");
- break;
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- netif_device_detach(dev);
- netwave_release(link);
- }
- break;
+ switch (event) {
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
netwave_pcmcia_config( link);
@@ -1504,7 +1489,7 @@ static struct pcmcia_driver netwave_driver = {
},
.attach = netwave_attach,
.event = netwave_event,
- .detach = netwave_detach,
+ .remove = netwave_detach,
.id_table = netwave_ids,
.suspend = netwave_suspend,
.resume = netwave_resume,
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 1d66050e3d6a..00679b6c87c1 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -81,7 +81,7 @@ static dev_link_t *dev_list; /* = NULL */
/********************************************************************/
static void orinoco_cs_release(dev_link_t *link);
-static void orinoco_cs_detach(dev_link_t *link);
+static void orinoco_cs_detach(struct pcmcia_device *p_dev);
/********************************************************************/
/* Device methods */
@@ -165,7 +165,7 @@ orinoco_cs_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
- orinoco_cs_detach(link);
+ orinoco_cs_detach(link->handle);
return NULL;
}
@@ -178,8 +178,9 @@ orinoco_cs_attach(void)
* are freed. Otherwise, the structures will be freed when the device
* is released.
*/
-static void orinoco_cs_detach(dev_link_t *link)
+static void orinoco_cs_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
struct net_device *dev = link->priv;
@@ -193,10 +194,6 @@ static void orinoco_cs_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
orinoco_cs_release(link);
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, and free it */
*linkp = link->next;
DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev);
@@ -551,30 +548,15 @@ orinoco_cs_event(event_t event, int priority,
event_callback_args_t * args)
{
dev_link_t *link = args->client_data;
- struct net_device *dev = link->priv;
- struct orinoco_private *priv = netdev_priv(dev);
- int err = 0;
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- unsigned long flags;
-
- spin_lock_irqsave(&priv->lock, flags);
- netif_device_detach(dev);
- priv->hw_unavailable++;
- spin_unlock_irqrestore(&priv->lock, flags);
- }
- break;
-
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
orinoco_cs_config(link);
break;
}
- return err;
+ return 0;
} /* orinoco_cs_event */
/********************************************************************/
@@ -677,7 +659,7 @@ static struct pcmcia_driver orinoco_driver = {
.name = DRIVER_NAME,
},
.attach = orinoco_cs_attach,
- .detach = orinoco_cs_detach,
+ .remove = orinoco_cs_detach,
.event = orinoco_cs_event,
.id_table = orinoco_cs_ids,
.suspend = orinoco_cs_suspend,
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index c2cb6c8e6d7c..33a89e292126 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -94,7 +94,7 @@ static void ray_config(dev_link_t *link);
static void ray_release(dev_link_t *link);
static int ray_event(event_t event, int priority, event_callback_args_t *args);
static dev_link_t *ray_attach(void);
-static void ray_detach(dev_link_t *);
+static void ray_detach(struct pcmcia_device *p_dev);
/***** Prototypes indicated by device structure ******************************/
static int ray_dev_close(struct net_device *dev);
@@ -402,7 +402,7 @@ static dev_link_t *ray_attach(void)
if (ret != 0) {
printk("ray_cs ray_attach RegisterClient unhappy - detaching\n");
cs_error(link->handle, RegisterClient, ret);
- ray_detach(link);
+ ray_detach(link->handle);
return NULL;
}
DEBUG(2,"ray_cs ray_attach ending\n");
@@ -418,9 +418,12 @@ fail_alloc_dev:
structures are freed. Otherwise, the structures will be freed
when the device is released.
=============================================================================*/
-static void ray_detach(dev_link_t *link)
+static void ray_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
+ struct net_device *dev;
+ ray_dev_t *local;
DEBUG(1, "ray_detach(0x%p)\n", link);
@@ -430,22 +433,18 @@ static void ray_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)
- ray_release(link);
+ dev = link->priv;
+
+ if (link->state & DEV_CONFIG) {
+ ray_release(link);
+
+ local = (ray_dev_t *)dev->priv;
+ del_timer(&local->timer);
+ }
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Unlink device structure, free pieces */
*linkp = link->next;
if (link->priv) {
- struct net_device *dev = link->priv;
if (link->dev) unregister_netdev(dev);
free_netdev(dev);
}
@@ -940,19 +939,9 @@ static int ray_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- struct net_device *dev = link->priv;
- ray_dev_t *local = (ray_dev_t *)dev->priv;
DEBUG(1, "ray_event(0x%06x)\n", event);
-
+
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- netif_device_detach(dev);
- if (link->state & DEV_CONFIG) {
- ray_release(link);
- del_timer(&local->timer);
- }
- break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ray_config(link);
@@ -2958,7 +2947,7 @@ static struct pcmcia_driver ray_driver = {
},
.attach = ray_attach,
.event = ray_event,
- .detach = ray_detach,
+ .remove = ray_detach,
.id_table = ray_ids,
.suspend = ray_suspend,
.resume = ray_resume,
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 3938a5735659..a2dcab7995c1 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -90,7 +90,7 @@ static dev_link_t *dev_list; /* = NULL */
/********************************************************************/
static void spectrum_cs_release(dev_link_t *link);
-static void spectrum_cs_detach(dev_link_t *link);
+static void spectrum_cs_detach(struct pcmcia_device *p_dev);
/********************************************************************/
/* Firmware downloader */
@@ -647,7 +647,7 @@ spectrum_cs_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
- spectrum_cs_detach(link);
+ spectrum_cs_detach(link->handle);
return NULL;
}
@@ -660,27 +660,14 @@ spectrum_cs_attach(void)
* are freed. Otherwise, the structures will be freed when the device
* is released.
*/
-static void spectrum_cs_detach(dev_link_t *link)
+static void spectrum_cs_detach(struct pcmcia_device *p_dev)
{
- dev_link_t **linkp;
+ dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv;
- /* Locate device structure */
- for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
- if (*linkp == link)
- break;
-
- BUG_ON(*linkp == NULL);
-
if (link->state & DEV_CONFIG)
spectrum_cs_release(link);
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
- /* Unlink device structure, and free it */
- *linkp = link->next;
DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev);
if (link->dev) {
DEBUG(0, PFX "About to unregister net device %p\n",
@@ -1007,22 +994,8 @@ spectrum_cs_event(event_t event, int priority,
event_callback_args_t * args)
{
dev_link_t *link = args->client_data;
- struct net_device *dev = link->priv;
- struct orinoco_private *priv = netdev_priv(dev);
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- unsigned long flags;
-
- spin_lock_irqsave(&priv->lock, flags);
- netif_device_detach(dev);
- priv->hw_unavailable++;
- spin_unlock_irqrestore(&priv->lock, flags);
- }
- break;
-
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
spectrum_cs_config(link);
@@ -1057,7 +1030,7 @@ static struct pcmcia_driver orinoco_driver = {
.name = DRIVER_NAME,
},
.attach = spectrum_cs_attach,
- .detach = spectrum_cs_detach,
+ .remove = spectrum_cs_detach,
.suspend = spectrum_cs_suspend,
.resume = spectrum_cs_resume,
.event = spectrum_cs_event,
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 3e3532830c26..255952d8cea0 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -4692,7 +4692,7 @@ wavelan_attach(void)
if(ret != 0)
{
cs_error(link->handle, RegisterClient, ret);
- wavelan_detach(link);
+ wavelan_detach(link->handle);
return NULL;
}
@@ -4711,8 +4711,10 @@ wavelan_attach(void)
* is released.
*/
static void
-wavelan_detach(dev_link_t * link)
+wavelan_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
+
#ifdef DEBUG_CALLBACK_TRACE
printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link);
#endif
@@ -4729,10 +4731,6 @@ wavelan_detach(dev_link_t * link)
wv_pcmcia_release(link);
}
- /* Break the link with Card Services */
- if(link->handle)
- pcmcia_deregister_client(link->handle);
-
/* Remove the interface data from the linked list */
if(dev_list == link)
dev_list = link->next;
@@ -4854,25 +4852,6 @@ wavelan_event(event_t event, /* The event received */
switch(event)
{
- case CS_EVENT_REGISTRATION_COMPLETE:
-#ifdef DEBUG_CONFIG_INFO
- printk(KERN_DEBUG "wavelan_cs: registration complete\n");
-#endif
- break;
-
- case CS_EVENT_CARD_REMOVAL:
- /* Oups ! The card is no more there */
- link->state &= ~DEV_PRESENT;
- if(link->state & DEV_CONFIG)
- {
- /* Accept no more transmissions */
- netif_device_detach(dev);
-
- /* Release the card */
- wv_pcmcia_release(link);
- }
- break;
-
case CS_EVENT_CARD_INSERTION:
/* Reset and configure the card */
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
@@ -4906,7 +4885,7 @@ static struct pcmcia_driver wavelan_driver = {
},
.attach = wavelan_attach,
.event = wavelan_event,
- .detach = wavelan_detach,
+ .remove = wavelan_detach,
.id_table = wavelan_ids,
.suspend = wavelan_suspend,
.resume = wavelan_resume,
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index 724a715089c9..3cb34817c039 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -757,7 +757,7 @@ static int
static dev_link_t *
wavelan_attach(void); /* Create a new device */
static void
- wavelan_detach(dev_link_t *); /* Destroy a removed device */
+ wavelan_detach(struct pcmcia_device *p_dev); /* Destroy a removed device */
static int
wavelan_event(event_t, /* Manage pcmcia events */
int,
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 75114318457e..21e498fe7b14 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -1498,9 +1498,11 @@ static struct ethtool_ops ops = {
* Services. If it has been released, all local data structures are freed.
* Otherwise, the structures will be freed when the device is released.
*/
-static void wl3501_detach(dev_link_t *link)
+static void wl3501_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
+ struct net_device *dev = link->priv;
/* Locate device structure */
for (linkp = &wl3501_dev_list; *linkp; linkp = &(*linkp)->next)
@@ -1514,16 +1516,12 @@ static void wl3501_detach(dev_link_t *link)
* function is called, that will trigger a proper detach(). */
if (link->state & DEV_CONFIG) {
-#ifdef PCMCIA_DEBUG
- printk(KERN_DEBUG "wl3501_cs: detach postponed, '%s' "
- "still locked\n", link->dev->dev_name);
-#endif
- goto out;
- }
+ while (link->open > 0)
+ wl3501_close(dev);
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
+ netif_device_detach(dev);
+ wl3501_release(link);
+ }
/* Unlink device structure, free pieces */
*linkp = link->next;
@@ -2012,7 +2010,7 @@ static dev_link_t *wl3501_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret) {
cs_error(link->handle, RegisterClient, ret);
- wl3501_detach(link);
+ wl3501_detach(link->handle);
link = NULL;
}
out:
@@ -2225,18 +2223,8 @@ static int wl3501_resume(struct pcmcia_device *p_dev)
static int wl3501_event(event_t event, int pri, event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- struct net_device *dev = link->priv;
switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- while (link->open > 0)
- wl3501_close(dev);
- netif_device_detach(dev);
- wl3501_release(link);
- }
- break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
wl3501_config(link);
@@ -2258,7 +2246,7 @@ static struct pcmcia_driver wl3501_driver = {
},
.attach = wl3501_attach,
.event = wl3501_event,
- .detach = wl3501_detach,
+ .remove = wl3501_detach,
.id_table = wl3501_ids,
.suspend = wl3501_suspend,
.resume = wl3501_resume,
OpenPOWER on IntegriCloud