aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/sedlbauer_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:21:18 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 17:59:02 -0500
commit98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch)
treeb3d46f0643352e541d6a39e6da09059687cf713d /drivers/isdn/hisax/sedlbauer_cs.c
parent63e7ebd06402951bc8863ba5b7bc9b9f42044849 (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/sedlbauer_cs.c')
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index dc334aab433e..27dce7c7b760 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -553,6 +553,32 @@ static void sedlbauer_release(dev_link_t *link)
553 553
554} /* sedlbauer_release */ 554} /* sedlbauer_release */
555 555
556static int sedlbauer_suspend(struct pcmcia_device *p_dev)
557{
558 dev_link_t *link = dev_to_instance(p_dev);
559 local_info_t *dev = link->priv;
560
561 link->state |= DEV_SUSPEND;
562 dev->stop = 1;
563 if (link->state & DEV_CONFIG)
564 pcmcia_release_configuration(link->handle);
565
566 return 0;
567}
568
569static int sedlbauer_resume(struct pcmcia_device *p_dev)
570{
571 dev_link_t *link = dev_to_instance(p_dev);
572 local_info_t *dev = link->priv;
573
574 link->state &= ~DEV_SUSPEND;
575 if (link->state & DEV_CONFIG)
576 pcmcia_request_configuration(link->handle, &link->conf);
577 dev->stop = 0;
578
579 return 0;
580}
581
556/*====================================================================== 582/*======================================================================
557 583
558 The card status event handler. Mostly, this schedules other 584 The card status event handler. Mostly, this schedules other
@@ -569,7 +595,6 @@ static int sedlbauer_event(event_t event, int priority,
569 event_callback_args_t *args) 595 event_callback_args_t *args)
570{ 596{
571 dev_link_t *link = args->client_data; 597 dev_link_t *link = args->client_data;
572 local_info_t *dev = link->priv;
573 598
574 DEBUG(1, "sedlbauer_event(0x%06x)\n", event); 599 DEBUG(1, "sedlbauer_event(0x%06x)\n", event);
575 600
@@ -585,27 +610,6 @@ static int sedlbauer_event(event_t event, int priority,
585 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 610 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
586 sedlbauer_config(link); 611 sedlbauer_config(link);
587 break; 612 break;
588 case CS_EVENT_PM_SUSPEND:
589 link->state |= DEV_SUSPEND;
590 /* Fall through... */
591 case CS_EVENT_RESET_PHYSICAL:
592 /* Mark the device as stopped, to block IO until later */
593 dev->stop = 1;
594 if (link->state & DEV_CONFIG)
595 pcmcia_release_configuration(link->handle);
596 break;
597 case CS_EVENT_PM_RESUME:
598 link->state &= ~DEV_SUSPEND;
599 /* Fall through... */
600 case CS_EVENT_CARD_RESET:
601 if (link->state & DEV_CONFIG)
602 pcmcia_request_configuration(link->handle, &link->conf);
603 dev->stop = 0;
604 /*
605 In a normal driver, additional code may go here to restore
606 the device state and restart IO.
607 */
608 break;
609 } 613 }
610 return 0; 614 return 0;
611} /* sedlbauer_event */ 615} /* sedlbauer_event */
@@ -631,6 +635,8 @@ static struct pcmcia_driver sedlbauer_driver = {
631 .event = sedlbauer_event, 635 .event = sedlbauer_event,
632 .detach = sedlbauer_detach, 636 .detach = sedlbauer_detach,
633 .id_table = sedlbauer_ids, 637 .id_table = sedlbauer_ids,
638 .suspend = sedlbauer_suspend,
639 .resume = sedlbauer_resume,
634}; 640};
635 641
636static int __init init_sedlbauer_cs(void) 642static int __init init_sedlbauer_cs(void)