Commit cb8ea3dd authored by Yangtao Li's avatar Yangtao Li Committed by Mark Brown

spi: ep93xx: Use devm_platform_get_and_ioremap_resource()

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.
Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
Link: https://lore.kernel.org/r/20230706032727.9180-3-frank.li@vivo.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2ae3c98b
...@@ -661,13 +661,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev) ...@@ -661,13 +661,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0)
return -EBUSY; return irq;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "unable to get iomem resource\n");
return -ENODEV;
}
master = spi_alloc_master(&pdev->dev, sizeof(*espi)); master = spi_alloc_master(&pdev->dev, sizeof(*espi));
if (!master) if (!master)
...@@ -705,13 +699,12 @@ static int ep93xx_spi_probe(struct platform_device *pdev) ...@@ -705,13 +699,12 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
master->max_speed_hz = clk_get_rate(espi->clk) / 2; master->max_speed_hz = clk_get_rate(espi->clk) / 2;
master->min_speed_hz = clk_get_rate(espi->clk) / (254 * 256); master->min_speed_hz = clk_get_rate(espi->clk) / (254 * 256);
espi->sspdr_phys = res->start + SSPDR; espi->mmio = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
espi->mmio = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(espi->mmio)) { if (IS_ERR(espi->mmio)) {
error = PTR_ERR(espi->mmio); error = PTR_ERR(espi->mmio);
goto fail_release_master; goto fail_release_master;
} }
espi->sspdr_phys = res->start + SSPDR;
error = devm_request_irq(&pdev->dev, irq, ep93xx_spi_interrupt, error = devm_request_irq(&pdev->dev, irq, ep93xx_spi_interrupt,
0, "ep93xx-spi", master); 0, "ep93xx-spi", master);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment