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/scsi/pcmcia/fdomain_stub.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/scsi/pcmcia/fdomain_stub.c')
-rw-r--r-- | drivers/scsi/pcmcia/fdomain_stub.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index db8f5cd85ffe..9e1d68c14694 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -256,6 +256,30 @@ static void fdomain_release(dev_link_t *link) | |||
256 | 256 | ||
257 | /*====================================================================*/ | 257 | /*====================================================================*/ |
258 | 258 | ||
259 | static int fdomain_suspend(struct pcmcia_device *dev) | ||
260 | { | ||
261 | dev_link_t *link = dev_to_instance(dev); | ||
262 | |||
263 | link->state |= DEV_SUSPEND; | ||
264 | if (link->state & DEV_CONFIG) | ||
265 | pcmcia_release_configuration(link->handle); | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | static int fdomain_resume(struct pcmcia_device *dev) | ||
271 | { | ||
272 | dev_link_t *link = dev_to_instance(dev); | ||
273 | |||
274 | link->state &= ~DEV_SUSPEND; | ||
275 | if (link->state & DEV_CONFIG) { | ||
276 | pcmcia_request_configuration(link->handle, &link->conf); | ||
277 | fdomain_16x0_bus_reset(NULL); | ||
278 | } | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
259 | static int fdomain_event(event_t event, int priority, | 283 | static int fdomain_event(event_t event, int priority, |
260 | event_callback_args_t *args) | 284 | event_callback_args_t *args) |
261 | { | 285 | { |
@@ -273,22 +297,6 @@ static int fdomain_event(event_t event, int priority, | |||
273 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 297 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
274 | fdomain_config(link); | 298 | fdomain_config(link); |
275 | break; | 299 | break; |
276 | case CS_EVENT_PM_SUSPEND: | ||
277 | link->state |= DEV_SUSPEND; | ||
278 | /* Fall through... */ | ||
279 | case CS_EVENT_RESET_PHYSICAL: | ||
280 | if (link->state & DEV_CONFIG) | ||
281 | pcmcia_release_configuration(link->handle); | ||
282 | break; | ||
283 | case CS_EVENT_PM_RESUME: | ||
284 | link->state &= ~DEV_SUSPEND; | ||
285 | /* Fall through... */ | ||
286 | case CS_EVENT_CARD_RESET: | ||
287 | if (link->state & DEV_CONFIG) { | ||
288 | pcmcia_request_configuration(link->handle, &link->conf); | ||
289 | fdomain_16x0_bus_reset(NULL); | ||
290 | } | ||
291 | break; | ||
292 | } | 300 | } |
293 | return 0; | 301 | return 0; |
294 | } /* fdomain_event */ | 302 | } /* fdomain_event */ |
@@ -311,6 +319,8 @@ static struct pcmcia_driver fdomain_cs_driver = { | |||
311 | .event = fdomain_event, | 319 | .event = fdomain_event, |
312 | .detach = fdomain_detach, | 320 | .detach = fdomain_detach, |
313 | .id_table = fdomain_ids, | 321 | .id_table = fdomain_ids, |
322 | .suspend = fdomain_suspend, | ||
323 | .resume = fdomain_resume, | ||
314 | }; | 324 | }; |
315 | 325 | ||
316 | static int __init init_fdomain_cs(void) | 326 | static int __init init_fdomain_cs(void) |