Commit b1ec4308 authored by Mark Brown's avatar Mark Brown Committed by Kukjin Kim

spi/s3c64xx: Convert to devm_request_and_ioremap()

Saves some error handling and a small amount of code.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Reviewed-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent 707214d0
...@@ -1280,14 +1280,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) ...@@ -1280,14 +1280,7 @@ 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;
if (request_mem_region(mem_res->start, sdd->regs = devm_request_and_ioremap(&pdev->dev, mem_res);
resource_size(mem_res), pdev->name) == NULL) {
dev_err(&pdev->dev, "Req mem region failed\n");
ret = -ENXIO;
goto err0;
}
sdd->regs = ioremap(mem_res->start, resource_size(mem_res));
if (sdd->regs == NULL) { if (sdd->regs == NULL) {
dev_err(&pdev->dev, "Unable to remap IO\n"); dev_err(&pdev->dev, "Unable to remap IO\n");
ret = -ENXIO; ret = -ENXIO;
...@@ -1381,9 +1374,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) ...@@ -1381,9 +1374,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node)
s3c64xx_spi_dt_gpio_free(sdd); s3c64xx_spi_dt_gpio_free(sdd);
err2: err2:
iounmap((void *) sdd->regs);
err1: err1:
release_mem_region(mem_res->start, resource_size(mem_res));
err0: err0:
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
spi_master_put(master); spi_master_put(master);
...@@ -1395,7 +1386,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) ...@@ -1395,7 +1386,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
struct resource *mem_res;
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
...@@ -1414,12 +1404,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) ...@@ -1414,12 +1404,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node)
s3c64xx_spi_dt_gpio_free(sdd); s3c64xx_spi_dt_gpio_free(sdd);
iounmap((void *) sdd->regs);
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (mem_res != NULL)
release_mem_region(mem_res->start, resource_size(mem_res));
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
spi_master_put(master); spi_master_put(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