Commit b782a563 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Wim Van Sebroeck

[WATCHDOG] use resource_size()

Use resource_size().
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Kevin Hilman <khilman@ti.deeprootsystems.com>
Cc: Ulrik Bech Hald <ubh@ti.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Vincent Sanders <support@simtec.co.uk>
Acked-by: default avatarThierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 4946f835
...@@ -242,14 +242,14 @@ static int __devinit adx_wdt_probe(struct platform_device *pdev) ...@@ -242,14 +242,14 @@ static int __devinit adx_wdt_probe(struct platform_device *pdev)
} }
res = devm_request_mem_region(&pdev->dev, res->start, res = devm_request_mem_region(&pdev->dev, res->start,
res->end - res->start + 1, res->name); resource_size(res), res->name);
if (!res) { if (!res) {
dev_err(&pdev->dev, "cannot request I/O memory region\n"); dev_err(&pdev->dev, "cannot request I/O memory region\n");
return -ENXIO; return -ENXIO;
} }
wdt->base = devm_ioremap_nocache(&pdev->dev, res->start, wdt->base = devm_ioremap_nocache(&pdev->dev, res->start,
res->end - res->start + 1); resource_size(res));
if (!wdt->base) { if (!wdt->base) {
dev_err(&pdev->dev, "cannot remap I/O memory region\n"); dev_err(&pdev->dev, "cannot remap I/O memory region\n");
return -ENXIO; return -ENXIO;
......
...@@ -326,7 +326,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev) ...@@ -326,7 +326,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
wdt->regs = ioremap(regs->start, regs->end - regs->start + 1); wdt->regs = ioremap(regs->start, resource_size(regs));
if (!wdt->regs) { if (!wdt->regs) {
ret = -ENOMEM; ret = -ENOMEM;
dev_dbg(&pdev->dev, "could not map I/O memory\n"); dev_dbg(&pdev->dev, "could not map I/O memory\n");
......
...@@ -221,7 +221,7 @@ static int __devinit davinci_wdt_probe(struct platform_device *pdev) ...@@ -221,7 +221,7 @@ static int __devinit davinci_wdt_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
size = res->end - res->start + 1; size = resource_size(res);
wdt_mem = request_mem_region(res->start, size, pdev->name); wdt_mem = request_mem_region(res->start, size, pdev->name);
if (wdt_mem == NULL) { if (wdt_mem == NULL) {
......
...@@ -350,7 +350,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) ...@@ -350,7 +350,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
ret = -ENXIO; ret = -ENXIO;
goto err_free; goto err_free;
} }
wdt->base = ioremap(res->start, res->end - res->start + 1); wdt->base = ioremap(res->start, resource_size(res));
if (!wdt->base) { if (!wdt->base) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_free; goto err_free;
......
...@@ -275,7 +275,7 @@ static int __devinit mv64x60_wdt_probe(struct platform_device *dev) ...@@ -275,7 +275,7 @@ static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
if (!r) if (!r)
return -ENODEV; return -ENODEV;
mv64x60_wdt_regs = ioremap(r->start, r->end - r->start + 1); mv64x60_wdt_regs = ioremap(r->start, resource_size(r));
if (mv64x60_wdt_regs == NULL) if (mv64x60_wdt_regs == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -277,8 +277,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) ...@@ -277,8 +277,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
goto err_busy; goto err_busy;
} }
mem = request_mem_region(res->start, res->end - res->start + 1, mem = request_mem_region(res->start, resource_size(res), pdev->name);
pdev->name);
if (!mem) { if (!mem) {
ret = -EBUSY; ret = -EBUSY;
goto err_busy; goto err_busy;
...@@ -306,7 +305,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) ...@@ -306,7 +305,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
goto err_clk; goto err_clk;
} }
wdev->base = ioremap(res->start, res->end - res->start + 1); wdev->base = ioremap(res->start, resource_size(res));
if (!wdev->base) { if (!wdev->base) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_ioremap; goto err_ioremap;
...@@ -358,7 +357,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) ...@@ -358,7 +357,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
kfree(wdev); kfree(wdev);
err_kzalloc: err_kzalloc:
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
err_busy: err_busy:
err_get_resource: err_get_resource:
...@@ -383,7 +382,7 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev) ...@@ -383,7 +382,7 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
misc_deregister(&(wdev->omap_wdt_miscdev)); misc_deregister(&(wdev->omap_wdt_miscdev));
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
clk_put(wdev->ick); clk_put(wdev->ick);
......
...@@ -264,7 +264,7 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev) ...@@ -264,7 +264,7 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
size = res->end - res->start + 1; size = resource_size(res);
wdt_mem = request_mem_region(res->start, size, pdev->name); wdt_mem = request_mem_region(res->start, size, pdev->name);
if (wdt_mem == NULL) { if (wdt_mem == NULL) {
......
...@@ -421,7 +421,7 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev) ...@@ -421,7 +421,7 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
size = (res->end - res->start) + 1; size = resource_size(res);
wdt_mem = request_mem_region(res->start, size, pdev->name); wdt_mem = request_mem_region(res->start, size, pdev->name);
if (wdt_mem == NULL) { if (wdt_mem == NULL) {
dev_err(dev, "failed to get memory region\n"); dev_err(dev, "failed to get memory region\n");
......
...@@ -214,12 +214,10 @@ static int __init txx9wdt_probe(struct platform_device *dev) ...@@ -214,12 +214,10 @@ static int __init txx9wdt_probe(struct platform_device *dev)
res = platform_get_resource(dev, IORESOURCE_MEM, 0); res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res) if (!res)
goto exit_busy; goto exit_busy;
if (!devm_request_mem_region(&dev->dev, if (!devm_request_mem_region(&dev->dev, res->start, resource_size(res),
res->start, res->end - res->start + 1,
"txx9wdt")) "txx9wdt"))
goto exit_busy; goto exit_busy;
txx9wdt_reg = devm_ioremap(&dev->dev, txx9wdt_reg = devm_ioremap(&dev->dev, res->start, resource_size(res));
res->start, res->end - res->start + 1);
if (!txx9wdt_reg) if (!txx9wdt_reg)
goto exit_busy; goto exit_busy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment