diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-20 17:10:23 +0300 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 19:26:31 +0400 |
commit | f6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (patch) | |
tree | 60758f4c397c9123b40e2ab5da14b5ffc3a5c3d9 /drivers/pcmcia | |
parent | b4c884000a7d3664dd8ad7227241456bd7824d86 (diff) | |
download | linux-f6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b.tar.xz |
[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')
-rw-r--r-- | drivers/pcmcia/ds.c | 48 |
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 { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); - if (p_dev->dev.power.power_state.event != PM_EVENT_ON) + if (p_dev->suspended) return sprintf(buf, "off\n"); else return sprintf(buf, "on\n"); @@ -960,11 +960,9 @@ static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute if (!count) return -EINVAL; - if ((p_dev->dev.power.power_state.event == PM_EVENT_ON) && - (!strncmp(buf, "off", 3))) + if ((!p_dev->suspended) && !strncmp(buf, "off", 3)) ret = dpm_runtime_suspend(dev, PMSG_SUSPEND); - else if ((p_dev->dev.power.power_state.event != PM_EVENT_ON) && - (!strncmp(buf, "on", 2))) + else if (p_dev->suspended && !strncmp(buf, "on", 2)) dpm_runtime_resume(dev); return ret ? ret : count; @@ -1030,7 +1028,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); struct pcmcia_driver *p_drv = NULL; - int ret; + int ret = 0; if (dev->driver) p_drv = to_pcmcia_drv(dev->driver); @@ -1038,14 +1036,16 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) if (p_drv && p_drv->suspend) { ret = p_drv->suspend(p_dev); if (ret) - return ret; - p_dev->state |= DEV_SUSPEND; - if ((p_dev->state & DEV_CONFIG) && - !(p_dev->state & DEV_SUSPEND_NORELEASE)) - pcmcia_release_configuration(p_dev); + goto out; + if ((p_dev->state & DEV_CONFIG) && + !(p_dev->state & DEV_SUSPEND_NORELEASE)) + pcmcia_release_configuration(p_dev); } - return 0; + out: + if (!ret) + p_dev->suspended = 1; + return ret; } @@ -1053,24 +1053,26 @@ static int pcmcia_dev_resume(struct device * dev) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); struct pcmcia_driver *p_drv = NULL; - int ret; + int ret = 0; if (dev->driver) p_drv = to_pcmcia_drv(dev->driver); if (p_drv && p_drv->resume) { - p_dev->state &= ~DEV_SUSPEND; - if ((p_dev->state & DEV_CONFIG) && - !(p_dev->state & DEV_SUSPEND_NORELEASE)){ - ret = pcmcia_request_configuration(p_dev, - &p_dev->conf); - if (ret) - return ret; - } - return p_drv->resume(p_dev); + if ((p_dev->state & DEV_CONFIG) && + !(p_dev->state & DEV_SUSPEND_NORELEASE)){ + ret = pcmcia_request_configuration(p_dev, + &p_dev->conf); + if (ret) + goto out; + } + ret = p_drv->resume(p_dev); } - return 0; + out: + if (!ret) + p_dev->suspended = 0; + return ret; } |