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/teles_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/teles_cs.c')
-rw-r--r-- | drivers/isdn/hisax/teles_cs.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 0ddef1bf778b..70213bc1d30c 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -428,6 +428,32 @@ static void teles_cs_release(dev_link_t *link) | |||
428 | link->state &= ~DEV_CONFIG; | 428 | link->state &= ~DEV_CONFIG; |
429 | } /* teles_cs_release */ | 429 | } /* teles_cs_release */ |
430 | 430 | ||
431 | static int teles_suspend(struct pcmcia_device *p_dev) | ||
432 | { | ||
433 | dev_link_t *link = dev_to_instance(p_dev); | ||
434 | local_info_t *dev = link->priv; | ||
435 | |||
436 | link->state |= DEV_SUSPEND; | ||
437 | dev->busy = 1; | ||
438 | if (link->state & DEV_CONFIG) | ||
439 | pcmcia_release_configuration(link->handle); | ||
440 | |||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | static int teles_resume(struct pcmcia_device *p_dev) | ||
445 | { | ||
446 | dev_link_t *link = dev_to_instance(p_dev); | ||
447 | local_info_t *dev = link->priv; | ||
448 | |||
449 | link->state &= ~DEV_SUSPEND; | ||
450 | if (link->state & DEV_CONFIG) | ||
451 | pcmcia_request_configuration(link->handle, &link->conf); | ||
452 | dev->busy = 0; | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | |||
431 | /*====================================================================== | 457 | /*====================================================================== |
432 | 458 | ||
433 | The card status event handler. Mostly, this schedules other | 459 | The card status event handler. Mostly, this schedules other |
@@ -446,7 +472,6 @@ static int teles_cs_event(event_t event, int priority, | |||
446 | event_callback_args_t *args) | 472 | event_callback_args_t *args) |
447 | { | 473 | { |
448 | dev_link_t *link = args->client_data; | 474 | dev_link_t *link = args->client_data; |
449 | local_info_t *dev = link->priv; | ||
450 | 475 | ||
451 | DEBUG(1, "teles_cs_event(%d)\n", event); | 476 | DEBUG(1, "teles_cs_event(%d)\n", event); |
452 | 477 | ||
@@ -462,23 +487,6 @@ static int teles_cs_event(event_t event, int priority, | |||
462 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 487 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
463 | teles_cs_config(link); | 488 | teles_cs_config(link); |
464 | break; | 489 | break; |
465 | case CS_EVENT_PM_SUSPEND: | ||
466 | link->state |= DEV_SUSPEND; | ||
467 | /* Fall through... */ | ||
468 | case CS_EVENT_RESET_PHYSICAL: | ||
469 | /* Mark the device as stopped, to block IO until later */ | ||
470 | dev->busy = 1; | ||
471 | if (link->state & DEV_CONFIG) | ||
472 | pcmcia_release_configuration(link->handle); | ||
473 | break; | ||
474 | case CS_EVENT_PM_RESUME: | ||
475 | link->state &= ~DEV_SUSPEND; | ||
476 | /* Fall through... */ | ||
477 | case CS_EVENT_CARD_RESET: | ||
478 | if (link->state & DEV_CONFIG) | ||
479 | pcmcia_request_configuration(link->handle, &link->conf); | ||
480 | dev->busy = 0; | ||
481 | break; | ||
482 | } | 490 | } |
483 | return 0; | 491 | return 0; |
484 | } /* teles_cs_event */ | 492 | } /* teles_cs_event */ |
@@ -498,6 +506,8 @@ static struct pcmcia_driver teles_cs_driver = { | |||
498 | .event = teles_cs_event, | 506 | .event = teles_cs_event, |
499 | .detach = teles_detach, | 507 | .detach = teles_detach, |
500 | .id_table = teles_ids, | 508 | .id_table = teles_ids, |
509 | .suspend = teles_suspend, | ||
510 | .resume = teles_resume, | ||
501 | }; | 511 | }; |
502 | 512 | ||
503 | static int __init init_teles_cs(void) | 513 | static int __init init_teles_cs(void) |