imxfb: use resource_size() macro

This fixes an off-by-one error. Also, use dev_err instead of printk
in probe() function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2009-06-29 11:41:09 +02:00
parent f497d0153a
commit d6b5150288

View file

@ -661,7 +661,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
int ret; int ret;
printk("i.MX Framebuffer driver\n"); dev_info(&pdev->dev, "i.MX Framebuffer driver\n");
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) if (!res)
@ -701,7 +701,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
fbi->regs = ioremap(res->start, resource_size(res)); fbi->regs = ioremap(res->start, resource_size(res));
if (fbi->regs == NULL) { if (fbi->regs == NULL) {
printk(KERN_ERR"Cannot map frame buffer registers\n"); dev_err(&pdev->dev, "Cannot map frame buffer registers\n");
goto failed_ioremap; goto failed_ioremap;
} }
@ -771,7 +771,7 @@ failed_map:
failed_getclock: failed_getclock:
iounmap(fbi->regs); iounmap(fbi->regs);
failed_ioremap: failed_ioremap:
release_mem_region(res->start, res->end - res->start); release_mem_region(res->start, resource_size(res));
failed_req: failed_req:
kfree(info->pseudo_palette); kfree(info->pseudo_palette);
failed_init: failed_init:
@ -802,7 +802,7 @@ static int __devexit imxfb_remove(struct platform_device *pdev)
framebuffer_release(info); framebuffer_release(info);
iounmap(fbi->regs); iounmap(fbi->regs);
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
clk_disable(fbi->clk); clk_disable(fbi->clk);
clk_put(fbi->clk); clk_put(fbi->clk);