fbdev: cg14fb: use resource_size
authorJulia Lawall <Julia.Lawall@inria.fr>
Wed, 1 Jan 2020 17:49:47 +0000 (18:49 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Wed, 15 Jan 2020 16:31:50 +0000 (17:31 +0100)
Use resource_size rather than a verbose computation on
the end and start fields.

The semantic patch that makes this change 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>
[b.zolnierkie: minor patch summary fixup]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1577900990-8588-8-git-send-email-Julia.Lawall@inria.fr
drivers/video/fbdev/cg14.c

index a620b51..6a745eb 100644 (file)
@@ -509,8 +509,7 @@ static int cg14_probe(struct platform_device *op)
        if (!par->regs || !par->clut || !par->cursor || !info->screen_base)
                goto out_unmap_regs;
 
-       is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) ==
-                 (8 * 1024 * 1024));
+       is_8mb = (resource_size(&op->resource[1]) == (8 * 1024 * 1024));
 
        BUILD_BUG_ON(sizeof(par->mmap_map) != sizeof(__cg14_mmap_map));