summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 21:21:18 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 23:59:02 +0100
commit98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch)
treeb3d46f0643352e541d6a39e6da09059687cf713d /drivers/serial/serial_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/serial/serial_cs.c')
-rw-r--r--drivers/serial/serial_cs.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 7ce0c7e66d3..3487ee9eab1 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -159,8 +159,9 @@ static void serial_remove(dev_link_t *link)
}
}
-static void serial_suspend(dev_link_t *link)
+static int serial_suspend(struct pcmcia_device *dev)
{
+ dev_link_t *link = dev_to_instance(dev);
link->state |= DEV_SUSPEND;
if (link->state & DEV_CONFIG) {
@@ -173,10 +174,13 @@ static void serial_suspend(dev_link_t *link)
if (!info->slave)
pcmcia_release_configuration(link->handle);
}
+
+ return 0;
}
-static void serial_resume(dev_link_t *link)
+static int serial_resume(struct pcmcia_device *dev)
{
+ dev_link_t *link = dev_to_instance(dev);
link->state &= ~DEV_SUSPEND;
if (DEV_OK(link)) {
@@ -189,6 +193,8 @@ static void serial_resume(dev_link_t *link)
for (i = 0; i < info->ndev; i++)
serial8250_resume_port(info->line[i]);
}
+
+ return 0;
}
/*======================================================================
@@ -731,7 +737,6 @@ static int
serial_event(event_t event, int priority, event_callback_args_t * args)
{
dev_link_t *link = args->client_data;
- struct serial_info *info = link->priv;
DEBUG(1, "serial_event(0x%06x)\n", event);
@@ -744,24 +749,6 @@ serial_event(event_t event, int priority, event_callback_args_t * args)
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
serial_config(link);
break;
-
- case CS_EVENT_PM_SUSPEND:
- serial_suspend(link);
- break;
-
- case CS_EVENT_RESET_PHYSICAL:
- if ((link->state & DEV_CONFIG) && !info->slave)
- pcmcia_release_configuration(link->handle);
- break;
-
- case CS_EVENT_PM_RESUME:
- serial_resume(link);
- break;
-
- case CS_EVENT_CARD_RESET:
- if (DEV_OK(link) && !info->slave)
- pcmcia_request_configuration(link->handle, &link->conf);
- break;
}
return 0;
}
@@ -881,6 +868,8 @@ static struct pcmcia_driver serial_cs_driver = {
.event = serial_event,
.detach = serial_detach,
.id_table = serial_ids,
+ .suspend = serial_suspend,
+ .resume = serial_resume,
};
static int __init init_serial_cs(void)