aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-06-10 21:11:25 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-06-11 01:43:41 -0400
commit8e2943c04c74e537c762c09bcea89e923510a9ac (patch)
tree6ea287e3597434d14c976d63c1dbf7c7d330e41a /drivers/spi
parente4c8308c852e6b3fa49215052a5b9e99597dee99 (diff)
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: Joe Perches <joe@perches.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-ath79.c2
-rw-r--r--drivers/spi/spi-omap2-mcspi.c10
-rw-r--r--drivers/spi/spi-orion.c6
-rw-r--r--drivers/spi/spi-ppc4xx.c2
-rw-r--r--drivers/spi/spi-tegra.c8
5 files changed, 14 insertions, 14 deletions
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index fcff810ea3b0..03019bf5a5e9 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -232,7 +232,7 @@ static __devinit int ath79_spi_probe(struct platform_device *pdev)
232 goto err_put_master; 232 goto err_put_master;
233 } 233 }
234 234
235 sp->base = ioremap(r->start, r->end - r->start + 1); 235 sp->base = ioremap(r->start, resource_size(r));
236 if (!sp->base) { 236 if (!sp->base) {
237 ret = -ENXIO; 237 ret = -ENXIO;
238 goto err_put_master; 238 goto err_put_master;
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 969cdd2fe124..fde3a2d4f120 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1116,8 +1116,8 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
1116 status = -ENODEV; 1116 status = -ENODEV;
1117 goto err1; 1117 goto err1;
1118 } 1118 }
1119 if (!request_mem_region(r->start, (r->end - r->start) + 1, 1119 if (!request_mem_region(r->start, resource_size(r),
1120 dev_name(&pdev->dev))) { 1120 dev_name(&pdev->dev))) {
1121 status = -EBUSY; 1121 status = -EBUSY;
1122 goto err1; 1122 goto err1;
1123 } 1123 }
@@ -1125,7 +1125,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
1125 r->start += pdata->regs_offset; 1125 r->start += pdata->regs_offset;
1126 r->end += pdata->regs_offset; 1126 r->end += pdata->regs_offset;
1127 mcspi->phys = r->start; 1127 mcspi->phys = r->start;
1128 mcspi->base = ioremap(r->start, r->end - r->start + 1); 1128 mcspi->base = ioremap(r->start, resource_size(r));
1129 if (!mcspi->base) { 1129 if (!mcspi->base) {
1130 dev_dbg(&pdev->dev, "can't ioremap MCSPI\n"); 1130 dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
1131 status = -ENOMEM; 1131 status = -ENOMEM;
@@ -1190,7 +1190,7 @@ err4:
1190err3: 1190err3:
1191 kfree(mcspi->dma_channels); 1191 kfree(mcspi->dma_channels);
1192err2: 1192err2:
1193 release_mem_region(r->start, (r->end - r->start) + 1); 1193 release_mem_region(r->start, resource_size(r));
1194 iounmap(mcspi->base); 1194 iounmap(mcspi->base);
1195err1: 1195err1:
1196 return status; 1196 return status;
@@ -1210,7 +1210,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
1210 1210
1211 omap2_mcspi_disable_clocks(mcspi); 1211 omap2_mcspi_disable_clocks(mcspi);
1212 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1212 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1213 release_mem_region(r->start, (r->end - r->start) + 1); 1213 release_mem_region(r->start, resource_size(r));
1214 1214
1215 base = mcspi->base; 1215 base = mcspi->base;
1216 spi_unregister_master(master); 1216 spi_unregister_master(master);
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index d48262829fdc..9421a390a5e3 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -489,7 +489,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
489 goto out; 489 goto out;
490 } 490 }
491 491
492 if (!request_mem_region(r->start, (r->end - r->start) + 1, 492 if (!request_mem_region(r->start, resource_size(r),
493 dev_name(&pdev->dev))) { 493 dev_name(&pdev->dev))) {
494 status = -EBUSY; 494 status = -EBUSY;
495 goto out; 495 goto out;
@@ -511,7 +511,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
511 return status; 511 return status;
512 512
513out_rel_mem: 513out_rel_mem:
514 release_mem_region(r->start, (r->end - r->start) + 1); 514 release_mem_region(r->start, resource_size(r));
515 515
516out: 516out:
517 spi_master_put(master); 517 spi_master_put(master);
@@ -531,7 +531,7 @@ static int __exit orion_spi_remove(struct platform_device *pdev)
531 cancel_work_sync(&spi->work); 531 cancel_work_sync(&spi->work);
532 532
533 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 533 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
534 release_mem_region(r->start, (r->end - r->start) + 1); 534 release_mem_region(r->start, resource_size(r));
535 535
536 spi_unregister_master(master); 536 spi_unregister_master(master);
537 537
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index 2a298c029194..b267fd901e54 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -502,7 +502,7 @@ static int __init spi_ppc4xx_of_probe(struct platform_device *op)
502 goto free_gpios; 502 goto free_gpios;
503 } 503 }
504 hw->mapbase = resource.start; 504 hw->mapbase = resource.start;
505 hw->mapsize = resource.end - resource.start + 1; 505 hw->mapsize = resource_size(&resource);
506 506
507 /* Sanity check */ 507 /* Sanity check */
508 if (hw->mapsize < sizeof(struct spi_ppc4xx_regs)) { 508 if (hw->mapsize < sizeof(struct spi_ppc4xx_regs)) {
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
index 6c3aa6ecaade..8e30727b5221 100644
--- a/drivers/spi/spi-tegra.c
+++ b/drivers/spi/spi-tegra.c
@@ -498,14 +498,14 @@ static int __init spi_tegra_probe(struct platform_device *pdev)
498 goto err0; 498 goto err0;
499 } 499 }
500 500
501 if (!request_mem_region(r->start, (r->end - r->start) + 1, 501 if (!request_mem_region(r->start, resource_size(r),
502 dev_name(&pdev->dev))) { 502 dev_name(&pdev->dev))) {
503 ret = -EBUSY; 503 ret = -EBUSY;
504 goto err0; 504 goto err0;
505 } 505 }
506 506
507 tspi->phys = r->start; 507 tspi->phys = r->start;
508 tspi->base = ioremap(r->start, r->end - r->start + 1); 508 tspi->base = ioremap(r->start, resource_size(r));
509 if (!tspi->base) { 509 if (!tspi->base) {
510 dev_err(&pdev->dev, "can't ioremap iomem\n"); 510 dev_err(&pdev->dev, "can't ioremap iomem\n");
511 ret = -ENOMEM; 511 ret = -ENOMEM;
@@ -563,7 +563,7 @@ err3:
563err2: 563err2:
564 iounmap(tspi->base); 564 iounmap(tspi->base);
565err1: 565err1:
566 release_mem_region(r->start, (r->end - r->start) + 1); 566 release_mem_region(r->start, resource_size(r));
567err0: 567err0:
568 spi_master_put(master); 568 spi_master_put(master);
569 return ret; 569 return ret;
@@ -588,7 +588,7 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev)
588 iounmap(tspi->base); 588 iounmap(tspi->base);
589 589
590 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 590 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
591 release_mem_region(r->start, (r->end - r->start) + 1); 591 release_mem_region(r->start, resource_size(r));
592 592
593 return 0; 593 return 0;
594} 594}