Commit 6cdcb5d3 authored by Markus Elfring's avatar Markus Elfring Committed by Mark Brown

spi: mediatek: Use devm_platform_ioremap_resource() in mtk_spi_slave_probe()

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Link: https://lore.kernel.org/r/225b76ca-a367-4bef-d8ce-42c7af9242a5@web.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5dd381e7
...@@ -368,7 +368,6 @@ static int mtk_spi_slave_probe(struct platform_device *pdev) ...@@ -368,7 +368,6 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
{ {
struct spi_controller *ctlr; struct spi_controller *ctlr;
struct mtk_spi_slave *mdata; struct mtk_spi_slave *mdata;
struct resource *res;
int irq, ret; int irq, ret;
ctlr = spi_alloc_slave(&pdev->dev, sizeof(*mdata)); ctlr = spi_alloc_slave(&pdev->dev, sizeof(*mdata));
...@@ -392,17 +391,8 @@ static int mtk_spi_slave_probe(struct platform_device *pdev) ...@@ -392,17 +391,8 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ctlr); platform_set_drvdata(pdev, ctlr);
init_completion(&mdata->xfer_done); init_completion(&mdata->xfer_done);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
ret = -ENODEV;
dev_err(&pdev->dev, "failed to determine base address\n");
goto err_put_ctlr;
}
mdata->dev = &pdev->dev; mdata->dev = &pdev->dev;
mdata->base = devm_platform_ioremap_resource(pdev, 0);
mdata->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mdata->base)) { if (IS_ERR(mdata->base)) {
ret = PTR_ERR(mdata->base); ret = PTR_ERR(mdata->base);
goto err_put_ctlr; goto err_put_ctlr;
......
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