aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/cm4040_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/char/pcmcia/cm4040_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/char/pcmcia/cm4040_cs.c')
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 4c698d908ffa..3622fd39c47b 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -656,31 +656,7 @@ static int reader_event(event_t event, int priority,
656 DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n"); 656 DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n");
657 link->state &= ~DEV_PRESENT; 657 link->state &= ~DEV_PRESENT;
658 break; 658 break;
659 case CS_EVENT_PM_SUSPEND: 659
660 DEBUGP(5, dev, "CS_EVENT_PM_SUSPEND "
661 "(fall-through to CS_EVENT_RESET_PHYSICAL)\n");
662 link->state |= DEV_SUSPEND;
663
664 case CS_EVENT_RESET_PHYSICAL:
665 DEBUGP(5, dev, "CS_EVENT_RESET_PHYSICAL\n");
666 if (link->state & DEV_CONFIG) {
667 DEBUGP(5, dev, "ReleaseConfiguration\n");
668 pcmcia_release_configuration(link->handle);
669 }
670 break;
671 case CS_EVENT_PM_RESUME:
672 DEBUGP(5, dev, "CS_EVENT_PM_RESUME "
673 "(fall-through to CS_EVENT_CARD_RESET)\n");
674 link->state &= ~DEV_SUSPEND;
675
676 case CS_EVENT_CARD_RESET:
677 DEBUGP(5, dev, "CS_EVENT_CARD_RESET\n");
678 if ((link->state & DEV_CONFIG)) {
679 DEBUGP(5, dev, "RequestConfiguration\n");
680 pcmcia_request_configuration(link->handle,
681 &link->conf);
682 }
683 break;
684 default: 660 default:
685 DEBUGP(5, dev, "reader_event: unknown event %.2x\n", 661 DEBUGP(5, dev, "reader_event: unknown event %.2x\n",
686 event); 662 event);
@@ -690,6 +666,28 @@ static int reader_event(event_t event, int priority,
690 return CS_SUCCESS; 666 return CS_SUCCESS;
691} 667}
692 668
669static int reader_suspend(struct pcmcia_device *p_dev)
670{
671 dev_link_t *link = dev_to_instance(p_dev);
672
673 link->state |= DEV_SUSPEND;
674 if (link->state & DEV_CONFIG)
675 pcmcia_release_configuration(link->handle);
676
677 return 0;
678}
679
680static int reader_resume(struct pcmcia_device *p_dev)
681{
682 dev_link_t *link = dev_to_instance(p_dev);
683
684 link->state &= ~DEV_SUSPEND;
685 if (link->state & DEV_CONFIG)
686 pcmcia_request_configuration(link->handle, &link->conf);
687
688 return 0;
689}
690
693static void reader_release(dev_link_t *link) 691static void reader_release(dev_link_t *link)
694{ 692{
695 cm4040_reader_release(link->priv); 693 cm4040_reader_release(link->priv);
@@ -806,6 +804,8 @@ static struct pcmcia_driver reader_driver = {
806 }, 804 },
807 .attach = reader_attach, 805 .attach = reader_attach,
808 .detach = reader_detach, 806 .detach = reader_detach,
807 .suspend = reader_suspend,
808 .resume = reader_resume,
809 .event = reader_event, 809 .event = reader_event,
810 .id_table = cm4040_ids, 810 .id_table = cm4040_ids,
811}; 811};