aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ray_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/net/wireless/ray_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/net/wireless/ray_cs.c')
-rw-r--r--drivers/net/wireless/ray_cs.c59
1 files changed, 36 insertions, 23 deletions
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 70fd6fd8feb9..c2cb6c8e6d7c 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -891,6 +891,40 @@ static void ray_release(dev_link_t *link)
891 DEBUG(2,"ray_release ending\n"); 891 DEBUG(2,"ray_release ending\n");
892} 892}
893 893
894static int ray_suspend(struct pcmcia_device *p_dev)
895{
896 dev_link_t *link = dev_to_instance(p_dev);
897 struct net_device *dev = link->priv;
898
899 link->state |= DEV_SUSPEND;
900 if (link->state & DEV_CONFIG) {
901 if (link->open)
902 netif_device_detach(dev);
903
904 pcmcia_release_configuration(link->handle);
905 }
906
907
908 return 0;
909}
910
911static int ray_resume(struct pcmcia_device *p_dev)
912{
913 dev_link_t *link = dev_to_instance(p_dev);
914 struct net_device *dev = link->priv;
915
916 link->state &= ~DEV_SUSPEND;
917 if (link->state & DEV_CONFIG) {
918 pcmcia_request_configuration(link->handle, &link->conf);
919 if (link->open) {
920 ray_reset(dev);
921 netif_device_attach(dev);
922 }
923 }
924
925 return 0;
926}
927
894/*============================================================================= 928/*=============================================================================
895 The card status event handler. Mostly, this schedules other 929 The card status event handler. Mostly, this schedules other
896 stuff to run after an event is received. A CARD_REMOVAL event 930 stuff to run after an event is received. A CARD_REMOVAL event
@@ -923,29 +957,6 @@ static int ray_event(event_t event, int priority,
923 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 957 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
924 ray_config(link); 958 ray_config(link);
925 break; 959 break;
926 case CS_EVENT_PM_SUSPEND:
927 link->state |= DEV_SUSPEND;
928 /* Fall through... */
929 case CS_EVENT_RESET_PHYSICAL:
930 if (link->state & DEV_CONFIG) {
931 if (link->open)
932 netif_device_detach(dev);
933
934 pcmcia_release_configuration(link->handle);
935 }
936 break;
937 case CS_EVENT_PM_RESUME:
938 link->state &= ~DEV_SUSPEND;
939 /* Fall through... */
940 case CS_EVENT_CARD_RESET:
941 if (link->state & DEV_CONFIG) {
942 pcmcia_request_configuration(link->handle, &link->conf);
943 if (link->open) {
944 ray_reset(dev);
945 netif_device_attach(dev);
946 }
947 }
948 break;
949 } 960 }
950 return 0; 961 return 0;
951 DEBUG(2,"ray_event ending\n"); 962 DEBUG(2,"ray_event ending\n");
@@ -2949,6 +2960,8 @@ static struct pcmcia_driver ray_driver = {
2949 .event = ray_event, 2960 .event = ray_event,
2950 .detach = ray_detach, 2961 .detach = ray_detach,
2951 .id_table = ray_ids, 2962 .id_table = ray_ids,
2963 .suspend = ray_suspend,
2964 .resume = ray_resume,
2952}; 2965};
2953 2966
2954static int __init init_ray_cs(void) 2967static int __init init_ray_cs(void)