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/bt3c_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/bt3c_cs.c')
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index d2a0add19cc8..1d524baa24a0 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -891,6 +891,27 @@ static void bt3c_release(dev_link_t *link) | |||
891 | link->state &= ~DEV_CONFIG; | 891 | link->state &= ~DEV_CONFIG; |
892 | } | 892 | } |
893 | 893 | ||
894 | static int bt3c_suspend(struct pcmcia_device *dev) | ||
895 | { | ||
896 | dev_link_t *link = dev_to_instance(dev); | ||
897 | |||
898 | link->state |= DEV_SUSPEND; | ||
899 | if (link->state & DEV_CONFIG) | ||
900 | pcmcia_release_configuration(link->handle); | ||
901 | |||
902 | return 0; | ||
903 | } | ||
904 | |||
905 | static int bt3c_resume(struct pcmcia_device *dev) | ||
906 | { | ||
907 | dev_link_t *link = dev_to_instance(dev); | ||
908 | |||
909 | link->state &= ~DEV_SUSPEND; | ||
910 | if (DEV_OK(link)) | ||
911 | pcmcia_request_configuration(link->handle, &link->conf); | ||
912 | |||
913 | return 0; | ||
914 | } | ||
894 | 915 | ||
895 | static int bt3c_event(event_t event, int priority, event_callback_args_t *args) | 916 | static int bt3c_event(event_t event, int priority, event_callback_args_t *args) |
896 | { | 917 | { |
@@ -909,20 +930,6 @@ static int bt3c_event(event_t event, int priority, event_callback_args_t *args) | |||
909 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 930 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
910 | bt3c_config(link); | 931 | bt3c_config(link); |
911 | break; | 932 | break; |
912 | case CS_EVENT_PM_SUSPEND: | ||
913 | link->state |= DEV_SUSPEND; | ||
914 | /* Fall through... */ | ||
915 | case CS_EVENT_RESET_PHYSICAL: | ||
916 | if (link->state & DEV_CONFIG) | ||
917 | pcmcia_release_configuration(link->handle); | ||
918 | break; | ||
919 | case CS_EVENT_PM_RESUME: | ||
920 | link->state &= ~DEV_SUSPEND; | ||
921 | /* Fall through... */ | ||
922 | case CS_EVENT_CARD_RESET: | ||
923 | if (DEV_OK(link)) | ||
924 | pcmcia_request_configuration(link->handle, &link->conf); | ||
925 | break; | ||
926 | } | 933 | } |
927 | 934 | ||
928 | return 0; | 935 | return 0; |
@@ -943,6 +950,8 @@ static struct pcmcia_driver bt3c_driver = { | |||
943 | .event = bt3c_event, | 950 | .event = bt3c_event, |
944 | .detach = bt3c_detach, | 951 | .detach = bt3c_detach, |
945 | .id_table = bt3c_ids, | 952 | .id_table = bt3c_ids, |
953 | .suspend = bt3c_suspend, | ||
954 | .resume = bt3c_resume, | ||
946 | }; | 955 | }; |
947 | 956 | ||
948 | static int __init init_bt3c_cs(void) | 957 | static int __init init_bt3c_cs(void) |