aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-01-25 01:32:25 -0500
committerJeff Garzik <jgarzik@redhat.com>2013-01-25 15:33:54 -0500
commitf5e6d0d0eb819cbe1a68b9561c8e83fbd1a6d13a (patch)
tree4454dd91812f527f8989303d7845d346c22e6ff0 /drivers/ata
parenta7ff60dbe0858496531c75b1544666c099a2b200 (diff)
[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,
5333 5333
5334static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int *async) 5334static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int *async)
5335{ 5335{
5336 unsigned int ehi_flags = ATA_EHI_QUIET;
5337 int rc;
5338
5339 /* 5336 /*
5340 * On some hardware, device fails to respond after spun down 5337 * On some hardware, device fails to respond after spun down
5341 * for suspend. As the device won't be used before being 5338 * 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
5344 * 5341 *
5345 * http://thread.gmane.org/gmane.linux.ide/46764 5342 * http://thread.gmane.org/gmane.linux.ide/46764
5346 */ 5343 */
5347 if (mesg.event & PM_EVENT_SUSPEND) 5344 unsigned int ehi_flags = ATA_EHI_QUIET | ATA_EHI_NO_AUTOPSY |
5348 ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY; 5345 ATA_EHI_NO_RECOVERY;
5349 5346 return ata_port_request_pm(ap, mesg, 0, ehi_flags, async);
5350 rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, async);
5351 return rc;
5352} 5347}
5353 5348
5354static int ata_port_suspend_common(struct device *dev, pm_message_t mesg) 5349static int ata_port_suspend_common(struct device *dev, pm_message_t mesg)
@@ -5369,16 +5364,13 @@ static int ata_port_suspend(struct device *dev)
5369static int ata_port_do_freeze(struct device *dev) 5364static int ata_port_do_freeze(struct device *dev)
5370{ 5365{
5371 if (pm_runtime_suspended(dev)) 5366 if (pm_runtime_suspended(dev))
5372 pm_runtime_resume(dev); 5367 return 0;
5373 5368
5374 return ata_port_suspend_common(dev, PMSG_FREEZE); 5369 return ata_port_suspend_common(dev, PMSG_FREEZE);
5375} 5370}
5376 5371
5377static int ata_port_poweroff(struct device *dev) 5372static int ata_port_poweroff(struct device *dev)
5378{ 5373{
5379 if (pm_runtime_suspended(dev))
5380 return 0;
5381
5382 return ata_port_suspend_common(dev, PMSG_HIBERNATE); 5374 return ata_port_suspend_common(dev, PMSG_HIBERNATE);
5383} 5375}
5384 5376