mirror of https://gitee.com/openkylin/linux.git
spi: Convert to devm_ioremap_resource()
Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e2cbdf3cb7
commit
b0ee560523
|
@ -1085,10 +1085,9 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
espi->sspdr_phys = res->start + SSPDR;
|
espi->sspdr_phys = res->start + SSPDR;
|
||||||
|
|
||||||
espi->regs_base = devm_request_and_ioremap(&pdev->dev, res);
|
espi->regs_base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (!espi->regs_base) {
|
if (IS_ERR(espi->regs_base)) {
|
||||||
dev_err(&pdev->dev, "failed to map resources\n");
|
error = PTR_ERR(espi->regs_base);
|
||||||
error = -ENODEV;
|
|
||||||
goto fail_put_clock;
|
goto fail_put_clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -538,9 +538,9 @@ static int mxs_spi_probe(struct platform_device *pdev)
|
||||||
if (!iores || irq_err < 0 || irq_dma < 0)
|
if (!iores || irq_err < 0 || irq_dma < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
base = devm_request_and_ioremap(&pdev->dev, iores);
|
base = devm_ioremap_resource(&pdev->dev, iores);
|
||||||
if (!base)
|
if (IS_ERR(base))
|
||||||
return -EADDRNOTAVAIL;
|
return PTR_ERR(base);
|
||||||
|
|
||||||
pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
|
pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
|
||||||
if (IS_ERR(pinctrl))
|
if (IS_ERR(pinctrl))
|
||||||
|
|
|
@ -1204,10 +1204,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
|
||||||
r->end += regs_offset;
|
r->end += regs_offset;
|
||||||
mcspi->phys = r->start;
|
mcspi->phys = r->start;
|
||||||
|
|
||||||
mcspi->base = devm_request_and_ioremap(&pdev->dev, r);
|
mcspi->base = devm_ioremap_resource(&pdev->dev, r);
|
||||||
if (!mcspi->base) {
|
if (IS_ERR(mcspi->base)) {
|
||||||
dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
|
status = PTR_ERR(mcspi->base);
|
||||||
status = -ENOMEM;
|
|
||||||
goto free_master;
|
goto free_master;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1276,10 +1276,9 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
|
||||||
/* the spi->mode bits understood by this driver: */
|
/* the spi->mode bits understood by this driver: */
|
||||||
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
|
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
|
||||||
|
|
||||||
sdd->regs = devm_request_and_ioremap(&pdev->dev, mem_res);
|
sdd->regs = devm_ioremap_resource(&pdev->dev, mem_res);
|
||||||
if (sdd->regs == NULL) {
|
if (IS_ERR(sdd->regs)) {
|
||||||
dev_err(&pdev->dev, "Unable to remap IO\n");
|
ret = PTR_ERR(sdd->regs);
|
||||||
ret = -ENXIO;
|
|
||||||
goto err1;
|
goto err1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -535,10 +535,9 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sspi->base = devm_request_and_ioremap(&pdev->dev, mem_res);
|
sspi->base = devm_ioremap_resource(&pdev->dev, mem_res);
|
||||||
if (!sspi->base) {
|
if (IS_ERR(sspi->base)) {
|
||||||
dev_err(&pdev->dev, "IO remap failed!\n");
|
ret = PTR_ERR(sspi->base);
|
||||||
ret = -ENOMEM;
|
|
||||||
goto free_master;
|
goto free_master;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -508,11 +508,9 @@ static int tegra_sflash_probe(struct platform_device *pdev)
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto exit_free_master;
|
goto exit_free_master;
|
||||||
}
|
}
|
||||||
tsd->base = devm_request_and_ioremap(&pdev->dev, r);
|
tsd->base = devm_ioremap_resource(&pdev->dev, r);
|
||||||
if (!tsd->base) {
|
if (IS_ERR(tsd->base)) {
|
||||||
dev_err(&pdev->dev,
|
ret = PTR_ERR(tsd->base);
|
||||||
"Cannot request memregion/iomap dma address\n");
|
|
||||||
ret = -EADDRNOTAVAIL;
|
|
||||||
goto exit_free_master;
|
goto exit_free_master;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1172,11 +1172,9 @@ static int tegra_slink_probe(struct platform_device *pdev)
|
||||||
goto exit_free_master;
|
goto exit_free_master;
|
||||||
}
|
}
|
||||||
tspi->phys = r->start;
|
tspi->phys = r->start;
|
||||||
tspi->base = devm_request_and_ioremap(&pdev->dev, r);
|
tspi->base = devm_ioremap_resource(&pdev->dev, r);
|
||||||
if (!tspi->base) {
|
if (IS_ERR(tspi->base)) {
|
||||||
dev_err(&pdev->dev,
|
ret = PTR_ERR(tspi->base);
|
||||||
"Cannot request memregion/iomap dma address\n");
|
|
||||||
ret = -EADDRNOTAVAIL;
|
|
||||||
goto exit_free_master;
|
goto exit_free_master;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue