summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-01-25 14:32:25 +0800
committerJeff Garzik <jgarzik@redhat.com>2013-01-25 15:33:54 -0500
commitf5e6d0d0eb819cbe1a68b9561c8e83fbd1a6d13a (patch)
tree4454dd91812f527f8989303d7845d346c22e6ff0 /drivers/ata
parenta7ff60dbe0858496531c75b1544666c099a2b200 (diff)
downloadblackbird-op-linux-f5e6d0d0eb819cbe1a68b9561c8e83fbd1a6d13a.tar.gz
blackbird-op-linux-f5e6d0d0eb819cbe1a68b9561c8e83fbd1a6d13a.zip
[libata] PM code cleanup for ata port
For system freeze, if the port is already runtime suspended, leave it alone and just return. The port will be resumed on thaw before it will be used. And since we will call get_noresume for every device during prepare phase, and the port is resumed during thaw phase, it can't be in runtime suspended state during the poweroff phase. So remove the runtime_suspended check in poweroff callback. And for all suspend(freeze/suspend/poweroff/etc.), there is no need to touch the device, so set no_autopsy and no_recovery for them all. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b7c972dc8b9b..497adea1f0d6 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5333,9 +5333,6 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int *async)
{
- unsigned int ehi_flags = ATA_EHI_QUIET;
- int rc;
-
/*
* On some hardware, device fails to respond after spun down
* for suspend. As the device won't be used before being
@@ -5344,11 +5341,9 @@ static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int
*
* http://thread.gmane.org/gmane.linux.ide/46764
*/
- if (mesg.event & PM_EVENT_SUSPEND)
- ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY;
-
- rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, async);
- return rc;
+ unsigned int ehi_flags = ATA_EHI_QUIET | ATA_EHI_NO_AUTOPSY |
+ ATA_EHI_NO_RECOVERY;
+ return ata_port_request_pm(ap, mesg, 0, ehi_flags, async);
}
static int ata_port_suspend_common(struct device *dev, pm_message_t mesg)
@@ -5369,16 +5364,13 @@ static int ata_port_suspend(struct device *dev)
static int ata_port_do_freeze(struct device *dev)
{
if (pm_runtime_suspended(dev))
- pm_runtime_resume(dev);
+ return 0;
return ata_port_suspend_common(dev, PMSG_FREEZE);
}
static int ata_port_poweroff(struct device *dev)
{
- if (pm_runtime_suspended(dev))
- return 0;
-
return ata_port_suspend_common(dev, PMSG_HIBERNATE);
}
OpenPOWER on IntegriCloud