aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-davinci.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-07-05 08:37:50 +0200
committerBen Dooks <ben-linux@fluff.org>2009-07-15 00:03:56 +0100
commit593308259bbd335eda9c5280cdd1f7883c746211 (patch)
tree60c9882dec12dfa7a262f1d14a81b8318d45d0f4 /drivers/i2c/busses/i2c-davinci.c
parent7605fa3b0aedbb6c77471517ba16753f276156d9 (diff)
downloadkernel_goldelico_gta04-593308259bbd335eda9c5280cdd1f7883c746211.zip
kernel_goldelico_gta04-593308259bbd335eda9c5280cdd1f7883c746211.tar.gz
kernel_goldelico_gta04-593308259bbd335eda9c5280cdd1f7883c746211.tar.bz2
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-davinci.c')
-rw-r--r--drivers/i2c/busses/i2c-davinci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 1f3d89c..c89687a 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -515,7 +515,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
return -ENODEV;
}
- ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1,
+ ioarea = request_mem_region(mem->start, resource_size(mem),
pdev->name);
if (!ioarea) {
dev_err(&pdev->dev, "I2C region already claimed\n");
@@ -578,7 +578,7 @@ err_free_mem:
put_device(&pdev->dev);
kfree(dev);
err_release_region:
- release_mem_region(mem->start, (mem->end - mem->start) + 1);
+ release_mem_region(mem->start, resource_size(mem));
return r;
}
@@ -601,7 +601,7 @@ static int davinci_i2c_remove(struct platform_device *pdev)
kfree(dev);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(mem->start, (mem->end - mem->start) + 1);
+ release_mem_region(mem->start, resource_size(mem));
return 0;
}