fbdev: s1d13xxxfb: use resource_size

Use resource_size rather than a verbose computation on
the end and start fields.

The semantic patch that makes these changes is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&ptr)
</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Cc: Kristoffer Ericson <kristoffer.ericson@gmail.com>
[b.zolnierkie: ported patch to drm-misc-next]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1577900990-8588-4-git-send-email-Julia.Lawall@inria.fr
This commit is contained in:
Julia Lawall 2020-01-01 18:49:43 +01:00 committed by Bartlomiej Zolnierkiewicz
parent 3c3c56397d
commit 091be7245a

View File

@ -746,9 +746,9 @@ s1d13xxxfb_remove(struct platform_device *pdev)
} }
release_mem_region(pdev->resource[0].start, release_mem_region(pdev->resource[0].start,
pdev->resource[0].end - pdev->resource[0].start +1); resource_size(&pdev->resource[0]));
release_mem_region(pdev->resource[1].start, release_mem_region(pdev->resource[1].start,
pdev->resource[1].end - pdev->resource[1].start +1); resource_size(&pdev->resource[1]));
return 0; return 0;
} }
@ -788,14 +788,14 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
} }
if (!request_mem_region(pdev->resource[0].start, if (!request_mem_region(pdev->resource[0].start,
pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) { resource_size(&pdev->resource[0]), "s1d13xxxfb mem")) {
dev_dbg(&pdev->dev, "request_mem_region failed\n"); dev_dbg(&pdev->dev, "request_mem_region failed\n");
ret = -EBUSY; ret = -EBUSY;
goto bail; goto bail;
} }
if (!request_mem_region(pdev->resource[1].start, if (!request_mem_region(pdev->resource[1].start,
pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) { resource_size(&pdev->resource[1]), "s1d13xxxfb regs")) {
dev_dbg(&pdev->dev, "request_mem_region failed\n"); dev_dbg(&pdev->dev, "request_mem_region failed\n");
ret = -EBUSY; ret = -EBUSY;
goto bail; goto bail;
@ -810,7 +810,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
default_par = info->par; default_par = info->par;
default_par->regs = ioremap_nocache(pdev->resource[1].start, default_par->regs = ioremap_nocache(pdev->resource[1].start,
pdev->resource[1].end - pdev->resource[1].start +1); resource_size(&pdev->resource[1]));
if (!default_par->regs) { if (!default_par->regs) {
printk(KERN_ERR PFX "unable to map registers\n"); printk(KERN_ERR PFX "unable to map registers\n");
ret = -ENOMEM; ret = -ENOMEM;
@ -819,8 +819,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
info->pseudo_palette = default_par->pseudo_palette; info->pseudo_palette = default_par->pseudo_palette;
info->screen_base = ioremap_nocache(pdev->resource[0].start, info->screen_base = ioremap_nocache(pdev->resource[0].start,
pdev->resource[0].end - pdev->resource[0].start +1); resource_size(&pdev->resource[0]));
if (!info->screen_base) { if (!info->screen_base) {
printk(KERN_ERR PFX "unable to map framebuffer\n"); printk(KERN_ERR PFX "unable to map framebuffer\n");
ret = -ENOMEM; ret = -ENOMEM;
@ -857,9 +856,9 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
info->fix = s1d13xxxfb_fix; info->fix = s1d13xxxfb_fix;
info->fix.mmio_start = pdev->resource[1].start; info->fix.mmio_start = pdev->resource[1].start;
info->fix.mmio_len = pdev->resource[1].end - pdev->resource[1].start + 1; info->fix.mmio_len = resource_size(&pdev->resource[1]);
info->fix.smem_start = pdev->resource[0].start; info->fix.smem_start = pdev->resource[0].start;
info->fix.smem_len = pdev->resource[0].end - pdev->resource[0].start + 1; info->fix.smem_len = resource_size(&pdev->resource[0]);
printk(KERN_INFO PFX "regs mapped at 0x%p, fb %d KiB mapped at 0x%p\n", printk(KERN_INFO PFX "regs mapped at 0x%p, fb %d KiB mapped at 0x%p\n",
default_par->regs, info->fix.smem_len / 1024, info->screen_base); default_par->regs, info->fix.smem_len / 1024, info->screen_base);