aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorBen Dooks <ben@simtec.co.uk>2009-12-15 19:46:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:20:02 -0500
commitd60f6c2ba86243a3bbc0c70508f71f84c5308f8e (patch)
tree9e700002d87305fe96c80d7caafa9dd4bf46cdcb /drivers/video
parentb689a9e8362ed909045f99517b735c7c60835f7c (diff)
sm501: fix missing uses of resource_size()
There are several places in the SM501 fb driver that could do with using resource_size() to calculate the size of a resource. Also fix a bug where request_mem_region() is being passed one too few bytes when requesting the register memory region, which was causing the following in /proc/iomem: 13e80000-13e8ffff : sm501-fb.0 13e80000-13e8fffe : sm501-fb fixed, this reads: 13e80000-13e8ffff : sm501-fb.0 13e80000-13e8ffff : sm501-fb Signed-off-by: Ben Dooks <ben@simtec.co.uk> Signed-off-by: Simtec Linux Team <linux@simtec.co.uk> Cc: Vincent Sanders <vince@simtec.co.uk> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/sm501fb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 924d79462780..95be9e90e8b8 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -1338,7 +1338,7 @@ static int sm501fb_start(struct sm501fb_info *info,
1338 } 1338 }
1339 1339
1340 info->regs_res = request_mem_region(res->start, 1340 info->regs_res = request_mem_region(res->start,
1341 res->end - res->start, 1341 resource_size(res),
1342 pdev->name); 1342 pdev->name);
1343 1343
1344 if (info->regs_res == NULL) { 1344 if (info->regs_res == NULL) {
@@ -1347,7 +1347,7 @@ static int sm501fb_start(struct sm501fb_info *info,
1347 goto err_release; 1347 goto err_release;
1348 } 1348 }
1349 1349
1350 info->regs = ioremap(res->start, (res->end - res->start)+1); 1350 info->regs = ioremap(res->start, resource_size(res));
1351 if (info->regs == NULL) { 1351 if (info->regs == NULL) {
1352 dev_err(dev, "cannot remap registers\n"); 1352 dev_err(dev, "cannot remap registers\n");
1353 ret = -ENXIO; 1353 ret = -ENXIO;
@@ -1363,7 +1363,7 @@ static int sm501fb_start(struct sm501fb_info *info,
1363 } 1363 }
1364 1364
1365 info->fbmem_res = request_mem_region(res->start, 1365 info->fbmem_res = request_mem_region(res->start,
1366 (res->end - res->start)+1, 1366 resource_size(res),
1367 pdev->name); 1367 pdev->name);
1368 if (info->fbmem_res == NULL) { 1368 if (info->fbmem_res == NULL) {
1369 dev_err(dev, "cannot claim framebuffer\n"); 1369 dev_err(dev, "cannot claim framebuffer\n");
@@ -1371,13 +1371,13 @@ static int sm501fb_start(struct sm501fb_info *info,
1371 goto err_regs_map; 1371 goto err_regs_map;
1372 } 1372 }
1373 1373
1374 info->fbmem = ioremap(res->start, (res->end - res->start)+1); 1374 info->fbmem = ioremap(res->start, resource_size(res));
1375 if (info->fbmem == NULL) { 1375 if (info->fbmem == NULL) {
1376 dev_err(dev, "cannot remap framebuffer\n"); 1376 dev_err(dev, "cannot remap framebuffer\n");
1377 goto err_mem_res; 1377 goto err_mem_res;
1378 } 1378 }
1379 1379
1380 info->fbmem_len = (res->end - res->start)+1; 1380 info->fbmem_len = resource_size(res);
1381 1381
1382 /* clear framebuffer memory - avoids garbage data on unused fb */ 1382 /* clear framebuffer memory - avoids garbage data on unused fb */
1383 memset(info->fbmem, 0, info->fbmem_len); 1383 memset(info->fbmem, 0, info->fbmem_len);