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>
This commit is contained in:
Julia Lawall
2009-07-05 08:37:50 +02:00
committed by Ben Dooks
parent 7605fa3b0a
commit 593308259b
4 changed files with 8 additions and 8 deletions

View File

@@ -92,7 +92,7 @@ static int simtec_i2c_probe(struct platform_device *dev)
goto err;
}
size = (res->end-res->start)+1;
size = resource_size(res);
pd->ioarea = request_mem_region(res->start, size, dev->name);
if (pd->ioarea == NULL) {