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/nsp_cs.c | |
parent | 63e7ebd06402951bc8863ba5b7bc9b9f42044849 (diff) | |
download | linux-3.10-98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10.tar.gz linux-3.10-98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10.tar.bz2 linux-3.10-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/nsp_cs.c')
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 050ea13ff80..870e87180d1 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -2021,6 +2021,59 @@ static void nsp_cs_release(dev_link_t *link) #endif } /* nsp_cs_release */ +static int nsp_cs_suspend(struct pcmcia_device *dev) +{ + dev_link_t *link = dev_to_instance(dev); + scsi_info_t *info = link->priv; + nsp_hw_data *data; + + link->state |= DEV_SUSPEND; + + nsp_dbg(NSP_DEBUG_INIT, "event: suspend"); + + if (info->host != NULL) { + nsp_msg(KERN_INFO, "clear SDTR status"); + + data = (nsp_hw_data *)info->host->hostdata; + + nsphw_init_sync(data); + } + + info->stop = 1; + + if (link->state & DEV_CONFIG) + pcmcia_release_configuration(link->handle); + + return 0; +} + +static int nsp_cs_resume(struct pcmcia_device *dev) +{ + dev_link_t *link = dev_to_instance(dev); + scsi_info_t *info = link->priv; + nsp_hw_data *data; + + nsp_dbg(NSP_DEBUG_INIT, "event: resume"); + + link->state &= ~DEV_SUSPEND; + + if (link->state & DEV_CONFIG) + pcmcia_request_configuration(link->handle, &link->conf); + + info->stop = 0; + + if (info->host != NULL) { + nsp_msg(KERN_INFO, "reset host and bus"); + + data = (nsp_hw_data *)info->host->hostdata; + + nsphw_init (data); + nsp_bus_reset(data); + } + + return 0; +} + /*====================================================================== The card status event handler. Mostly, this schedules other @@ -2039,8 +2092,6 @@ static int nsp_cs_event(event_t event, event_callback_args_t *args) { dev_link_t *link = args->client_data; - scsi_info_t *info = link->priv; - nsp_hw_data *data; nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event); @@ -2062,51 +2113,6 @@ static int nsp_cs_event(event_t event, #endif nsp_cs_config(link); break; - - case CS_EVENT_PM_SUSPEND: - nsp_dbg(NSP_DEBUG_INIT, "event: suspend"); - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - /* Mark the device as stopped, to block IO until later */ - nsp_dbg(NSP_DEBUG_INIT, "event: reset physical"); - - if (info->host != NULL) { - nsp_msg(KERN_INFO, "clear SDTR status"); - - data = (nsp_hw_data *)info->host->hostdata; - - nsphw_init_sync(data); - } - - info->stop = 1; - if (link->state & DEV_CONFIG) { - pcmcia_release_configuration(link->handle); - } - break; - - case CS_EVENT_PM_RESUME: - nsp_dbg(NSP_DEBUG_INIT, "event: resume"); - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - nsp_dbg(NSP_DEBUG_INIT, "event: reset"); - if (link->state & DEV_CONFIG) { - pcmcia_request_configuration(link->handle, &link->conf); - } - info->stop = 0; - - if (info->host != NULL) { - nsp_msg(KERN_INFO, "reset host and bus"); - - data = (nsp_hw_data *)info->host->hostdata; - - nsphw_init (data); - nsp_bus_reset(data); - } - - break; - default: nsp_dbg(NSP_DEBUG_INIT, "event: unknown"); break; @@ -2140,6 +2146,8 @@ static struct pcmcia_driver nsp_driver = { .event = nsp_cs_event, .detach = nsp_cs_detach, .id_table = nsp_cs_ids, + .suspend = nsp_cs_suspend, + .resume = nsp_cs_resume, }; #endif |