stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "ata: sata_mv: Convert to devm_ioremap_resource()"
@ 2017-05-30 13:52 Linus Walleij
  2017-05-30 13:55 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2017-05-30 13:52 UTC (permalink / raw)
  To: Tejun Heo, Bartlomiej Zolnierkiewicz
  Cc: linux-ide, Linus Walleij, stable, Andy Shevchenko

This reverts commit 368e5fbdfc60732643f34f538823ed4bc8829827.

My NAS stopped to mount root when I went from some v4.10-rc1
to v4.12-rc3. Investigation of the bootlog yields this:

sata_mv f1080000.sata: can't request region for resource [mem 0xf1080000-0xf1084fff]
sata_mv: probe of f1080000.sata failed with error -16

Reverting this offending patch makes the sata_mv probe and
my SATA drive can mount root again, hooray!

Cc: stable@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
The problem is probably caused by overlapping resources in
the device tree, for which ioremap() and ioremap_resource()
have different semantics: the former allows it, the latter
does not.

A proper fix probably includes amending the device tree to
not have overlapping resources.
---
 drivers/ata/sata_mv.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index b66bcda88320..3b2246dded74 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4067,7 +4067,6 @@ static int mv_platform_probe(struct platform_device *pdev)
 	struct ata_host *host;
 	struct mv_host_priv *hpriv;
 	struct resource *res;
-	void __iomem *mmio;
 	int n_ports = 0, irq = 0;
 	int rc;
 	int port;
@@ -4086,9 +4085,8 @@ static int mv_platform_probe(struct platform_device *pdev)
 	 * Get the register base first
 	 */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mmio = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(mmio))
-		return PTR_ERR(mmio);
+	if (res == NULL)
+		return -EINVAL;
 
 	/* allocate host */
 	if (pdev->dev.of_node) {
@@ -4132,7 +4130,12 @@ static int mv_platform_probe(struct platform_device *pdev)
 	hpriv->board_idx = chip_soc;
 
 	host->iomap = NULL;
-	hpriv->base = mmio - SATAHC0_REG_BASE;
+	hpriv->base = devm_ioremap(&pdev->dev, res->start,
+				   resource_size(res));
+	if (!hpriv->base)
+		return -ENOMEM;
+
+	hpriv->base -= SATAHC0_REG_BASE;
 
 	hpriv->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(hpriv->clk))
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "ata: sata_mv: Convert to devm_ioremap_resource()"
  2017-05-30 13:52 [PATCH] Revert "ata: sata_mv: Convert to devm_ioremap_resource()" Linus Walleij
@ 2017-05-30 13:55 ` Andy Shevchenko
  2017-05-30 23:53   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2017-05-30 13:55 UTC (permalink / raw)
  To: Linus Walleij, Tejun Heo, Bartlomiej Zolnierkiewicz; +Cc: linux-ide, stable

On Tue, 2017-05-30 at 15:52 +0200, Linus Walleij wrote:
> This reverts commit 368e5fbdfc60732643f34f538823ed4bc8829827.
> 
> My NAS stopped to mount root when I went from some v4.10-rc1
> to v4.12-rc3. Investigation of the bootlog yields this:
> 
> sata_mv f1080000.sata: can't request region for resource [mem
> 0xf1080000-0xf1084fff]
> sata_mv: probe of f1080000.sata failed with error -16
> 
> Reverting this offending patch makes the sata_mv probe and
> my SATA drive can mount root again, hooray!

It's already in upstream (ata tree).

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "ata: sata_mv: Convert to devm_ioremap_resource()"
  2017-05-30 13:55 ` Andy Shevchenko
@ 2017-05-30 23:53   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-05-30 23:53 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Tejun Heo, Bartlomiej Zolnierkiewicz, linux-ide, stable

On Tue, May 30, 2017 at 3:55 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Tue, 2017-05-30 at 15:52 +0200, Linus Walleij wrote:
>> This reverts commit 368e5fbdfc60732643f34f538823ed4bc8829827.
>>
>> My NAS stopped to mount root when I went from some v4.10-rc1
>> to v4.12-rc3. Investigation of the bootlog yields this:
>>
>> sata_mv f1080000.sata: can't request region for resource [mem
>> 0xf1080000-0xf1084fff]
>> sata_mv: probe of f1080000.sata failed with error -16
>>
>> Reverting this offending patch makes the sata_mv probe and
>> my SATA drive can mount root again, hooray!
>
> It's already in upstream (ata tree).

OK!

Only two patches for the same issue? Today for the GPIO
tree I got four (4!) patches fixing the same issue :D

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-30 23:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-30 13:52 [PATCH] Revert "ata: sata_mv: Convert to devm_ioremap_resource()" Linus Walleij
2017-05-30 13:55 ` Andy Shevchenko
2017-05-30 23:53   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).