aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/axnet_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/net/pcmcia/axnet_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/axnet_cs.c')
-rw-r--r--drivers/net/pcmcia/axnet_cs.c18
1 files changed, 5 insertions, 13 deletions
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,
108 const u_char *buf, const int start_page); 108 const u_char *buf, const int start_page);
109 109
110static dev_link_t *axnet_attach(void); 110static dev_link_t *axnet_attach(void);
111static void axnet_detach(dev_link_t *); 111static void axnet_detach(struct pcmcia_device *p_dev);
112 112
113static dev_info_t dev_info = "axnet_cs"; 113static dev_info_t dev_info = "axnet_cs";
114static dev_link_t *dev_list; 114static dev_link_t *dev_list;
@@ -185,7 +185,7 @@ static dev_link_t *axnet_attach(void)
185 ret = pcmcia_register_client(&link->handle, &client_reg); 185 ret = pcmcia_register_client(&link->handle, &client_reg);
186 if (ret != CS_SUCCESS) { 186 if (ret != CS_SUCCESS) {
187 cs_error(link->handle, RegisterClient, ret); 187 cs_error(link->handle, RegisterClient, ret);
188 axnet_detach(link); 188 axnet_detach(link->handle);
189 return NULL; 189 return NULL;
190 } 190 }
191 191
@@ -201,8 +201,9 @@ static dev_link_t *axnet_attach(void)
201 201
202======================================================================*/ 202======================================================================*/
203 203
204static void axnet_detach(dev_link_t *link) 204static void axnet_detach(struct pcmcia_device *p_dev)
205{ 205{
206 dev_link_t *link = dev_to_instance(p_dev);
206 struct net_device *dev = link->priv; 207 struct net_device *dev = link->priv;
207 dev_link_t **linkp; 208 dev_link_t **linkp;
208 209
@@ -220,9 +221,6 @@ static void axnet_detach(dev_link_t *link)
220 if (link->state & DEV_CONFIG) 221 if (link->state & DEV_CONFIG)
221 axnet_release(link); 222 axnet_release(link);
222 223
223 if (link->handle)
224 pcmcia_deregister_client(link->handle);
225
226 /* Unlink device structure, free bits */ 224 /* Unlink device structure, free bits */
227 *linkp = link->next; 225 *linkp = link->next;
228 free_netdev(dev); 226 free_netdev(dev);
@@ -537,16 +535,10 @@ static int axnet_event(event_t event, int priority,
537 event_callback_args_t *args) 535 event_callback_args_t *args)
538{ 536{
539 dev_link_t *link = args->client_data; 537 dev_link_t *link = args->client_data;
540 struct net_device *dev = link->priv;
541 538
542 DEBUG(2, "axnet_event(0x%06x)\n", event); 539 DEBUG(2, "axnet_event(0x%06x)\n", event);
543 540
544 switch (event) { 541 switch (event) {
545 case CS_EVENT_CARD_REMOVAL:
546 link->state &= ~DEV_PRESENT;
547 if (link->state & DEV_CONFIG)
548 netif_device_detach(dev);
549 break;
550 case CS_EVENT_CARD_INSERTION: 542 case CS_EVENT_CARD_INSERTION:
551 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 543 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
552 axnet_config(link); 544 axnet_config(link);
@@ -890,7 +882,7 @@ static struct pcmcia_driver axnet_cs_driver = {
890 }, 882 },
891 .attach = axnet_attach, 883 .attach = axnet_attach,
892 .event = axnet_event, 884 .event = axnet_event,
893 .detach = axnet_detach, 885 .remove = axnet_detach,
894 .id_table = axnet_ids, 886 .id_table = axnet_ids,
895 .suspend = axnet_suspend, 887 .suspend = axnet_suspend,
896 .resume = axnet_resume, 888 .resume = axnet_resume,