diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:23:14 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:10 -0500 |
commit | cc3b4866bee996c922e875b8c8efe9f0d8803aae (patch) | |
tree | 6632837b6986f33566f75ed971cecbdc210e3201 /drivers/net/pcmcia/smc91c92_cs.c | |
parent | 8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (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/smc91c92_cs.c')
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 18 |
1 files changed, 5 insertions, 13 deletions
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, | |||
282 | /*====================================================================*/ | 282 | /*====================================================================*/ |
283 | 283 | ||
284 | static dev_link_t *smc91c92_attach(void); | 284 | static dev_link_t *smc91c92_attach(void); |
285 | static void smc91c92_detach(dev_link_t *); | 285 | static void smc91c92_detach(struct pcmcia_device *p_dev); |
286 | static void smc91c92_config(dev_link_t *link); | 286 | static void smc91c92_config(dev_link_t *link); |
287 | static void smc91c92_release(dev_link_t *link); | 287 | static void smc91c92_release(dev_link_t *link); |
288 | static int smc91c92_event(event_t event, int priority, | 288 | static int smc91c92_event(event_t event, int priority, |
@@ -375,7 +375,7 @@ static dev_link_t *smc91c92_attach(void) | |||
375 | ret = pcmcia_register_client(&link->handle, &client_reg); | 375 | ret = pcmcia_register_client(&link->handle, &client_reg); |
376 | if (ret != 0) { | 376 | if (ret != 0) { |
377 | cs_error(link->handle, RegisterClient, ret); | 377 | cs_error(link->handle, RegisterClient, ret); |
378 | smc91c92_detach(link); | 378 | smc91c92_detach(link->handle); |
379 | return NULL; | 379 | return NULL; |
380 | } | 380 | } |
381 | 381 | ||
@@ -391,8 +391,9 @@ static dev_link_t *smc91c92_attach(void) | |||
391 | 391 | ||
392 | ======================================================================*/ | 392 | ======================================================================*/ |
393 | 393 | ||
394 | static void smc91c92_detach(dev_link_t *link) | 394 | static void smc91c92_detach(struct pcmcia_device *p_dev) |
395 | { | 395 | { |
396 | dev_link_t *link = dev_to_instance(p_dev); | ||
396 | struct net_device *dev = link->priv; | 397 | struct net_device *dev = link->priv; |
397 | dev_link_t **linkp; | 398 | dev_link_t **linkp; |
398 | 399 | ||
@@ -410,9 +411,6 @@ static void smc91c92_detach(dev_link_t *link) | |||
410 | if (link->state & DEV_CONFIG) | 411 | if (link->state & DEV_CONFIG) |
411 | smc91c92_release(link); | 412 | smc91c92_release(link); |
412 | 413 | ||
413 | if (link->handle) | ||
414 | pcmcia_deregister_client(link->handle); | ||
415 | |||
416 | /* Unlink device structure, free bits */ | 414 | /* Unlink device structure, free bits */ |
417 | *linkp = link->next; | 415 | *linkp = link->next; |
418 | free_netdev(dev); | 416 | free_netdev(dev); |
@@ -1237,16 +1235,10 @@ static int smc91c92_event(event_t event, int priority, | |||
1237 | event_callback_args_t *args) | 1235 | event_callback_args_t *args) |
1238 | { | 1236 | { |
1239 | dev_link_t *link = args->client_data; | 1237 | dev_link_t *link = args->client_data; |
1240 | struct net_device *dev = link->priv; | ||
1241 | 1238 | ||
1242 | DEBUG(1, "smc91c92_event(0x%06x)\n", event); | 1239 | DEBUG(1, "smc91c92_event(0x%06x)\n", event); |
1243 | 1240 | ||
1244 | switch (event) { | 1241 | switch (event) { |
1245 | case CS_EVENT_CARD_REMOVAL: | ||
1246 | link->state &= ~DEV_PRESENT; | ||
1247 | if (link->state & DEV_CONFIG) | ||
1248 | netif_device_detach(dev); | ||
1249 | break; | ||
1250 | case CS_EVENT_CARD_INSERTION: | 1242 | case CS_EVENT_CARD_INSERTION: |
1251 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1243 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1252 | smc91c92_config(link); | 1244 | smc91c92_config(link); |
@@ -2371,7 +2363,7 @@ static struct pcmcia_driver smc91c92_cs_driver = { | |||
2371 | }, | 2363 | }, |
2372 | .attach = smc91c92_attach, | 2364 | .attach = smc91c92_attach, |
2373 | .event = smc91c92_event, | 2365 | .event = smc91c92_event, |
2374 | .detach = smc91c92_detach, | 2366 | .remove = smc91c92_detach, |
2375 | .id_table = smc91c92_ids, | 2367 | .id_table = smc91c92_ids, |
2376 | .suspend = smc91c92_suspend, | 2368 | .suspend = smc91c92_suspend, |
2377 | .resume = smc91c92_resume, | 2369 | .resume = smc91c92_resume, |