diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 21:21:18 +0100 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 23:59:02 +0100 |
commit | 98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch) | |
tree | b3d46f0643352e541d6a39e6da09059687cf713d /drivers/scsi/pcmcia/qlogic_stub.c | |
parent | 63e7ebd06402951bc8863ba5b7bc9b9f42044849 (diff) | |
download | linux-stable-98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10.tar.gz linux-stable-98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10.tar.bz2 linux-stable-98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10.zip |
[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.c | 59 |
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) /*====================================================================*/ +static int qlogic_suspend(struct pcmcia_device *dev) +{ + dev_link_t *link = dev_to_instance(dev); + + link->state |= DEV_SUSPEND; + if (link->state & DEV_CONFIG) + pcmcia_release_configuration(link->handle); + + return 0; +} + +static int qlogic_resume(struct pcmcia_device *dev) +{ + dev_link_t *link = dev_to_instance(dev); + + link->state &= ~DEV_SUSPEND; + if (link->state & DEV_CONFIG) { + scsi_info_t *info = link->priv; + + pcmcia_request_configuration(link->handle, &link->conf); + if ((info->manf_id == MANFID_MACNICA) || + (info->manf_id == MANFID_PIONEER) || + (info->manf_id == 0x0098)) { + outb(0x80, link->io.BasePort1 + 0xd); + outb(0x24, link->io.BasePort1 + 0x9); + outb(0x04, link->io.BasePort1 + 0xd); + } + /* Ugggglllyyyy!!! */ + qlogicfas408_bus_reset(NULL); + } + + return 0; +} + static int qlogic_event(event_t event, int priority, event_callback_args_t * args) { 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 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; qlogic_config(link); break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (link->state & DEV_CONFIG) { - scsi_info_t *info = link->priv; - pcmcia_request_configuration(link->handle, &link->conf); - if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { - outb(0x80, link->io.BasePort1 + 0xd); - outb(0x24, link->io.BasePort1 + 0x9); - outb(0x04, link->io.BasePort1 + 0xd); - } - /* Ugggglllyyyy!!! */ - qlogicfas408_bus_reset(NULL); - } - break; } return 0; } /* qlogic_event */ @@ -423,6 +434,8 @@ static struct pcmcia_driver qlogic_cs_driver = { .event = qlogic_event, .detach = qlogic_detach, .id_table = qlogic_ids, + .suspend = qlogic_suspend, + .resume = qlogic_resume, }; static int __init init_qlogic_cs(void) |