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/bluecard_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/bluecard_cs.c')
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index f36c563d72c4..5b24131e5430 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -1045,6 +1045,27 @@ static void bluecard_release(dev_link_t *link) | |||
1045 | link->state &= ~DEV_CONFIG; | 1045 | link->state &= ~DEV_CONFIG; |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | static int bluecard_suspend(struct pcmcia_device *dev) | ||
1049 | { | ||
1050 | dev_link_t *link = dev_to_instance(dev); | ||
1051 | |||
1052 | link->state |= DEV_SUSPEND; | ||
1053 | if (link->state & DEV_CONFIG) | ||
1054 | pcmcia_release_configuration(link->handle); | ||
1055 | |||
1056 | return 0; | ||
1057 | } | ||
1058 | |||
1059 | static int bluecard_resume(struct pcmcia_device *dev) | ||
1060 | { | ||
1061 | dev_link_t *link = dev_to_instance(dev); | ||
1062 | |||
1063 | link->state &= ~DEV_SUSPEND; | ||
1064 | if (DEV_OK(link)) | ||
1065 | pcmcia_request_configuration(link->handle, &link->conf); | ||
1066 | |||
1067 | return 0; | ||
1068 | } | ||
1048 | 1069 | ||
1049 | static int bluecard_event(event_t event, int priority, event_callback_args_t *args) | 1070 | static int bluecard_event(event_t event, int priority, event_callback_args_t *args) |
1050 | { | 1071 | { |
@@ -1063,20 +1084,6 @@ static int bluecard_event(event_t event, int priority, event_callback_args_t *ar | |||
1063 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1084 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1064 | bluecard_config(link); | 1085 | bluecard_config(link); |
1065 | break; | 1086 | break; |
1066 | case CS_EVENT_PM_SUSPEND: | ||
1067 | link->state |= DEV_SUSPEND; | ||
1068 | /* Fall through... */ | ||
1069 | case CS_EVENT_RESET_PHYSICAL: | ||
1070 | if (link->state & DEV_CONFIG) | ||
1071 | pcmcia_release_configuration(link->handle); | ||
1072 | break; | ||
1073 | case CS_EVENT_PM_RESUME: | ||
1074 | link->state &= ~DEV_SUSPEND; | ||
1075 | /* Fall through... */ | ||
1076 | case CS_EVENT_CARD_RESET: | ||
1077 | if (DEV_OK(link)) | ||
1078 | pcmcia_request_configuration(link->handle, &link->conf); | ||
1079 | break; | ||
1080 | } | 1087 | } |
1081 | 1088 | ||
1082 | return 0; | 1089 | return 0; |
@@ -1099,6 +1106,8 @@ static struct pcmcia_driver bluecard_driver = { | |||
1099 | .event = bluecard_event, | 1106 | .event = bluecard_event, |
1100 | .detach = bluecard_detach, | 1107 | .detach = bluecard_detach, |
1101 | .id_table = bluecard_ids, | 1108 | .id_table = bluecard_ids, |
1109 | .suspend = bluecard_suspend, | ||
1110 | .resume = bluecard_resume, | ||
1102 | }; | 1111 | }; |
1103 | 1112 | ||
1104 | static int __init init_bluecard_cs(void) | 1113 | static int __init init_bluecard_cs(void) |