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/wireless/wl3501_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/wireless/wl3501_cs.c')
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 32 |
1 files changed, 10 insertions, 22 deletions
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 = { | |||
1498 | * Services. If it has been released, all local data structures are freed. | 1498 | * Services. If it has been released, all local data structures are freed. |
1499 | * Otherwise, the structures will be freed when the device is released. | 1499 | * Otherwise, the structures will be freed when the device is released. |
1500 | */ | 1500 | */ |
1501 | static void wl3501_detach(dev_link_t *link) | 1501 | static void wl3501_detach(struct pcmcia_device *p_dev) |
1502 | { | 1502 | { |
1503 | dev_link_t *link = dev_to_instance(p_dev); | ||
1503 | dev_link_t **linkp; | 1504 | dev_link_t **linkp; |
1505 | struct net_device *dev = link->priv; | ||
1504 | 1506 | ||
1505 | /* Locate device structure */ | 1507 | /* Locate device structure */ |
1506 | for (linkp = &wl3501_dev_list; *linkp; linkp = &(*linkp)->next) | 1508 | for (linkp = &wl3501_dev_list; *linkp; linkp = &(*linkp)->next) |
@@ -1514,16 +1516,12 @@ static void wl3501_detach(dev_link_t *link) | |||
1514 | * function is called, that will trigger a proper detach(). */ | 1516 | * function is called, that will trigger a proper detach(). */ |
1515 | 1517 | ||
1516 | if (link->state & DEV_CONFIG) { | 1518 | if (link->state & DEV_CONFIG) { |
1517 | #ifdef PCMCIA_DEBUG | 1519 | while (link->open > 0) |
1518 | printk(KERN_DEBUG "wl3501_cs: detach postponed, '%s' " | 1520 | wl3501_close(dev); |
1519 | "still locked\n", link->dev->dev_name); | ||
1520 | #endif | ||
1521 | goto out; | ||
1522 | } | ||
1523 | 1521 | ||
1524 | /* Break the link with Card Services */ | 1522 | netif_device_detach(dev); |
1525 | if (link->handle) | 1523 | wl3501_release(link); |
1526 | pcmcia_deregister_client(link->handle); | 1524 | } |
1527 | 1525 | ||
1528 | /* Unlink device structure, free pieces */ | 1526 | /* Unlink device structure, free pieces */ |
1529 | *linkp = link->next; | 1527 | *linkp = link->next; |
@@ -2012,7 +2010,7 @@ static dev_link_t *wl3501_attach(void) | |||
2012 | ret = pcmcia_register_client(&link->handle, &client_reg); | 2010 | ret = pcmcia_register_client(&link->handle, &client_reg); |
2013 | if (ret) { | 2011 | if (ret) { |
2014 | cs_error(link->handle, RegisterClient, ret); | 2012 | cs_error(link->handle, RegisterClient, ret); |
2015 | wl3501_detach(link); | 2013 | wl3501_detach(link->handle); |
2016 | link = NULL; | 2014 | link = NULL; |
2017 | } | 2015 | } |
2018 | out: | 2016 | out: |
@@ -2225,18 +2223,8 @@ static int wl3501_resume(struct pcmcia_device *p_dev) | |||
2225 | static int wl3501_event(event_t event, int pri, event_callback_args_t *args) | 2223 | static int wl3501_event(event_t event, int pri, event_callback_args_t *args) |
2226 | { | 2224 | { |
2227 | dev_link_t *link = args->client_data; | 2225 | dev_link_t *link = args->client_data; |
2228 | struct net_device *dev = link->priv; | ||
2229 | 2226 | ||
2230 | switch (event) { | 2227 | switch (event) { |
2231 | case CS_EVENT_CARD_REMOVAL: | ||
2232 | link->state &= ~DEV_PRESENT; | ||
2233 | if (link->state & DEV_CONFIG) { | ||
2234 | while (link->open > 0) | ||
2235 | wl3501_close(dev); | ||
2236 | netif_device_detach(dev); | ||
2237 | wl3501_release(link); | ||
2238 | } | ||
2239 | break; | ||
2240 | case CS_EVENT_CARD_INSERTION: | 2228 | case CS_EVENT_CARD_INSERTION: |
2241 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 2229 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
2242 | wl3501_config(link); | 2230 | wl3501_config(link); |
@@ -2258,7 +2246,7 @@ static struct pcmcia_driver wl3501_driver = { | |||
2258 | }, | 2246 | }, |
2259 | .attach = wl3501_attach, | 2247 | .attach = wl3501_attach, |
2260 | .event = wl3501_event, | 2248 | .event = wl3501_event, |
2261 | .detach = wl3501_detach, | 2249 | .remove = wl3501_detach, |
2262 | .id_table = wl3501_ids, | 2250 | .id_table = wl3501_ids, |
2263 | .suspend = wl3501_suspend, | 2251 | .suspend = wl3501_suspend, |
2264 | .resume = wl3501_resume, | 2252 | .resume = wl3501_resume, |