layerscape: add ls1088ardb device support
[openwrt/staging/lynxis/omap.git] / target / linux / layerscape / patches-4.4 / 7159-staging-fsl-mc-bus-Eliminate-double-function-call.patch
1 From ecd7b5d9616e50f48a400749f17db19fd8a43f25 Mon Sep 17 00:00:00 2001
2 From: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
3 Date: Sun, 28 Feb 2016 23:58:05 +0530
4 Subject: [PATCH 159/226] staging: fsl-mc: bus: Eliminate double function call
5
6 A call to irq_find_matching_host was already made and the result
7 has been stored in mc_msi_domain. mc_msi_domain is again reassigned
8 using the same function call which is redundant.
9
10 irq_find_matching_host returns/locates a domain for a given fwnode.
11 The domain is identified using device node and bus_token(if several
12 domains have same device node but different purposes they can be
13 distinguished using bus-specific token).
14 http://www.bricktou.com/include/linux/irqdomain_irq_find_matching_host_en.html
15
16 Also, of_property_read_bool finds and reads a boolean from a property
17 device node from which the property value is to be read. It doesn't
18 alter the device node.
19 http://lists.infradead.org/pipermail/linux-arm-kernel/2012-February/083698.html
20
21 Since, both the function calls have the same device node and bus_token,
22 the return values shall be the same. Hence, the second call has been
23 removed.
24
25 This was done using Coccinelle:
26
27 @r@
28 idexpression *x;
29 identifier f;
30 position p1,p2;
31 @@
32
33 x@p1 = f(...)
34 ... when != x
35 (
36 x@p2 = f(...)
37 )
38
39 @script:python@
40 p1 << r.p1;
41 p2 << r.p2;
42 @@
43
44 if (p1[0].line == p2[0].line):
45 cocci.include_match(False)
46
47 @@
48 idexpression *x;
49 identifier f;
50 position r.p1,r.p2;
51 @@
52
53 *x@p1 = f(...)
54 ...
55 *x@p2 = f(...)
56
57 Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
58 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
59 ---
60 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 --
61 1 file changed, 2 deletions(-)
62
63 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
64 +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
65 @@ -118,8 +118,6 @@ void its_fsl_mc_msi_cleanup(void)
66 if (!of_property_read_bool(np, "msi-controller"))
67 continue;
68
69 - mc_msi_domain = irq_find_matching_host(np,
70 - DOMAIN_BUS_FSL_MC_MSI);
71 if (mc_msi_domain &&
72 mc_msi_domain->host_data == &its_fsl_mc_msi_domain_info)
73 irq_domain_remove(mc_msi_domain);