aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-omap.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-07-05 02:37:50 -0400
committerBen Dooks <ben-linux@fluff.org>2009-07-14 19:03:56 -0400
commit593308259bbd335eda9c5280cdd1f7883c746211 (patch)
tree60c9882dec12dfa7a262f1d14a81b8318d45d0f4 /drivers/i2c/busses/i2c-omap.c
parent7605fa3b0aedbb6c77471517ba16753f276156d9 (diff)
i2c: Use resource_size
Use the function resource_size, which reduces the chance of introducing off-by-one errors in calculating the resource size. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ struct resource *res; @@ - (res->end - res->start) + 1 + resource_size(res) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-omap.c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ad8d2010c921..fdd83277c8a8 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -806,7 +806,7 @@ omap_i2c_probe(struct platform_device *pdev)
806 return -ENODEV; 806 return -ENODEV;
807 } 807 }
808 808
809 ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1, 809 ioarea = request_mem_region(mem->start, resource_size(mem),
810 pdev->name); 810 pdev->name);
811 if (!ioarea) { 811 if (!ioarea) {
812 dev_err(&pdev->dev, "I2C region already claimed\n"); 812 dev_err(&pdev->dev, "I2C region already claimed\n");
@@ -905,7 +905,7 @@ err_free_mem:
905 platform_set_drvdata(pdev, NULL); 905 platform_set_drvdata(pdev, NULL);
906 kfree(dev); 906 kfree(dev);
907err_release_region: 907err_release_region:
908 release_mem_region(mem->start, (mem->end - mem->start) + 1); 908 release_mem_region(mem->start, resource_size(mem));
909 909
910 return r; 910 return r;
911} 911}
@@ -925,7 +925,7 @@ omap_i2c_remove(struct platform_device *pdev)
925 iounmap(dev->base); 925 iounmap(dev->base);
926 kfree(dev); 926 kfree(dev);
927 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 927 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
928 release_mem_region(mem->start, (mem->end - mem->start) + 1); 928 release_mem_region(mem->start, resource_size(mem));
929 return 0; 929 return 0;
930} 930}
931 931