diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:21:18 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 17:59:02 -0500 |
commit | 98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch) | |
tree | b3d46f0643352e541d6a39e6da09059687cf713d /drivers/net/wireless/wl3501_cs.c | |
parent | 63e7ebd06402951bc8863ba5b7bc9b9f42044849 (diff) |
[PATCH] pcmcia: new suspend core
Move the suspend and resume methods out of the event handler, and into
special functions. Also use these functions for pre- and post-reset, as
almost all drivers already do, and the remaining ones can easily be
converted.
Bugfix to include/pcmcia/ds.c
Signed-off-by: Andrew Morton <akpm@osdl.org>
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 | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 978fdc606781..75114318457e 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -2173,6 +2173,41 @@ static void wl3501_release(dev_link_t *link) | |||
2173 | link->state &= ~DEV_CONFIG; | 2173 | link->state &= ~DEV_CONFIG; |
2174 | } | 2174 | } |
2175 | 2175 | ||
2176 | static int wl3501_suspend(struct pcmcia_device *p_dev) | ||
2177 | { | ||
2178 | dev_link_t *link = dev_to_instance(p_dev); | ||
2179 | struct net_device *dev = link->priv; | ||
2180 | |||
2181 | link->state |= DEV_SUSPEND; | ||
2182 | |||
2183 | wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); | ||
2184 | if (link->state & DEV_CONFIG) { | ||
2185 | if (link->open) | ||
2186 | netif_device_detach(dev); | ||
2187 | pcmcia_release_configuration(link->handle); | ||
2188 | } | ||
2189 | |||
2190 | return 0; | ||
2191 | } | ||
2192 | |||
2193 | static int wl3501_resume(struct pcmcia_device *p_dev) | ||
2194 | { | ||
2195 | dev_link_t *link = dev_to_instance(p_dev); | ||
2196 | struct net_device *dev = link->priv; | ||
2197 | |||
2198 | wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); | ||
2199 | if (link->state & DEV_CONFIG) { | ||
2200 | pcmcia_request_configuration(link->handle, &link->conf); | ||
2201 | if (link->open) { | ||
2202 | wl3501_reset(dev); | ||
2203 | netif_device_attach(dev); | ||
2204 | } | ||
2205 | } | ||
2206 | |||
2207 | return 0; | ||
2208 | } | ||
2209 | |||
2210 | |||
2176 | /** | 2211 | /** |
2177 | * wl3501_event - The card status event handler | 2212 | * wl3501_event - The card status event handler |
2178 | * @event - event | 2213 | * @event - event |
@@ -2206,30 +2241,6 @@ static int wl3501_event(event_t event, int pri, event_callback_args_t *args) | |||
2206 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 2241 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
2207 | wl3501_config(link); | 2242 | wl3501_config(link); |
2208 | break; | 2243 | break; |
2209 | case CS_EVENT_PM_SUSPEND: | ||
2210 | link->state |= DEV_SUSPEND; | ||
2211 | wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); | ||
2212 | /* Fall through... */ | ||
2213 | case CS_EVENT_RESET_PHYSICAL: | ||
2214 | if (link->state & DEV_CONFIG) { | ||
2215 | if (link->open) | ||
2216 | netif_device_detach(dev); | ||
2217 | pcmcia_release_configuration(link->handle); | ||
2218 | } | ||
2219 | break; | ||
2220 | case CS_EVENT_PM_RESUME: | ||
2221 | link->state &= ~DEV_SUSPEND; | ||
2222 | wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); | ||
2223 | /* Fall through... */ | ||
2224 | case CS_EVENT_CARD_RESET: | ||
2225 | if (link->state & DEV_CONFIG) { | ||
2226 | pcmcia_request_configuration(link->handle, &link->conf); | ||
2227 | if (link->open) { | ||
2228 | wl3501_reset(dev); | ||
2229 | netif_device_attach(dev); | ||
2230 | } | ||
2231 | } | ||
2232 | break; | ||
2233 | } | 2244 | } |
2234 | return 0; | 2245 | return 0; |
2235 | } | 2246 | } |
@@ -2249,6 +2260,8 @@ static struct pcmcia_driver wl3501_driver = { | |||
2249 | .event = wl3501_event, | 2260 | .event = wl3501_event, |
2250 | .detach = wl3501_detach, | 2261 | .detach = wl3501_detach, |
2251 | .id_table = wl3501_ids, | 2262 | .id_table = wl3501_ids, |
2263 | .suspend = wl3501_suspend, | ||
2264 | .resume = wl3501_resume, | ||
2252 | }; | 2265 | }; |
2253 | 2266 | ||
2254 | static int __init wl3501_init_module(void) | 2267 | static int __init wl3501_init_module(void) |