diff options
author | Julia Lawall <julia@diku.dk> | 2011-12-27 09:01:28 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2012-01-27 03:53:19 -0500 |
commit | 5d32d4868ad87a5be8571b22b3d732576504dfb0 (patch) | |
tree | 7908b55346143babcf235a27180e7e48fe594c99 | |
parent | 74ea15d909b31158f9b63190a95b52bc05586d4b (diff) |
watchdog: imx2_wdt.c: 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 variable res_size is then no longer needed.
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: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/imx2_wdt.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index b8ef2c6dca7c..c44c3334003a 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c | |||
@@ -247,7 +247,6 @@ static struct miscdevice imx2_wdt_miscdev = { | |||
247 | static int __init imx2_wdt_probe(struct platform_device *pdev) | 247 | static int __init imx2_wdt_probe(struct platform_device *pdev) |
248 | { | 248 | { |
249 | int ret; | 249 | int ret; |
250 | int res_size; | ||
251 | struct resource *res; | 250 | struct resource *res; |
252 | 251 | ||
253 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 252 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -256,15 +255,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) | |||
256 | return -ENODEV; | 255 | return -ENODEV; |
257 | } | 256 | } |
258 | 257 | ||
259 | res_size = resource_size(res); | 258 | imx2_wdt.base = devm_request_and_ioremap(&pdev->dev, res); |
260 | if (!devm_request_mem_region(&pdev->dev, res->start, res_size, | ||
261 | res->name)) { | ||
262 | dev_err(&pdev->dev, "can't allocate %d bytes at %d address\n", | ||
263 | res_size, res->start); | ||
264 | return -ENOMEM; | ||
265 | } | ||
266 | |||
267 | imx2_wdt.base = devm_ioremap_nocache(&pdev->dev, res->start, res_size); | ||
268 | if (!imx2_wdt.base) { | 259 | if (!imx2_wdt.base) { |
269 | dev_err(&pdev->dev, "ioremap failed\n"); | 260 | dev_err(&pdev->dev, "ioremap failed\n"); |
270 | return -ENOMEM; | 261 | return -ENOMEM; |