Commit 8e2943c0 authored by Joe Perches's avatar Joe Perches Committed by Grant Likely

spi: Convert uses of struct resource * to resource_size(ptr)

Done via coccinelle scripts like:

@@
struct resource *ptr;
@@

- ptr->end - ptr->start + 1
+ resource_size(ptr)

and some grep and typing.

Mostly uncompiled, no cross-compilers.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent e4c8308c
...@@ -232,7 +232,7 @@ static __devinit int ath79_spi_probe(struct platform_device *pdev) ...@@ -232,7 +232,7 @@ static __devinit int ath79_spi_probe(struct platform_device *pdev)
goto err_put_master; goto err_put_master;
} }
sp->base = ioremap(r->start, r->end - r->start + 1); sp->base = ioremap(r->start, resource_size(r));
if (!sp->base) { if (!sp->base) {
ret = -ENXIO; ret = -ENXIO;
goto err_put_master; goto err_put_master;
......
...@@ -1116,8 +1116,8 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1116,8 +1116,8 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
status = -ENODEV; status = -ENODEV;
goto err1; goto err1;
} }
if (!request_mem_region(r->start, (r->end - r->start) + 1, if (!request_mem_region(r->start, resource_size(r),
dev_name(&pdev->dev))) { dev_name(&pdev->dev))) {
status = -EBUSY; status = -EBUSY;
goto err1; goto err1;
} }
...@@ -1125,7 +1125,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1125,7 +1125,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
r->start += pdata->regs_offset; r->start += pdata->regs_offset;
r->end += pdata->regs_offset; r->end += pdata->regs_offset;
mcspi->phys = r->start; mcspi->phys = r->start;
mcspi->base = ioremap(r->start, r->end - r->start + 1); mcspi->base = ioremap(r->start, resource_size(r));
if (!mcspi->base) { if (!mcspi->base) {
dev_dbg(&pdev->dev, "can't ioremap MCSPI\n"); dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
status = -ENOMEM; status = -ENOMEM;
...@@ -1190,7 +1190,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1190,7 +1190,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
err3: err3:
kfree(mcspi->dma_channels); kfree(mcspi->dma_channels);
err2: err2:
release_mem_region(r->start, (r->end - r->start) + 1); release_mem_region(r->start, resource_size(r));
iounmap(mcspi->base); iounmap(mcspi->base);
err1: err1:
return status; return status;
...@@ -1210,7 +1210,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) ...@@ -1210,7 +1210,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
omap2_mcspi_disable_clocks(mcspi); omap2_mcspi_disable_clocks(mcspi);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(r->start, (r->end - r->start) + 1); release_mem_region(r->start, resource_size(r));
base = mcspi->base; base = mcspi->base;
spi_unregister_master(master); spi_unregister_master(master);
......
...@@ -489,7 +489,7 @@ static int __init orion_spi_probe(struct platform_device *pdev) ...@@ -489,7 +489,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
goto out; goto out;
} }
if (!request_mem_region(r->start, (r->end - r->start) + 1, if (!request_mem_region(r->start, resource_size(r),
dev_name(&pdev->dev))) { dev_name(&pdev->dev))) {
status = -EBUSY; status = -EBUSY;
goto out; goto out;
...@@ -511,7 +511,7 @@ static int __init orion_spi_probe(struct platform_device *pdev) ...@@ -511,7 +511,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
return status; return status;
out_rel_mem: out_rel_mem:
release_mem_region(r->start, (r->end - r->start) + 1); release_mem_region(r->start, resource_size(r));
out: out:
spi_master_put(master); spi_master_put(master);
...@@ -531,7 +531,7 @@ static int __exit orion_spi_remove(struct platform_device *pdev) ...@@ -531,7 +531,7 @@ static int __exit orion_spi_remove(struct platform_device *pdev)
cancel_work_sync(&spi->work); cancel_work_sync(&spi->work);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(r->start, (r->end - r->start) + 1); release_mem_region(r->start, resource_size(r));
spi_unregister_master(master); spi_unregister_master(master);
......
...@@ -502,7 +502,7 @@ static int __init spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -502,7 +502,7 @@ static int __init spi_ppc4xx_of_probe(struct platform_device *op)
goto free_gpios; goto free_gpios;
} }
hw->mapbase = resource.start; hw->mapbase = resource.start;
hw->mapsize = resource.end - resource.start + 1; hw->mapsize = resource_size(&resource);
/* Sanity check */ /* Sanity check */
if (hw->mapsize < sizeof(struct spi_ppc4xx_regs)) { if (hw->mapsize < sizeof(struct spi_ppc4xx_regs)) {
......
...@@ -498,14 +498,14 @@ static int __init spi_tegra_probe(struct platform_device *pdev) ...@@ -498,14 +498,14 @@ static int __init spi_tegra_probe(struct platform_device *pdev)
goto err0; goto err0;
} }
if (!request_mem_region(r->start, (r->end - r->start) + 1, if (!request_mem_region(r->start, resource_size(r),
dev_name(&pdev->dev))) { dev_name(&pdev->dev))) {
ret = -EBUSY; ret = -EBUSY;
goto err0; goto err0;
} }
tspi->phys = r->start; tspi->phys = r->start;
tspi->base = ioremap(r->start, r->end - r->start + 1); tspi->base = ioremap(r->start, resource_size(r));
if (!tspi->base) { if (!tspi->base) {
dev_err(&pdev->dev, "can't ioremap iomem\n"); dev_err(&pdev->dev, "can't ioremap iomem\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -563,7 +563,7 @@ static int __init spi_tegra_probe(struct platform_device *pdev) ...@@ -563,7 +563,7 @@ static int __init spi_tegra_probe(struct platform_device *pdev)
err2: err2:
iounmap(tspi->base); iounmap(tspi->base);
err1: err1:
release_mem_region(r->start, (r->end - r->start) + 1); release_mem_region(r->start, resource_size(r));
err0: err0:
spi_master_put(master); spi_master_put(master);
return ret; return ret;
...@@ -588,7 +588,7 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev) ...@@ -588,7 +588,7 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev)
iounmap(tspi->base); iounmap(tspi->base);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(r->start, (r->end - r->start) + 1); release_mem_region(r->start, resource_size(r));
return 0; return 0;
} }
......
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