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/telephony | |
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/telephony')
-rw-r--r-- | drivers/telephony/ixj_pcmcia.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 57c0c6e3fbed..7cca46be0c0f 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -255,6 +255,28 @@ static void ixj_cs_release(dev_link_t *link) | |||
255 | link->state &= ~DEV_CONFIG; | 255 | link->state &= ~DEV_CONFIG; |
256 | } | 256 | } |
257 | 257 | ||
258 | static int ixj_suspend(struct pcmcia_device *dev) | ||
259 | { | ||
260 | dev_link_t *link = dev_to_instance(dev); | ||
261 | |||
262 | link->state |= DEV_SUSPEND; | ||
263 | if (link->state & DEV_CONFIG) | ||
264 | pcmcia_release_configuration(link->handle); | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | static int ixj_resume(struct pcmcia_device *dev) | ||
270 | { | ||
271 | dev_link_t *link = dev_to_instance(dev); | ||
272 | |||
273 | link->state &= ~DEV_SUSPEND; | ||
274 | if (DEV_OK(link)) | ||
275 | pcmcia_request_configuration(link->handle, &link->conf); | ||
276 | |||
277 | return 0; | ||
278 | } | ||
279 | |||
258 | static int ixj_event(event_t event, int priority, event_callback_args_t * args) | 280 | static int ixj_event(event_t event, int priority, event_callback_args_t * args) |
259 | { | 281 | { |
260 | dev_link_t *link = args->client_data; | 282 | dev_link_t *link = args->client_data; |
@@ -271,20 +293,6 @@ static int ixj_event(event_t event, int priority, event_callback_args_t * args) | |||
271 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 293 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
272 | ixj_config(link); | 294 | ixj_config(link); |
273 | break; | 295 | break; |
274 | case CS_EVENT_PM_SUSPEND: | ||
275 | link->state |= DEV_SUSPEND; | ||
276 | /* Fall through... */ | ||
277 | case CS_EVENT_RESET_PHYSICAL: | ||
278 | if (link->state & DEV_CONFIG) | ||
279 | pcmcia_release_configuration(link->handle); | ||
280 | break; | ||
281 | case CS_EVENT_PM_RESUME: | ||
282 | link->state &= ~DEV_SUSPEND; | ||
283 | /* Fall through... */ | ||
284 | case CS_EVENT_CARD_RESET: | ||
285 | if (DEV_OK(link)) | ||
286 | pcmcia_request_configuration(link->handle, &link->conf); | ||
287 | break; | ||
288 | } | 296 | } |
289 | return 0; | 297 | return 0; |
290 | } | 298 | } |
@@ -304,6 +312,8 @@ static struct pcmcia_driver ixj_driver = { | |||
304 | .event = ixj_event, | 312 | .event = ixj_event, |
305 | .detach = ixj_detach, | 313 | .detach = ixj_detach, |
306 | .id_table = ixj_ids, | 314 | .id_table = ixj_ids, |
315 | .suspend = ixj_suspend, | ||
316 | .resume = ixj_resume, | ||
307 | }; | 317 | }; |
308 | 318 | ||
309 | static int __init ixj_pcmcia_init(void) | 319 | static int __init ixj_pcmcia_init(void) |