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/net/wireless/netwave_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/net/wireless/netwave_cs.c')
-rw-r--r-- | drivers/net/wireless/netwave_cs.c | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 92793b958e32..7ab2d70ffddf 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -935,6 +935,39 @@ static void netwave_release(dev_link_t *link) | |||
935 | link->state &= ~DEV_CONFIG; | 935 | link->state &= ~DEV_CONFIG; |
936 | } | 936 | } |
937 | 937 | ||
938 | static int netwave_suspend(struct pcmcia_device *p_dev) | ||
939 | { | ||
940 | dev_link_t *link = dev_to_instance(p_dev); | ||
941 | struct net_device *dev = link->priv; | ||
942 | |||
943 | link->state |= DEV_SUSPEND; | ||
944 | if (link->state & DEV_CONFIG) { | ||
945 | if (link->open) | ||
946 | netif_device_detach(dev); | ||
947 | pcmcia_release_configuration(link->handle); | ||
948 | } | ||
949 | |||
950 | return 0; | ||
951 | } | ||
952 | |||
953 | static int netwave_resume(struct pcmcia_device *p_dev) | ||
954 | { | ||
955 | dev_link_t *link = dev_to_instance(p_dev); | ||
956 | struct net_device *dev = link->priv; | ||
957 | |||
958 | link->state &= ~DEV_SUSPEND; | ||
959 | if (link->state & DEV_CONFIG) { | ||
960 | pcmcia_request_configuration(link->handle, &link->conf); | ||
961 | if (link->open) { | ||
962 | netwave_reset(dev); | ||
963 | netif_device_attach(dev); | ||
964 | } | ||
965 | } | ||
966 | |||
967 | return 0; | ||
968 | } | ||
969 | |||
970 | |||
938 | /* | 971 | /* |
939 | * Function netwave_event (event, priority, args) | 972 | * Function netwave_event (event, priority, args) |
940 | * | 973 | * |
@@ -973,28 +1006,6 @@ static int netwave_event(event_t event, int priority, | |||
973 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1006 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
974 | netwave_pcmcia_config( link); | 1007 | netwave_pcmcia_config( link); |
975 | break; | 1008 | break; |
976 | case CS_EVENT_PM_SUSPEND: | ||
977 | link->state |= DEV_SUSPEND; | ||
978 | /* Fall through... */ | ||
979 | case CS_EVENT_RESET_PHYSICAL: | ||
980 | if (link->state & DEV_CONFIG) { | ||
981 | if (link->open) | ||
982 | netif_device_detach(dev); | ||
983 | pcmcia_release_configuration(link->handle); | ||
984 | } | ||
985 | break; | ||
986 | case CS_EVENT_PM_RESUME: | ||
987 | link->state &= ~DEV_SUSPEND; | ||
988 | /* Fall through... */ | ||
989 | case CS_EVENT_CARD_RESET: | ||
990 | if (link->state & DEV_CONFIG) { | ||
991 | pcmcia_request_configuration(link->handle, &link->conf); | ||
992 | if (link->open) { | ||
993 | netwave_reset(dev); | ||
994 | netif_device_attach(dev); | ||
995 | } | ||
996 | } | ||
997 | break; | ||
998 | } | 1009 | } |
999 | return 0; | 1010 | return 0; |
1000 | } /* netwave_event */ | 1011 | } /* netwave_event */ |
@@ -1495,6 +1506,8 @@ static struct pcmcia_driver netwave_driver = { | |||
1495 | .event = netwave_event, | 1506 | .event = netwave_event, |
1496 | .detach = netwave_detach, | 1507 | .detach = netwave_detach, |
1497 | .id_table = netwave_ids, | 1508 | .id_table = netwave_ids, |
1509 | .suspend = netwave_suspend, | ||
1510 | .resume = netwave_resume, | ||
1498 | }; | 1511 | }; |
1499 | 1512 | ||
1500 | static int __init init_netwave_cs(void) | 1513 | static int __init init_netwave_cs(void) |