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/hisax/elsa_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/isdn/hisax/elsa_cs.c')
-rw-r--r-- | drivers/isdn/hisax/elsa_cs.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 6fc6868de0b0..0cbe04593d87 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -447,6 +447,32 @@ static void elsa_cs_release(dev_link_t *link) | |||
447 | link->state &= ~DEV_CONFIG; | 447 | link->state &= ~DEV_CONFIG; |
448 | } /* elsa_cs_release */ | 448 | } /* elsa_cs_release */ |
449 | 449 | ||
450 | static int elsa_suspend(struct pcmcia_device *p_dev) | ||
451 | { | ||
452 | dev_link_t *link = dev_to_instance(p_dev); | ||
453 | local_info_t *dev = link->priv; | ||
454 | |||
455 | link->state |= DEV_SUSPEND; | ||
456 | dev->busy = 1; | ||
457 | if (link->state & DEV_CONFIG) | ||
458 | pcmcia_release_configuration(link->handle); | ||
459 | |||
460 | return 0; | ||
461 | } | ||
462 | |||
463 | static int elsa_resume(struct pcmcia_device *p_dev) | ||
464 | { | ||
465 | dev_link_t *link = dev_to_instance(p_dev); | ||
466 | local_info_t *dev = link->priv; | ||
467 | |||
468 | link->state &= ~DEV_SUSPEND; | ||
469 | if (link->state & DEV_CONFIG) | ||
470 | pcmcia_request_configuration(link->handle, &link->conf); | ||
471 | dev->busy = 0; | ||
472 | |||
473 | return 0; | ||
474 | } | ||
475 | |||
450 | /*====================================================================== | 476 | /*====================================================================== |
451 | 477 | ||
452 | The card status event handler. Mostly, this schedules other | 478 | The card status event handler. Mostly, this schedules other |
@@ -465,7 +491,6 @@ static int elsa_cs_event(event_t event, int priority, | |||
465 | event_callback_args_t *args) | 491 | event_callback_args_t *args) |
466 | { | 492 | { |
467 | dev_link_t *link = args->client_data; | 493 | dev_link_t *link = args->client_data; |
468 | local_info_t *dev = link->priv; | ||
469 | 494 | ||
470 | DEBUG(1, "elsa_cs_event(%d)\n", event); | 495 | DEBUG(1, "elsa_cs_event(%d)\n", event); |
471 | 496 | ||
@@ -481,23 +506,6 @@ static int elsa_cs_event(event_t event, int priority, | |||
481 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 506 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
482 | elsa_cs_config(link); | 507 | elsa_cs_config(link); |
483 | break; | 508 | break; |
484 | case CS_EVENT_PM_SUSPEND: | ||
485 | link->state |= DEV_SUSPEND; | ||
486 | /* Fall through... */ | ||
487 | case CS_EVENT_RESET_PHYSICAL: | ||
488 | /* Mark the device as stopped, to block IO until later */ | ||
489 | dev->busy = 1; | ||
490 | if (link->state & DEV_CONFIG) | ||
491 | pcmcia_release_configuration(link->handle); | ||
492 | break; | ||
493 | case CS_EVENT_PM_RESUME: | ||
494 | link->state &= ~DEV_SUSPEND; | ||
495 | /* Fall through... */ | ||
496 | case CS_EVENT_CARD_RESET: | ||
497 | if (link->state & DEV_CONFIG) | ||
498 | pcmcia_request_configuration(link->handle, &link->conf); | ||
499 | dev->busy = 0; | ||
500 | break; | ||
501 | } | 509 | } |
502 | return 0; | 510 | return 0; |
503 | } /* elsa_cs_event */ | 511 | } /* elsa_cs_event */ |
@@ -518,6 +526,8 @@ static struct pcmcia_driver elsa_cs_driver = { | |||
518 | .event = elsa_cs_event, | 526 | .event = elsa_cs_event, |
519 | .detach = elsa_cs_detach, | 527 | .detach = elsa_cs_detach, |
520 | .id_table = elsa_ids, | 528 | .id_table = elsa_ids, |
529 | .suspend = elsa_suspend, | ||
530 | .resume = elsa_resume, | ||
521 | }; | 531 | }; |
522 | 532 | ||
523 | static int __init init_elsa_cs(void) | 533 | static int __init init_elsa_cs(void) |