aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-06-09 12:13:32 -0400
committerJiri Kosina <jkosina@suse.cz>2011-06-10 08:55:36 -0400
commit28f65c11f2ffb3957259dece647a24f8ad2e241b (patch)
tree6b7621d09d10df89eedd908d4506fb9f457a909f /drivers/video
parent140a1ef2f91a00e1d25f0878c193abdc25bf6ebe (diff)
treewide: Convert uses of struct resource to resource_size(ptr)
Several fixes as well where the +1 was missing. Done via coccinelle scripts like: @@ struct resource *ptr; @@ - ptr->end - ptr->start + 1 + resource_size(ptr) and some grep and typing. Mostly uncompiled, no cross-compilers. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/atmel_lcdfb.c4
-rw-r--r--drivers/video/aty/atyfb_base.c7
-rw-r--r--drivers/video/au1100fb.c2
-rw-r--r--drivers/video/cobalt_lcdfb.c2
-rw-r--r--drivers/video/controlfb.c4
-rw-r--r--drivers/video/mb862xx/mb862xxfbdrv.c4
-rw-r--r--drivers/video/msm/mdp.c3
-rw-r--r--drivers/video/msm/msm_fb.c7
-rw-r--r--drivers/video/nuc900fb.c2
-rw-r--r--drivers/video/platinumfb.c5
-rw-r--r--drivers/video/pxa168fb.c2
11 files changed, 20 insertions, 22 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 4484c721f0f9..817ab60f7537 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -906,7 +906,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
906 if (map) { 906 if (map) {
907 /* use a pre-allocated memory buffer */ 907 /* use a pre-allocated memory buffer */
908 info->fix.smem_start = map->start; 908 info->fix.smem_start = map->start;
909 info->fix.smem_len = map->end - map->start + 1; 909 info->fix.smem_len = resource_size(map);
910 if (!request_mem_region(info->fix.smem_start, 910 if (!request_mem_region(info->fix.smem_start,
911 info->fix.smem_len, pdev->name)) { 911 info->fix.smem_len, pdev->name)) {
912 ret = -EBUSY; 912 ret = -EBUSY;
@@ -932,7 +932,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
932 932
933 /* LCDC registers */ 933 /* LCDC registers */
934 info->fix.mmio_start = regs->start; 934 info->fix.mmio_start = regs->start;
935 info->fix.mmio_len = regs->end - regs->start + 1; 935 info->fix.mmio_len = resource_size(regs);
936 936
937 if (!request_mem_region(info->fix.mmio_start, 937 if (!request_mem_region(info->fix.mmio_start,
938 info->fix.mmio_len, pdev->name)) { 938 info->fix.mmio_len, pdev->name)) {
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index ebb893c49e90..ad41f508b423 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3460,9 +3460,10 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev,
3460 3460
3461 raddr = addr + 0x7ff000UL; 3461 raddr = addr + 0x7ff000UL;
3462 rrp = &pdev->resource[2]; 3462 rrp = &pdev->resource[2];
3463 if ((rrp->flags & IORESOURCE_MEM) && request_mem_region(rrp->start, rrp->end - rrp->start + 1, "atyfb")) { 3463 if ((rrp->flags & IORESOURCE_MEM) &&
3464 request_mem_region(rrp->start, resource_size(rrp), "atyfb")) {
3464 par->aux_start = rrp->start; 3465 par->aux_start = rrp->start;
3465 par->aux_size = rrp->end - rrp->start + 1; 3466 par->aux_size = resource_size(rrp);
3466 raddr = rrp->start; 3467 raddr = rrp->start;
3467 PRINTKI("using auxiliary register aperture\n"); 3468 PRINTKI("using auxiliary register aperture\n");
3468 } 3469 }
@@ -3552,7 +3553,7 @@ static int __devinit atyfb_pci_probe(struct pci_dev *pdev,
3552 3553
3553 /* Reserve space */ 3554 /* Reserve space */
3554 res_start = rp->start; 3555 res_start = rp->start;
3555 res_size = rp->end - rp->start + 1; 3556 res_size = resource_size(rp);
3556 if (!request_mem_region(res_start, res_size, "atyfb")) 3557 if (!request_mem_region(res_start, res_size, "atyfb"))
3557 return -EBUSY; 3558 return -EBUSY;
3558 3559
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 34b2fc472fe8..01a8fde67f20 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -486,7 +486,7 @@ static int __devinit au1100fb_drv_probe(struct platform_device *dev)
486 } 486 }
487 487
488 au1100fb_fix.mmio_start = regs_res->start; 488 au1100fb_fix.mmio_start = regs_res->start;
489 au1100fb_fix.mmio_len = regs_res->end - regs_res->start + 1; 489 au1100fb_fix.mmio_len = resource_size(regs_res);
490 490
491 if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, 491 if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len,
492 DRIVER_NAME)) { 492 DRIVER_NAME)) {
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/cobalt_lcdfb.c
index 42fe155aba0e..e02764319ff7 100644
--- a/drivers/video/cobalt_lcdfb.c
+++ b/drivers/video/cobalt_lcdfb.c
@@ -303,7 +303,7 @@ static int __devinit cobalt_lcdfb_probe(struct platform_device *dev)
303 return -EBUSY; 303 return -EBUSY;
304 } 304 }
305 305
306 info->screen_size = res->end - res->start + 1; 306 info->screen_size = resource_size(res);
307 info->screen_base = ioremap(res->start, info->screen_size); 307 info->screen_base = ioremap(res->start, info->screen_size);
308 info->fbops = &cobalt_lcd_fbops; 308 info->fbops = &cobalt_lcd_fbops;
309 info->fix = cobalt_lcdfb_fix; 309 info->fix = cobalt_lcdfb_fix;
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c
index c225dcce89e7..9075bea55879 100644
--- a/drivers/video/controlfb.c
+++ b/drivers/video/controlfb.c
@@ -709,11 +709,11 @@ static int __init control_of_init(struct device_node *dp)
709 709
710 /* Map in frame buffer and registers */ 710 /* Map in frame buffer and registers */
711 p->fb_orig_base = fb_res.start; 711 p->fb_orig_base = fb_res.start;
712 p->fb_orig_size = fb_res.end - fb_res.start + 1; 712 p->fb_orig_size = resource_size(&fb_res);
713 /* use the big-endian aperture (??) */ 713 /* use the big-endian aperture (??) */
714 p->frame_buffer_phys = fb_res.start + 0x800000; 714 p->frame_buffer_phys = fb_res.start + 0x800000;
715 p->control_regs_phys = reg_res.start; 715 p->control_regs_phys = reg_res.start;
716 p->control_regs_size = reg_res.end - reg_res.start + 1; 716 p->control_regs_size = resource_size(&reg_res);
717 717
718 if (!p->fb_orig_base || 718 if (!p->fb_orig_base ||
719 !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { 719 !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) {
diff --git a/drivers/video/mb862xx/mb862xxfbdrv.c b/drivers/video/mb862xx/mb862xxfbdrv.c
index f70bd63b0187..ee1de3e26dec 100644
--- a/drivers/video/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/mb862xx/mb862xxfbdrv.c
@@ -697,7 +697,7 @@ static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev)
697 goto fbrel; 697 goto fbrel;
698 } 698 }
699 699
700 res_size = 1 + res.end - res.start; 700 res_size = resource_size(&res);
701 par->res = request_mem_region(res.start, res_size, DRV_NAME); 701 par->res = request_mem_region(res.start, res_size, DRV_NAME);
702 if (par->res == NULL) { 702 if (par->res == NULL) {
703 dev_err(dev, "Cannot claim framebuffer/mmio\n"); 703 dev_err(dev, "Cannot claim framebuffer/mmio\n");
@@ -787,7 +787,7 @@ static int __devexit of_platform_mb862xx_remove(struct platform_device *ofdev)
787{ 787{
788 struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); 788 struct fb_info *fbi = dev_get_drvdata(&ofdev->dev);
789 struct mb862xxfb_par *par = fbi->par; 789 struct mb862xxfb_par *par = fbi->par;
790 resource_size_t res_size = 1 + par->res->end - par->res->start; 790 resource_size_t res_size = resource_size(par->res);
791 unsigned long reg; 791 unsigned long reg;
792 792
793 dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); 793 dev_dbg(fbi->dev, "%s release\n", fbi->fix.id);
diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c
index c3636d55a3c5..243d16f09b8a 100644
--- a/drivers/video/msm/mdp.c
+++ b/drivers/video/msm/mdp.c
@@ -406,8 +406,7 @@ int mdp_probe(struct platform_device *pdev)
406 goto error_get_irq; 406 goto error_get_irq;
407 } 407 }
408 408
409 mdp->base = ioremap(resource->start, 409 mdp->base = ioremap(resource->start, resource_size(resource));
410 resource->end - resource->start);
411 if (mdp->base == 0) { 410 if (mdp->base == 0) {
412 printk(KERN_ERR "msmfb: cannot allocate mdp regs!\n"); 411 printk(KERN_ERR "msmfb: cannot allocate mdp regs!\n");
413 ret = -ENOMEM; 412 ret = -ENOMEM;
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
index ec351309e607..c6e3b4fcdd68 100644
--- a/drivers/video/msm/msm_fb.c
+++ b/drivers/video/msm/msm_fb.c
@@ -525,10 +525,9 @@ static int setup_fbmem(struct msmfb_info *msmfb, struct platform_device *pdev)
525 return -ENOMEM; 525 return -ENOMEM;
526 } 526 }
527 fb->fix.smem_start = resource->start; 527 fb->fix.smem_start = resource->start;
528 fb->fix.smem_len = resource->end - resource->start; 528 fb->fix.smem_len = resource_size(resource);
529 fbram = ioremap(resource->start, 529 fbram = ioremap(resource->start, resource_size(resource));
530 resource->end - resource->start); 530 if (fbram == NULL) {
531 if (fbram == 0) {
532 printk(KERN_ERR "msmfb: cannot allocate fbram!\n"); 531 printk(KERN_ERR "msmfb: cannot allocate fbram!\n");
533 return -ENOMEM; 532 return -ENOMEM;
534 } 533 }
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c
index f838d9e277f0..0fff59782e45 100644
--- a/drivers/video/nuc900fb.c
+++ b/drivers/video/nuc900fb.c
@@ -551,7 +551,7 @@ static int __devinit nuc900fb_probe(struct platform_device *pdev)
551 551
552 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 552 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
553 553
554 size = (res->end - res->start) + 1; 554 size = resource_size(res);
555 fbi->mem = request_mem_region(res->start, size, pdev->name); 555 fbi->mem = request_mem_region(res->start, size, pdev->name);
556 if (fbi->mem == NULL) { 556 if (fbi->mem == NULL) {
557 dev_err(&pdev->dev, "failed to alloc memory region\n"); 557 dev_err(&pdev->dev, "failed to alloc memory region\n");
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index ef532d9d3c99..f27ae16ead2e 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -567,7 +567,7 @@ static int __devinit platinumfb_probe(struct platform_device* odev)
567 * northbridge and that can fail. Only request framebuffer 567 * northbridge and that can fail. Only request framebuffer
568 */ 568 */
569 if (!request_mem_region(pinfo->rsrc_fb.start, 569 if (!request_mem_region(pinfo->rsrc_fb.start,
570 pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1, 570 resource_size(&pinfo->rsrc_fb),
571 "platinumfb framebuffer")) { 571 "platinumfb framebuffer")) {
572 printk(KERN_ERR "platinumfb: Can't request framebuffer !\n"); 572 printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
573 framebuffer_release(info); 573 framebuffer_release(info);
@@ -658,8 +658,7 @@ static int __devexit platinumfb_remove(struct platform_device* odev)
658 iounmap(pinfo->cmap_regs); 658 iounmap(pinfo->cmap_regs);
659 659
660 release_mem_region(pinfo->rsrc_fb.start, 660 release_mem_region(pinfo->rsrc_fb.start,
661 pinfo->rsrc_fb.end - 661 resource_size(&pinfo->rsrc_fb));
662 pinfo->rsrc_fb.start + 1);
663 662
664 release_mem_region(pinfo->cmap_regs_phys, 0x1000); 663 release_mem_region(pinfo->cmap_regs_phys, 0x1000);
665 664
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c
index bb95ec56d25d..18ead6f0184d 100644
--- a/drivers/video/pxa168fb.c
+++ b/drivers/video/pxa168fb.c
@@ -662,7 +662,7 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev)
662 info->fix.ypanstep = 0; 662 info->fix.ypanstep = 0;
663 info->fix.ywrapstep = 0; 663 info->fix.ywrapstep = 0;
664 info->fix.mmio_start = res->start; 664 info->fix.mmio_start = res->start;
665 info->fix.mmio_len = res->end - res->start + 1; 665 info->fix.mmio_len = resource_size(res);
666 info->fix.accel = FB_ACCEL_NONE; 666 info->fix.accel = FB_ACCEL_NONE;
667 info->fbops = &pxa168fb_ops; 667 info->fbops = &pxa168fb_ops;
668 info->pseudo_palette = fbi->pseudo_palette; 668 info->pseudo_palette = fbi->pseudo_palette;