mtd: txx9ndfmc: use devm_request_and_ioremap
authorJulia Lawall <julia@diku.dk>
Tue, 27 Dec 2011 14:01:31 +0000 (15:01 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 9 Jan 2012 18:24:11 +0000 (18:24 +0000)
commitbca7f5f71389547489fffe6c757eaff8659bcd16
tree6337280aa5aa2fbef98db11d9cfc935b2e7903c6
parentaf32b36095147e1828496b58987c1e24ef40487d
mtd: txx9ndfmc: use devm_request_and_ioremap

Reimplement a call to devm_request_mem_region followed by a call to ioremap
or ioremap_nocache by a call to devm_request_and_ioremap.

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

// <smpl>
@nm@
expression myname;
identifier i;
@@

struct platform_driver i = { .driver = { .name = myname } };

@@
expression dev,res,size;
expression nm.myname;
@@

-if (!devm_request_mem_region(dev, res->start, size,
-                              \(res->name\|dev_name(dev)\|myname\))) {
-   ...
-   return ...;
-}
... when != res->start
(
-devm_ioremap(dev,res->start,size)
+devm_request_and_ioremap(dev,res)
|
-devm_ioremap_nocache(dev,res->start,size)
+devm_request_and_ioremap(dev,res)
)
... when any
    when != res->start
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/txx9ndfmc.c