aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/qlogic_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/qlogic_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/qlogic_stub.c')
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c59
1 files changed, 36 insertions, 23 deletions
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index bb091a45a880..2541a999a0e5 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -349,6 +349,40 @@ static void qlogic_release(dev_link_t *link)
349 349
350/*====================================================================*/ 350/*====================================================================*/
351 351
352static int qlogic_suspend(struct pcmcia_device *dev)
353{
354 dev_link_t *link = dev_to_instance(dev);
355
356 link->state |= DEV_SUSPEND;
357 if (link->state & DEV_CONFIG)
358 pcmcia_release_configuration(link->handle);
359
360 return 0;
361}
362
363static int qlogic_resume(struct pcmcia_device *dev)
364{
365 dev_link_t *link = dev_to_instance(dev);
366
367 link->state &= ~DEV_SUSPEND;
368 if (link->state & DEV_CONFIG) {
369 scsi_info_t *info = link->priv;
370
371 pcmcia_request_configuration(link->handle, &link->conf);
372 if ((info->manf_id == MANFID_MACNICA) ||
373 (info->manf_id == MANFID_PIONEER) ||
374 (info->manf_id == 0x0098)) {
375 outb(0x80, link->io.BasePort1 + 0xd);
376 outb(0x24, link->io.BasePort1 + 0x9);
377 outb(0x04, link->io.BasePort1 + 0xd);
378 }
379 /* Ugggglllyyyy!!! */
380 qlogicfas408_bus_reset(NULL);
381 }
382
383 return 0;
384}
385
352static int qlogic_event(event_t event, int priority, event_callback_args_t * args) 386static int qlogic_event(event_t event, int priority, event_callback_args_t * args)
353{ 387{
354 dev_link_t *link = args->client_data; 388 dev_link_t *link = args->client_data;
@@ -365,29 +399,6 @@ static int qlogic_event(event_t event, int priority, event_callback_args_t * arg
365 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 399 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
366 qlogic_config(link); 400 qlogic_config(link);
367 break; 401 break;
368 case CS_EVENT_PM_SUSPEND:
369 link->state |= DEV_SUSPEND;
370 /* Fall through... */
371 case CS_EVENT_RESET_PHYSICAL:
372 if (link->state & DEV_CONFIG)
373 pcmcia_release_configuration(link->handle);
374 break;
375 case CS_EVENT_PM_RESUME:
376 link->state &= ~DEV_SUSPEND;
377 /* Fall through... */
378 case CS_EVENT_CARD_RESET:
379 if (link->state & DEV_CONFIG) {
380 scsi_info_t *info = link->priv;
381 pcmcia_request_configuration(link->handle, &link->conf);
382 if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) {
383 outb(0x80, link->io.BasePort1 + 0xd);
384 outb(0x24, link->io.BasePort1 + 0x9);
385 outb(0x04, link->io.BasePort1 + 0xd);
386 }
387 /* Ugggglllyyyy!!! */
388 qlogicfas408_bus_reset(NULL);
389 }
390 break;
391 } 402 }
392 return 0; 403 return 0;
393} /* qlogic_event */ 404} /* qlogic_event */
@@ -423,6 +434,8 @@ static struct pcmcia_driver qlogic_cs_driver = {
423 .event = qlogic_event, 434 .event = qlogic_event,
424 .detach = qlogic_detach, 435 .detach = qlogic_detach,
425 .id_table = qlogic_ids, 436 .id_table = qlogic_ids,
437 .suspend = qlogic_suspend,
438 .resume = qlogic_resume,
426}; 439};
427 440
428static int __init init_qlogic_cs(void) 441static int __init init_qlogic_cs(void)