Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6ffddea authored by Linus Walleij's avatar Linus Walleij Committed by Ben Dooks
Browse files

i2c: Use resource_size macro



This replace all instances in the i2c busses tree of
res->end - res->start + 1 with the handy macro resource_size(res)
from ioport.h (coming in from platform_device.h).

This was created with a simple
sed -i -e 's/\([a-z]*\)->end *- *[a-z]*->start *+ *1/resource_size(\1)/g'

Then manually replacing the PXA redefiniton of the same kind
of macro manually. Recompiled some ARM defconfigs I could find to
make a rough test so it shouldn't break anything, though I
couldn't see exactly which configs you need for all the drivers.

Signed-off-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent 18904c0e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -200,10 +200,10 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev)
	if (!res)
		return -ENXIO;

	if (!request_mem_region(res->start, res->end - res->start + 1, "at91_i2c"))
	if (!request_mem_region(res->start, resource_size(res), "at91_i2c"))
		return -EBUSY;

	twi_base = ioremap(res->start, res->end - res->start + 1);
	twi_base = ioremap(res->start, resource_size(res));
	if (!twi_base) {
		rc = -ENOMEM;
		goto fail0;
@@ -252,7 +252,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev)
fail1:
	iounmap(twi_base);
fail0:
	release_mem_region(res->start, res->end - res->start + 1);
	release_mem_region(res->start, resource_size(res));

	return rc;
}
@@ -268,7 +268,7 @@ static int __devexit at91_i2c_remove(struct platform_device *pdev)

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	iounmap(twi_base);
	release_mem_region(res->start, res->end - res->start + 1);
	release_mem_region(res->start, resource_size(res));

	clk_disable(twi_clk);		/* disable peripheral clock */
	clk_put(twi_clk);
+1 −1
Original line number Diff line number Diff line
@@ -389,7 +389,7 @@ i2c_au1550_probe(struct platform_device *pdev)
		goto out;
	}

	priv->ioarea = request_mem_region(r->start, r->end - r->start + 1,
	priv->ioarea = request_mem_region(r->start, resource_size(r),
					  pdev->name);
	if (!priv->ioarea) {
		ret = -EBUSY;
+1 −1
Original line number Diff line number Diff line
@@ -652,7 +652,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
		goto out_error_get_res;
	}

	iface->regs_base = ioremap(res->start, res->end - res->start + 1);
	iface->regs_base = ioremap(res->start, resource_size(res));
	if (iface->regs_base == NULL) {
		dev_err(&pdev->dev, "Cannot map IO\n");
		rc = -ENXIO;
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ static int __devinit highlander_i2c_probe(struct platform_device *pdev)
	if (unlikely(!dev))
		return -ENOMEM;

	dev->base = ioremap_nocache(res->start, res->end - res->start + 1);
	dev->base = ioremap_nocache(res->start, resource_size(res));
	if (unlikely(!dev->base)) {
		ret = -ENXIO;
		goto err;
+1 −1
Original line number Diff line number Diff line
@@ -469,7 +469,7 @@ mv64xxx_i2c_map_regs(struct platform_device *pd,
	if (!r)
		return -ENODEV;

	size = r->end - r->start + 1;
	size = resource_size(r);

	if (!request_mem_region(r->start, size, drv_data->adapter.name))
		return -EBUSY;
Loading