fsl/fman: use resource_size
authorJulia Lawall <Julia.Lawall@inria.fr>
Wed, 1 Jan 2020 17:49:44 +0000 (18:49 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Jan 2020 00:31:03 +0000 (16:31 -0800)
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 + 1 - ptr.start)
+ resource_size(&ptr)

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

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fman/mac.c

index f0806ace1ae29ea1202af6fcfadf5c1eb1d8d046..55f2122c3217ac38b11b1cc8fba6d633bfff5fac 100644 (file)
@@ -692,7 +692,7 @@ static int mac_probe(struct platform_device *_of_dev)
 
        mac_dev->res = __devm_request_region(dev,
                                             fman_get_mem_region(priv->fman),
-                                            res.start, res.end + 1 - res.start,
+                                            res.start, resource_size(&res),
                                             "mac");
        if (!mac_dev->res) {
                dev_err(dev, "__devm_request_mem_region(mac) failed\n");
@@ -701,7 +701,7 @@ static int mac_probe(struct platform_device *_of_dev)
        }
 
        priv->vaddr = devm_ioremap(dev, mac_dev->res->start,
-                                  mac_dev->res->end + 1 - mac_dev->res->start);
+                                  resource_size(mac_dev->res));
        if (!priv->vaddr) {
                dev_err(dev, "devm_ioremap() failed\n");
                err = -EIO;