>From 2381bd7a615f74e3ada88d6462fbb298b7d0e279 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 28 May 2014 17:33:05 +0200 Subject: [PATCH resend] ahci_imx: Fix oops on suspend/resume Doing suspend/resume on imx6q and imx53 boards with no SATA disk attached will trigger the following warning. ------------[ cut here ]------------ WARNING: CPU: 0 PID: 661 at drivers/ata/libahci.c:224 ahci_enable_ahci+0x74/0x8) Modules linked in: CPU: 0 PID: 661 Comm: sh Tainted: G W 3.15.0-rc5-next-20140521-000027 Backtrace: [<80011c90>] (dump_backtrace) from [<80011e2c>] (show_stack+0x18/0x1c) r6:803a22f4 r5:00000000 r4:00000000 r3:00000000 [<80011e14>] (show_stack) from [<80661e60>] (dump_stack+0x88/0xa4) [<80661dd8>] (dump_stack) from [<80028fdc>] (warn_slowpath_common+0x70/0x94) r5:00000009 r4:00000000 [<80028f6c>] (warn_slowpath_common) from [<80029024>] (warn_slowpath_null+0x24/) r8:808f68c4 r7:00000000 r6:00000000 r5:00000000 r4:e0810004 [<80029000>] (warn_slowpath_null) from [<803a22f4>] (ahci_enable_ahci+0x74/0x80) [<803a2280>] (ahci_enable_ahci) from [<803a2324>] (ahci_reset_controller+0x24/0) r8:ddcd9410 r7:80351178 r6:ddcd9444 r5:dde8b850 r4:e0810000 r3:ddf35e90 [<803a2300>] (ahci_reset_controller) from [<803a2c68>] (ahci_platform_resume_ho) r7:80351178 r6:ddcd9444 r5:dde8b850 r4:ddcd9410 [<803a2c30>] (ahci_platform_resume_host) from [<803a38f0>] (imx_ahci_resume+0x2) r5:00000000 r4:ddcd9410 [<803a38c4>] (imx_ahci_resume) from [<803511ac>] (platform_pm_resume+0x34/0x54) .... This is caused by the unique error handling in ahci_imx which permanently powers down the achi bits if there is no disk attached on probe. Add a check for this condition in the suspend / resume handlers to fix this warning. Signed-off-by: Hans de Goede --- drivers/ata/ahci_imx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 8befeb6..00e6ed8 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -215,9 +215,6 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv) struct device *dev = &imxpriv->ahci_pdev->dev; int ret; - if (imxpriv->no_device) - return 0; - if (hpriv->target_pwr) { ret = regulator_enable(hpriv->target_pwr); if (ret) @@ -453,6 +450,9 @@ static int imx_ahci_suspend(struct device *dev) struct ahci_host_priv *hpriv = host->private_data; int ret; + if (imxpriv->no_device) + return 0; + ret = ahci_platform_suspend_host(dev); if (ret) return ret; @@ -468,6 +468,9 @@ static int imx_ahci_resume(struct device *dev) struct ahci_host_priv *hpriv = host->private_data; int ret; + if (imxpriv->no_device) + return 0; + ret = imx_sata_enable(hpriv); if (ret) return ret; -- 1.9.3