aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/aha152x_stub.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/scsi/pcmcia/aha152x_stub.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/scsi/pcmcia/aha152x_stub.c')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 7c5306499832..82988a3e35ec 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -272,11 +272,37 @@ static void aha152x_release_cs(dev_link_t *link)
272 link->state &= ~DEV_CONFIG; 272 link->state &= ~DEV_CONFIG;
273} 273}
274 274
275static int aha152x_suspend(struct pcmcia_device *dev)
276{
277 dev_link_t *link = dev_to_instance(dev);
278
279 link->state |= DEV_SUSPEND;
280 if (link->state & DEV_CONFIG)
281 pcmcia_release_configuration(link->handle);
282
283 return 0;
284}
285
286static int aha152x_resume(struct pcmcia_device *dev)
287{
288 dev_link_t *link = dev_to_instance(dev);
289 scsi_info_t *info = link->priv;
290
291 link->state &= ~DEV_SUSPEND;
292 if (link->state & DEV_CONFIG) {
293 Scsi_Cmnd tmp;
294 pcmcia_request_configuration(link->handle, &link->conf);
295 tmp.device->host = info->host;
296 aha152x_host_reset(&tmp);
297 }
298
299 return 0;
300}
301
275static int aha152x_event(event_t event, int priority, 302static int aha152x_event(event_t event, int priority,
276 event_callback_args_t *args) 303 event_callback_args_t *args)
277{ 304{
278 dev_link_t *link = args->client_data; 305 dev_link_t *link = args->client_data;
279 scsi_info_t *info = link->priv;
280 306
281 DEBUG(0, "aha152x_event(0x%06x)\n", event); 307 DEBUG(0, "aha152x_event(0x%06x)\n", event);
282 308
@@ -290,24 +316,6 @@ static int aha152x_event(event_t event, int priority,
290 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 316 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
291 aha152x_config_cs(link); 317 aha152x_config_cs(link);
292 break; 318 break;
293 case CS_EVENT_PM_SUSPEND:
294 link->state |= DEV_SUSPEND;
295 /* Fall through... */
296 case CS_EVENT_RESET_PHYSICAL:
297 if (link->state & DEV_CONFIG)
298 pcmcia_release_configuration(link->handle);
299 break;
300 case CS_EVENT_PM_RESUME:
301 link->state &= ~DEV_SUSPEND;
302 /* Fall through... */
303 case CS_EVENT_CARD_RESET:
304 if (link->state & DEV_CONFIG) {
305 Scsi_Cmnd tmp;
306 pcmcia_request_configuration(link->handle, &link->conf);
307 tmp.device->host = info->host;
308 aha152x_host_reset(&tmp);
309 }
310 break;
311 } 319 }
312 return 0; 320 return 0;
313} 321}
@@ -331,6 +339,8 @@ static struct pcmcia_driver aha152x_cs_driver = {
331 .event = aha152x_event, 339 .event = aha152x_event,
332 .detach = aha152x_detach, 340 .detach = aha152x_detach,
333 .id_table = aha152x_ids, 341 .id_table = aha152x_ids,
342 .suspend = aha152x_suspend,
343 .resume = aha152x_resume,
334}; 344};
335 345
336static int __init init_aha152x_cs(void) 346static int __init init_aha152x_cs(void)