Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "ata: sata_mv: Convert to devm_ioremap_resource()"

This reverts commit 368e5fbdfc60732643f34f538823ed4bc8829827.

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>

authored by

Andrew Lunn and committed by
Tejun Heo
3e4240da c034640a

+8 -5
+8 -5
drivers/ata/sata_mv.c
··· 4067 4067 struct ata_host *host; 4068 4068 struct mv_host_priv *hpriv; 4069 4069 struct resource *res; 4070 - void __iomem *mmio; 4071 4070 int n_ports = 0, irq = 0; 4072 4071 int rc; 4073 4072 int port; ··· 4085 4086 * Get the register base first 4086 4087 */ 4087 4088 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 4088 - mmio = devm_ioremap_resource(&pdev->dev, res); 4089 - if (IS_ERR(mmio)) 4090 - return PTR_ERR(mmio); 4089 + if (res == NULL) 4090 + return -EINVAL; 4091 4091 4092 4092 /* allocate host */ 4093 4093 if (pdev->dev.of_node) { ··· 4130 4132 hpriv->board_idx = chip_soc; 4131 4133 4132 4134 host->iomap = NULL; 4133 - hpriv->base = mmio - SATAHC0_REG_BASE; 4135 + hpriv->base = devm_ioremap(&pdev->dev, res->start, 4136 + resource_size(res)); 4137 + if (!hpriv->base) 4138 + return -ENOMEM; 4139 + 4140 + hpriv->base -= SATAHC0_REG_BASE; 4134 4141 4135 4142 hpriv->clk = clk_get(&pdev->dev, NULL); 4136 4143 if (IS_ERR(hpriv->clk))