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/bluetooth/dtl1_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/bluetooth/dtl1_cs.c')
-rw-r--r-- | drivers/bluetooth/dtl1_cs.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index dec5980a1cd6..9f9d3f91f455 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -763,6 +763,27 @@ static void dtl1_release(dev_link_t *link) | |||
763 | link->state &= ~DEV_CONFIG; | 763 | link->state &= ~DEV_CONFIG; |
764 | } | 764 | } |
765 | 765 | ||
766 | static int dtl1_suspend(struct pcmcia_device *dev) | ||
767 | { | ||
768 | dev_link_t *link = dev_to_instance(dev); | ||
769 | |||
770 | link->state |= DEV_SUSPEND; | ||
771 | if (link->state & DEV_CONFIG) | ||
772 | pcmcia_release_configuration(link->handle); | ||
773 | |||
774 | return 0; | ||
775 | } | ||
776 | |||
777 | static int dtl1_resume(struct pcmcia_device *dev) | ||
778 | { | ||
779 | dev_link_t *link = dev_to_instance(dev); | ||
780 | |||
781 | link->state &= ~DEV_SUSPEND; | ||
782 | if (DEV_OK(link)) | ||
783 | pcmcia_request_configuration(link->handle, &link->conf); | ||
784 | |||
785 | return 0; | ||
786 | } | ||
766 | 787 | ||
767 | static int dtl1_event(event_t event, int priority, event_callback_args_t *args) | 788 | static int dtl1_event(event_t event, int priority, event_callback_args_t *args) |
768 | { | 789 | { |
@@ -781,20 +802,6 @@ static int dtl1_event(event_t event, int priority, event_callback_args_t *args) | |||
781 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 802 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
782 | dtl1_config(link); | 803 | dtl1_config(link); |
783 | break; | 804 | break; |
784 | case CS_EVENT_PM_SUSPEND: | ||
785 | link->state |= DEV_SUSPEND; | ||
786 | /* Fall through... */ | ||
787 | case CS_EVENT_RESET_PHYSICAL: | ||
788 | if (link->state & DEV_CONFIG) | ||
789 | pcmcia_release_configuration(link->handle); | ||
790 | break; | ||
791 | case CS_EVENT_PM_RESUME: | ||
792 | link->state &= ~DEV_SUSPEND; | ||
793 | /* Fall through... */ | ||
794 | case CS_EVENT_CARD_RESET: | ||
795 | if (DEV_OK(link)) | ||
796 | pcmcia_request_configuration(link->handle, &link->conf); | ||
797 | break; | ||
798 | } | 805 | } |
799 | 806 | ||
800 | return 0; | 807 | return 0; |
@@ -816,6 +823,8 @@ static struct pcmcia_driver dtl1_driver = { | |||
816 | .event = dtl1_event, | 823 | .event = dtl1_event, |
817 | .detach = dtl1_detach, | 824 | .detach = dtl1_detach, |
818 | .id_table = dtl1_ids, | 825 | .id_table = dtl1_ids, |
826 | .suspend = dtl1_suspend, | ||
827 | .resume = dtl1_resume, | ||
819 | }; | 828 | }; |
820 | 829 | ||
821 | static int __init init_dtl1_cs(void) | 830 | static int __init init_dtl1_cs(void) |