aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-01-20 09:10:23 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:31 -0500
commitf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (patch)
tree60758f4c397c9123b40e2ab5da14b5ffc3a5c3d9 /drivers/pcmcia/ds.c
parentb4c884000a7d3664dd8ad7227241456bd7824d86 (diff)
[PATCH] pcmcia: remove unused p_dev->state flags
Remove the unused DEV_RELEASE_PENDING flag, and move the DEV_SUSPEND flag into the p_dev structure, and make use of it at the core level. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index e8fe544f2e9c..34e634aa48e4 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -945,7 +945,7 @@ static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute
945{ 945{
946 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 946 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
947 947
948 if (p_dev->dev.power.power_state.event != PM_EVENT_ON) 948 if (p_dev->suspended)
949 return sprintf(buf, "off\n"); 949 return sprintf(buf, "off\n");
950 else 950 else
951 return sprintf(buf, "on\n"); 951 return sprintf(buf, "on\n");
@@ -960,11 +960,9 @@ static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute
960 if (!count) 960 if (!count)
961 return -EINVAL; 961 return -EINVAL;
962 962
963 if ((p_dev->dev.power.power_state.event == PM_EVENT_ON) && 963 if ((!p_dev->suspended) && !strncmp(buf, "off", 3))
964 (!strncmp(buf, "off", 3)))
965 ret = dpm_runtime_suspend(dev, PMSG_SUSPEND); 964 ret = dpm_runtime_suspend(dev, PMSG_SUSPEND);
966 else if ((p_dev->dev.power.power_state.event != PM_EVENT_ON) && 965 else if (p_dev->suspended && !strncmp(buf, "on", 2))
967 (!strncmp(buf, "on", 2)))
968 dpm_runtime_resume(dev); 966 dpm_runtime_resume(dev);
969 967
970 return ret ? ret : count; 968 return ret ? ret : count;
@@ -1030,7 +1028,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1030{ 1028{
1031 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1029 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1032 struct pcmcia_driver *p_drv = NULL; 1030 struct pcmcia_driver *p_drv = NULL;
1033 int ret; 1031 int ret = 0;
1034 1032
1035 if (dev->driver) 1033 if (dev->driver)
1036 p_drv = to_pcmcia_drv(dev->driver); 1034 p_drv = to_pcmcia_drv(dev->driver);
@@ -1038,14 +1036,16 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1038 if (p_drv && p_drv->suspend) { 1036 if (p_drv && p_drv->suspend) {
1039 ret = p_drv->suspend(p_dev); 1037 ret = p_drv->suspend(p_dev);
1040 if (ret) 1038 if (ret)
1041 return ret; 1039 goto out;
1042 p_dev->state |= DEV_SUSPEND; 1040 if ((p_dev->state & DEV_CONFIG) &&
1043 if ((p_dev->state & DEV_CONFIG) && 1041 !(p_dev->state & DEV_SUSPEND_NORELEASE))
1044 !(p_dev->state & DEV_SUSPEND_NORELEASE)) 1042 pcmcia_release_configuration(p_dev);
1045 pcmcia_release_configuration(p_dev);
1046 } 1043 }
1047 1044
1048 return 0; 1045 out:
1046 if (!ret)
1047 p_dev->suspended = 1;
1048 return ret;
1049} 1049}
1050 1050
1051 1051
@@ -1053,24 +1053,26 @@ static int pcmcia_dev_resume(struct device * dev)
1053{ 1053{
1054 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1054 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1055 struct pcmcia_driver *p_drv = NULL; 1055 struct pcmcia_driver *p_drv = NULL;
1056 int ret; 1056 int ret = 0;
1057 1057
1058 if (dev->driver) 1058 if (dev->driver)
1059 p_drv = to_pcmcia_drv(dev->driver); 1059 p_drv = to_pcmcia_drv(dev->driver);
1060 1060
1061 if (p_drv && p_drv->resume) { 1061 if (p_drv && p_drv->resume) {
1062 p_dev->state &= ~DEV_SUSPEND; 1062 if ((p_dev->state & DEV_CONFIG) &&
1063 if ((p_dev->state & DEV_CONFIG) && 1063 !(p_dev->state & DEV_SUSPEND_NORELEASE)){
1064 !(p_dev->state & DEV_SUSPEND_NORELEASE)){ 1064 ret = pcmcia_request_configuration(p_dev,
1065 ret = pcmcia_request_configuration(p_dev, 1065 &p_dev->conf);
1066 &p_dev->conf); 1066 if (ret)
1067 if (ret) 1067 goto out;
1068 return ret; 1068 }
1069 } 1069 ret = p_drv->resume(p_dev);
1070 return p_drv->resume(p_dev);
1071 } 1070 }
1072 1071
1073 return 0; 1072 out:
1073 if (!ret)
1074 p_dev->suspended = 0;
1075 return ret;
1074} 1076}
1075 1077
1076 1078