aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-01-15 04:21:04 -0500
committerJeff Garzik <jgarzik@redhat.com>2013-01-21 15:42:21 -0500
commit7e15e9be37eb834aaaca69030064ac97eaf5df2f (patch)
tree876845538dcd45bf2c80cb920b8486b689d27f10 /drivers/ata
parenta59b9aae230316134597775c6202cf28f6da0333 (diff)
libata: do not suspend port if normal ODD is attached
For ODDs, the upper layer will poll for media change every few seconds, which will make it enter and leave suspend state very often. And as each suspend will also cause a hard/soft reset, the gain of runtime suspend is very little while the ODD may malfunction after constantly being reset. So the idle callback here will not proceed to suspend if a non-ZPODD capable ODD is attached to the port. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c7ecd8492f1e..b7eed827daae 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5413,8 +5413,27 @@ static int ata_port_resume(struct device *dev)
5413 return rc; 5413 return rc;
5414} 5414}
5415 5415
5416/*
5417 * For ODDs, the upper layer will poll for media change every few seconds,
5418 * which will make it enter and leave suspend state every few seconds. And
5419 * as each suspend will cause a hard/soft reset, the gain of runtime suspend
5420 * is very little and the ODD may malfunction after constantly being reset.
5421 * So the idle callback here will not proceed to suspend if a non-ZPODD capable
5422 * ODD is attached to the port.
5423 */
5416static int ata_port_runtime_idle(struct device *dev) 5424static int ata_port_runtime_idle(struct device *dev)
5417{ 5425{
5426 struct ata_port *ap = to_ata_port(dev);
5427 struct ata_link *link;
5428 struct ata_device *adev;
5429
5430 ata_for_each_link(link, ap, HOST_FIRST) {
5431 ata_for_each_dev(adev, link, ENABLED)
5432 if (adev->class == ATA_DEV_ATAPI &&
5433 !zpodd_dev_enabled(adev))
5434 return -EBUSY;
5435 }
5436
5418 return pm_runtime_suspend(dev); 5437 return pm_runtime_suspend(dev);
5419} 5438}
5420 5439