Skip to content

Commit

Permalink
Revert "ata: sata_mv: Convert to devm_ioremap_resource()"
Browse files Browse the repository at this point in the history
This reverts commit 368e5fb.

devm_ioremap_resource() enforces that there are no overlapping
resources, where as devm_ioremap() does not. The sata phy driver needs
a subset of the sata IO address space, so maps some of the sata
address space. As a result, sata_mv now fails to probe, reporting it
cannot get its resources, and so we don't have any SATA disks.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: stable@vger.kernel.org # v4.11+
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Andrew Lunn authored and Tejun Heo committed May 24, 2017
1 parent c034640 commit 3e4240d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/ata/sata_mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 3e4240d

Please sign in to comment.