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/isdn/hardware | |
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/isdn/hardware')
-rw-r--r-- | drivers/isdn/hardware/avm/avm_cs.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 27391c32f3eb..6d9816e10ecb 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -430,6 +430,28 @@ static void avmcs_release(dev_link_t *link) | |||
430 | 430 | ||
431 | } /* avmcs_release */ | 431 | } /* avmcs_release */ |
432 | 432 | ||
433 | static int avmcs_suspend(struct pcmcia_device *dev) | ||
434 | { | ||
435 | dev_link_t *link = dev_to_instance(dev); | ||
436 | |||
437 | link->state |= DEV_SUSPEND; | ||
438 | if (link->state & DEV_CONFIG) | ||
439 | pcmcia_release_configuration(link->handle); | ||
440 | |||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | static int avmcs_resume(struct pcmcia_device *dev) | ||
445 | { | ||
446 | dev_link_t *link = dev_to_instance(dev); | ||
447 | |||
448 | link->state &= ~DEV_SUSPEND; | ||
449 | if (link->state & DEV_CONFIG) | ||
450 | pcmcia_request_configuration(link->handle, &link->conf); | ||
451 | |||
452 | return 0; | ||
453 | } | ||
454 | |||
433 | /*====================================================================== | 455 | /*====================================================================== |
434 | 456 | ||
435 | The card status event handler. Mostly, this schedules other | 457 | The card status event handler. Mostly, this schedules other |
@@ -459,20 +481,6 @@ static int avmcs_event(event_t event, int priority, | |||
459 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 481 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
460 | avmcs_config(link); | 482 | avmcs_config(link); |
461 | break; | 483 | break; |
462 | case CS_EVENT_PM_SUSPEND: | ||
463 | link->state |= DEV_SUSPEND; | ||
464 | /* Fall through... */ | ||
465 | case CS_EVENT_RESET_PHYSICAL: | ||
466 | if (link->state & DEV_CONFIG) | ||
467 | pcmcia_release_configuration(link->handle); | ||
468 | break; | ||
469 | case CS_EVENT_PM_RESUME: | ||
470 | link->state &= ~DEV_SUSPEND; | ||
471 | /* Fall through... */ | ||
472 | case CS_EVENT_CARD_RESET: | ||
473 | if (link->state & DEV_CONFIG) | ||
474 | pcmcia_request_configuration(link->handle, &link->conf); | ||
475 | break; | ||
476 | } | 484 | } |
477 | return 0; | 485 | return 0; |
478 | } /* avmcs_event */ | 486 | } /* avmcs_event */ |
@@ -494,6 +502,8 @@ static struct pcmcia_driver avmcs_driver = { | |||
494 | .event = avmcs_event, | 502 | .event = avmcs_event, |
495 | .detach = avmcs_detach, | 503 | .detach = avmcs_detach, |
496 | .id_table = avmcs_ids, | 504 | .id_table = avmcs_ids, |
505 | .suspend= avmcs_suspend, | ||
506 | .resume = avmcs_resume, | ||
497 | }; | 507 | }; |
498 | 508 | ||
499 | static int __init avmcs_init(void) | 509 | static int __init avmcs_init(void) |