]> git.baikalelectronics.ru Git - kernel.git/commit
iio: adc: max1363: merge calls to of_match_device and of_device_get_match_data
authorJulia Lawall <Julia.Lawall@lip6.fr>
Mon, 21 May 2018 09:49:09 +0000 (11:49 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 8 Jul 2018 09:35:17 +0000 (10:35 +0100)
commit101a9a6c0c47f645164a6d25bd7d15676722fc6d
tree963a3cc820c1763def6b84c93a51bfc8b4833fcb
parentd44344e25095c37dd1c722b127705ad0e83735ad
iio: adc: max1363: merge calls to of_match_device and of_device_get_match_data

Drop call to of_match_device, which is subsumed by the subsequent
call to of_device_get_match_data.  The code becomes simpler, and a
temporary variable can be dropped.

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

// <smpl>
@r@
local idexpression match;
identifier i;
expression x, dev, e, e1;
@@
-        match@i = of_match_device(x, dev);
-        if (match) e = of_device_get_match_data(dev);
-        else e = e1;
+        e = of_device_get_match_data(dev);
+        if (!e) e = e1;

@@
identifier r.i;
@@
- const struct of_device_id *i;
... when != i
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/max1363.c