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/avma1_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/avma1_cs.c')
-rw-r--r-- | drivers/isdn/hisax/avma1_cs.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 5f5a5ae740d2..433cec4269a3 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -445,6 +445,28 @@ static void avma1cs_release(dev_link_t *link) | |||
445 | avma1cs_detach(link); | 445 | avma1cs_detach(link); |
446 | } /* avma1cs_release */ | 446 | } /* avma1cs_release */ |
447 | 447 | ||
448 | static int avma1cs_suspend(struct pcmcia_device *dev) | ||
449 | { | ||
450 | dev_link_t *link = dev_to_instance(dev); | ||
451 | |||
452 | link->state |= DEV_SUSPEND; | ||
453 | if (link->state & DEV_CONFIG) | ||
454 | pcmcia_release_configuration(link->handle); | ||
455 | |||
456 | return 0; | ||
457 | } | ||
458 | |||
459 | static int avma1cs_resume(struct pcmcia_device *dev) | ||
460 | { | ||
461 | dev_link_t *link = dev_to_instance(dev); | ||
462 | |||
463 | link->state &= ~DEV_SUSPEND; | ||
464 | if (link->state & DEV_CONFIG) | ||
465 | pcmcia_request_configuration(link->handle, &link->conf); | ||
466 | |||
467 | return 0; | ||
468 | } | ||
469 | |||
448 | /*====================================================================== | 470 | /*====================================================================== |
449 | 471 | ||
450 | The card status event handler. Mostly, this schedules other | 472 | The card status event handler. Mostly, this schedules other |
@@ -475,20 +497,6 @@ static int avma1cs_event(event_t event, int priority, | |||
475 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 497 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
476 | avma1cs_config(link); | 498 | avma1cs_config(link); |
477 | break; | 499 | break; |
478 | case CS_EVENT_PM_SUSPEND: | ||
479 | link->state |= DEV_SUSPEND; | ||
480 | /* Fall through... */ | ||
481 | case CS_EVENT_RESET_PHYSICAL: | ||
482 | if (link->state & DEV_CONFIG) | ||
483 | pcmcia_release_configuration(link->handle); | ||
484 | break; | ||
485 | case CS_EVENT_PM_RESUME: | ||
486 | link->state &= ~DEV_SUSPEND; | ||
487 | /* Fall through... */ | ||
488 | case CS_EVENT_CARD_RESET: | ||
489 | if (link->state & DEV_CONFIG) | ||
490 | pcmcia_request_configuration(link->handle, &link->conf); | ||
491 | break; | ||
492 | } | 500 | } |
493 | return 0; | 501 | return 0; |
494 | } /* avma1cs_event */ | 502 | } /* avma1cs_event */ |
@@ -509,6 +517,8 @@ static struct pcmcia_driver avma1cs_driver = { | |||
509 | .event = avma1cs_event, | 517 | .event = avma1cs_event, |
510 | .detach = avma1cs_detach, | 518 | .detach = avma1cs_detach, |
511 | .id_table = avma1cs_ids, | 519 | .id_table = avma1cs_ids, |
520 | .suspend = avma1cs_suspend, | ||
521 | .resume = avma1cs_resume, | ||
512 | }; | 522 | }; |
513 | 523 | ||
514 | /*====================================================================*/ | 524 | /*====================================================================*/ |