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 | |
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')
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 37 | ||||
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 37 | ||||
-rw-r--r-- | drivers/bluetooth/btuart_cs.c | 38 | ||||
-rw-r--r-- | drivers/bluetooth/dtl1_cs.c | 37 |
4 files changed, 93 insertions, 56 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) |
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) |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 529a28a3209d..1828ba6ca25e 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -811,6 +811,28 @@ static void btuart_release(dev_link_t *link) | |||
811 | link->state &= ~DEV_CONFIG; | 811 | link->state &= ~DEV_CONFIG; |
812 | } | 812 | } |
813 | 813 | ||
814 | static int btuart_suspend(struct pcmcia_device *dev) | ||
815 | { | ||
816 | dev_link_t *link = dev_to_instance(dev); | ||
817 | |||
818 | link->state |= DEV_SUSPEND; | ||
819 | if (link->state & DEV_CONFIG) | ||
820 | pcmcia_release_configuration(link->handle); | ||
821 | |||
822 | return 0; | ||
823 | } | ||
824 | |||
825 | static int btuart_resume(struct pcmcia_device *dev) | ||
826 | { | ||
827 | dev_link_t *link = dev_to_instance(dev); | ||
828 | |||
829 | link->state &= ~DEV_SUSPEND; | ||
830 | if (DEV_OK(link)) | ||
831 | pcmcia_request_configuration(link->handle, &link->conf); | ||
832 | |||
833 | return 0; | ||
834 | } | ||
835 | |||
814 | 836 | ||
815 | static int btuart_event(event_t event, int priority, event_callback_args_t *args) | 837 | static int btuart_event(event_t event, int priority, event_callback_args_t *args) |
816 | { | 838 | { |
@@ -829,20 +851,6 @@ static int btuart_event(event_t event, int priority, event_callback_args_t *args | |||
829 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 851 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
830 | btuart_config(link); | 852 | btuart_config(link); |
831 | break; | 853 | break; |
832 | case CS_EVENT_PM_SUSPEND: | ||
833 | link->state |= DEV_SUSPEND; | ||
834 | /* Fall through... */ | ||
835 | case CS_EVENT_RESET_PHYSICAL: | ||
836 | if (link->state & DEV_CONFIG) | ||
837 | pcmcia_release_configuration(link->handle); | ||
838 | break; | ||
839 | case CS_EVENT_PM_RESUME: | ||
840 | link->state &= ~DEV_SUSPEND; | ||
841 | /* Fall through... */ | ||
842 | case CS_EVENT_CARD_RESET: | ||
843 | if (DEV_OK(link)) | ||
844 | pcmcia_request_configuration(link->handle, &link->conf); | ||
845 | break; | ||
846 | } | 854 | } |
847 | 855 | ||
848 | return 0; | 856 | return 0; |
@@ -863,6 +871,8 @@ static struct pcmcia_driver btuart_driver = { | |||
863 | .event = btuart_event, | 871 | .event = btuart_event, |
864 | .detach = btuart_detach, | 872 | .detach = btuart_detach, |
865 | .id_table = btuart_ids, | 873 | .id_table = btuart_ids, |
874 | .suspend = btuart_suspend, | ||
875 | .resume = btuart_resume, | ||
866 | }; | 876 | }; |
867 | 877 | ||
868 | static int __init init_btuart_cs(void) | 878 | static int __init init_btuart_cs(void) |
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) |