aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 16159e9d1b2b..ec2d4166a2e3 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -10,7 +10,7 @@
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 * 11 *
12 * (C) 1999 David A. Hinds 12 * (C) 1999 David A. Hinds
13 * (C) 2003 - 2005 Dominik Brodowski 13 * (C) 2003 - 2006 Dominik Brodowski
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -1030,12 +1030,22 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1030{ 1030{
1031 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1031 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1032 struct pcmcia_driver *p_drv = NULL; 1032 struct pcmcia_driver *p_drv = NULL;
1033 int ret;
1033 1034
1034 if (dev->driver) 1035 if (dev->driver)
1035 p_drv = to_pcmcia_drv(dev->driver); 1036 p_drv = to_pcmcia_drv(dev->driver);
1036 1037
1037 if (p_drv && p_drv->suspend) 1038 if (p_drv && p_drv->suspend) {
1038 return p_drv->suspend(p_dev); 1039 ret = p_drv->suspend(p_dev);
1040 if (ret)
1041 return ret;
1042 if (p_dev->instance) {
1043 p_dev->instance->state |= DEV_SUSPEND;
1044 if ((p_dev->instance->state & DEV_CONFIG) &&
1045 !(p_dev->instance->state & DEV_SUSPEND_NORELEASE))
1046 pcmcia_release_configuration(p_dev);
1047 }
1048 }
1039 1049
1040 return 0; 1050 return 0;
1041} 1051}
@@ -1045,12 +1055,24 @@ static int pcmcia_dev_resume(struct device * dev)
1045{ 1055{
1046 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1056 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1047 struct pcmcia_driver *p_drv = NULL; 1057 struct pcmcia_driver *p_drv = NULL;
1058 int ret;
1048 1059
1049 if (dev->driver) 1060 if (dev->driver)
1050 p_drv = to_pcmcia_drv(dev->driver); 1061 p_drv = to_pcmcia_drv(dev->driver);
1051 1062
1052 if (p_drv && p_drv->resume) 1063 if (p_drv && p_drv->resume) {
1064 if (p_dev->instance) {
1065 p_dev->instance->state &= ~DEV_SUSPEND;
1066 if ((p_dev->instance->state & DEV_CONFIG) &&
1067 !(p_dev->instance->state & DEV_SUSPEND_NORELEASE)){
1068 ret = pcmcia_request_configuration(p_dev,
1069 &p_dev->instance->conf);
1070 if (ret)
1071 return ret;
1072 }
1073 }
1053 return p_drv->resume(p_dev); 1074 return p_drv->resume(p_dev);
1075 }
1054 1076
1055 return 0; 1077 return 0;
1056} 1078}