aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
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/serial
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')
-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 7ce0c7e66d37..3487ee9eab1d 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)
159 } 159 }
160} 160}
161 161
162static void serial_suspend(dev_link_t *link) 162static int serial_suspend(struct pcmcia_device *dev)
163{ 163{
164 dev_link_t *link = dev_to_instance(dev);
164 link->state |= DEV_SUSPEND; 165 link->state |= DEV_SUSPEND;
165 166
166 if (link->state & DEV_CONFIG) { 167 if (link->state & DEV_CONFIG) {
@@ -173,10 +174,13 @@ static void serial_suspend(dev_link_t *link)
173 if (!info->slave) 174 if (!info->slave)
174 pcmcia_release_configuration(link->handle); 175 pcmcia_release_configuration(link->handle);
175 } 176 }
177
178 return 0;
176} 179}
177 180
178static void serial_resume(dev_link_t *link) 181static int serial_resume(struct pcmcia_device *dev)
179{ 182{
183 dev_link_t *link = dev_to_instance(dev);
180 link->state &= ~DEV_SUSPEND; 184 link->state &= ~DEV_SUSPEND;
181 185
182 if (DEV_OK(link)) { 186 if (DEV_OK(link)) {
@@ -189,6 +193,8 @@ static void serial_resume(dev_link_t *link)
189 for (i = 0; i < info->ndev; i++) 193 for (i = 0; i < info->ndev; i++)
190 serial8250_resume_port(info->line[i]); 194 serial8250_resume_port(info->line[i]);
191 } 195 }
196
197 return 0;
192} 198}
193 199
194/*====================================================================== 200/*======================================================================
@@ -731,7 +737,6 @@ static int
731serial_event(event_t event, int priority, event_callback_args_t * args) 737serial_event(event_t event, int priority, event_callback_args_t * args)
732{ 738{
733 dev_link_t *link = args->client_data; 739 dev_link_t *link = args->client_data;
734 struct serial_info *info = link->priv;
735 740
736 DEBUG(1, "serial_event(0x%06x)\n", event); 741 DEBUG(1, "serial_event(0x%06x)\n", event);
737 742
@@ -744,24 +749,6 @@ serial_event(event_t event, int priority, event_callback_args_t * args)
744 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 749 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
745 serial_config(link); 750 serial_config(link);
746 break; 751 break;
747
748 case CS_EVENT_PM_SUSPEND:
749 serial_suspend(link);
750 break;
751
752 case CS_EVENT_RESET_PHYSICAL:
753 if ((link->state & DEV_CONFIG) && !info->slave)
754 pcmcia_release_configuration(link->handle);
755 break;
756
757 case CS_EVENT_PM_RESUME:
758 serial_resume(link);
759 break;
760
761 case CS_EVENT_CARD_RESET:
762 if (DEV_OK(link) && !info->slave)
763 pcmcia_request_configuration(link->handle, &link->conf);
764 break;
765 } 752 }
766 return 0; 753 return 0;
767} 754}
@@ -881,6 +868,8 @@ static struct pcmcia_driver serial_cs_driver = {
881 .event = serial_event, 868 .event = serial_event,
882 .detach = serial_detach, 869 .detach = serial_detach,
883 .id_table = serial_ids, 870 .id_table = serial_ids,
871 .suspend = serial_suspend,
872 .resume = serial_resume,
884}; 873};
885 874
886static int __init init_serial_cs(void) 875static int __init init_serial_cs(void)