diff options
-rw-r--r-- | drivers/ata/libata-core.c | 19 |
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 | */ | ||
5416 | static int ata_port_runtime_idle(struct device *dev) | 5424 | static 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 | ||