aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/xirc2ps_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/pcmcia/xirc2ps_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/pcmcia/xirc2ps_cs.c')
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index ce143f08638a..917e50ac37f3 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1157,6 +1157,41 @@ xirc2ps_release(dev_link_t *link)
1157 1157
1158/*====================================================================*/ 1158/*====================================================================*/
1159 1159
1160
1161static int xirc2ps_suspend(struct pcmcia_device *p_dev)
1162{
1163 dev_link_t *link = dev_to_instance(p_dev);
1164 struct net_device *dev = link->priv;
1165
1166 link->state |= DEV_SUSPEND;
1167 if (link->state & DEV_CONFIG) {
1168 if (link->open) {
1169 netif_device_detach(dev);
1170 do_powerdown(dev);
1171 }
1172 pcmcia_release_configuration(link->handle);
1173 }
1174
1175 return 0;
1176}
1177
1178static int xirc2ps_resume(struct pcmcia_device *p_dev)
1179{
1180 dev_link_t *link = dev_to_instance(p_dev);
1181 struct net_device *dev = link->priv;
1182
1183 link->state &= ~DEV_SUSPEND;
1184 if (link->state & DEV_CONFIG) {
1185 pcmcia_request_configuration(link->handle, &link->conf);
1186 if (link->open) {
1187 do_reset(dev,1);
1188 netif_device_attach(dev);
1189 }
1190 }
1191
1192 return 0;
1193}
1194
1160/**************** 1195/****************
1161 * The card status event handler. Mostly, this schedules other 1196 * The card status event handler. Mostly, this schedules other
1162 * stuff to run after an event is received. A CARD_REMOVAL event 1197 * stuff to run after an event is received. A CARD_REMOVAL event
@@ -1191,30 +1226,6 @@ xirc2ps_event(event_t event, int priority,
1191 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1226 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1192 xirc2ps_config(link); 1227 xirc2ps_config(link);
1193 break; 1228 break;
1194 case CS_EVENT_PM_SUSPEND:
1195 link->state |= DEV_SUSPEND;
1196 /* Fall through... */
1197 case CS_EVENT_RESET_PHYSICAL:
1198 if (link->state & DEV_CONFIG) {
1199 if (link->open) {
1200 netif_device_detach(dev);
1201 do_powerdown(dev);
1202 }
1203 pcmcia_release_configuration(link->handle);
1204 }
1205 break;
1206 case CS_EVENT_PM_RESUME:
1207 link->state &= ~DEV_SUSPEND;
1208 /* Fall through... */
1209 case CS_EVENT_CARD_RESET:
1210 if (link->state & DEV_CONFIG) {
1211 pcmcia_request_configuration(link->handle, &link->conf);
1212 if (link->open) {
1213 do_reset(dev,1);
1214 netif_device_attach(dev);
1215 }
1216 }
1217 break;
1218 } 1229 }
1219 return 0; 1230 return 0;
1220} /* xirc2ps_event */ 1231} /* xirc2ps_event */
@@ -2013,6 +2024,8 @@ static struct pcmcia_driver xirc2ps_cs_driver = {
2013 .event = xirc2ps_event, 2024 .event = xirc2ps_event,
2014 .detach = xirc2ps_detach, 2025 .detach = xirc2ps_detach,
2015 .id_table = xirc2ps_ids, 2026 .id_table = xirc2ps_ids,
2027 .suspend = xirc2ps_suspend,
2028 .resume = xirc2ps_resume,
2016}; 2029};
2017 2030
2018static int __init 2031static int __init