Patchwork [v13,8/9] libata: do not suspend port if normal ODD is attached

login
register
mail settings
Submitter Aaron Lu
Date Jan. 15, 2013, 9:21 a.m.
Message ID <1358241665-2156-9-git-send-email-aaron.lu@intel.com>
Download mbox | patch
Permalink /patch/212045/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Aaron Lu - Jan. 15, 2013, 9:21 a.m.
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>
---
 drivers/ata/libata-core.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
Jeff Garzik - Jan. 21, 2013, 8:42 p.m.
On 01/15/2013 04:21 AM, Aaron Lu wrote:
> 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>
> ---
>   drivers/ata/libata-core.c | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)

applied patches #2-6 and #8


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Aaron Lu - Jan. 22, 2013, 11:27 a.m.
On Mon, Jan 21, 2013 at 03:42:55PM -0500, Jeff Garzik wrote:
> On 01/15/2013 04:21 AM, Aaron Lu wrote:
> >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>
> >---
> >  drivers/ata/libata-core.c | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> 
> applied patches #2-6 and #8

Thanks!

Now that patch 1 has ack from Alan Stern(and thus James), and consider
the smatch warning of patch #3, I can either send out the remaining 3
patches(#1, #7 and #9) together with a small fix patch for the smatch
warning or I can re-send the whole patchset. Just let me know which way
you prefer, thanks.

-Aaron

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c7ecd84..b7eed82 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)
 	return rc;
 }
 
+/*
+ * For ODDs, the upper layer will poll for media change every few seconds,
+ * which will make it enter and leave suspend state every few seconds. And
+ * as each suspend will cause a hard/soft reset, the gain of runtime suspend
+ * is very little and 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.
+ */
 static int ata_port_runtime_idle(struct device *dev)
 {
+	struct ata_port *ap = to_ata_port(dev);
+	struct ata_link *link;
+	struct ata_device *adev;
+
+	ata_for_each_link(link, ap, HOST_FIRST) {
+		ata_for_each_dev(adev, link, ENABLED)
+			if (adev->class == ATA_DEV_ATAPI &&
+			    !zpodd_dev_enabled(adev))
+				return -EBUSY;
+	}
+
 	return pm_runtime_suspend(dev);
 }