diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2016-02-28 18:00:56 +0530 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-03-08 15:56:33 +0700 |
commit | fa283db76f681b9e17af2c329817042134178e7f (patch) | |
tree | a76566ce41a2d976562fb67b23cadffb6fb6e265 /samples | |
parent | 6dcfd7291bae5ed030bb2b3f69c734f62606ef9b (diff) | |
download | linux-fa283db76f681b9e17af2c329817042134178e7f.tar.bz2 |
gpio: timberdale: Switch to devm_ioremap_resource()
Replace calls to devm_request_mem_region and devm_ioremap with a
direct call to devm_ioremap_resource instead and modify error
handling.
Move the call to platform_get_resource adjacent to the call to
devm_ioremap_resource to make the connection between them more
clear.
A simplified version of the Coccinelle semantic patch that is used to
make this change is as follows:
//<smpl>
@nm@
expression myname;
identifier i;
@@
struct platform_driver i = { .driver = { .name = myname } };
@@
expression dev,res,size,e1,e;
expression nm.myname;
@@
-if (!devm_request_mem_region(dev, res->start, size,
- \(res->name\|dev_name(dev)\|myname\)))
{
- ...
- return ...;
-}
... when != res->start = e1
e =
-devm_ioremap(dev,res->start,size);
+devm_ioremap_resource(dev,res);
if
-(e == NULL)
+(IS_ERR(e))
{
...
-return ...;
+return PTR_ERR(e);
}
//</smpl>
Further, updated error handling by hand as devm_ioremap_resource
gives appropriate error messages, so remove unnecessary error
messages.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions