Skip to content

Commit b539cc8

Browse files
ilina-linarorafaeljw
authored andcommitted
PM / Domains: Ignore domain-idle-states that are not compatible
domain-idle-states property may have phandles to idle state bindings that may not be compatible with idle state definition defined in [1]. Such phandles would just be ignored and not throw and error when read by the domain core. Signed-off-by: Lina Iyer <[email protected]> Acked-by: Rob Herring <[email protected]> Acked-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 075c37d commit b539cc8

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Documentation/devicetree/bindings/power/power_domain.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ Optional properties:
3131

3232
- domain-idle-states : A phandle of an idle-state that shall be soaked into a
3333
generic domain power state. The idle state definitions are
34-
compatible with domain-idle-state specified in [1].
34+
compatible with domain-idle-state specified in [1]. phandles
35+
that are not compatible with domain-idle-state will be
36+
ignored.
3537
The domain-idle-state property reflects the idle state of this PM domain and
3638
not the idle states of the devices or sub-domains in the PM domain. Devices
3739
and sub-domains have their own idle-states independent of the parent

drivers/base/power/domain.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,11 +2093,6 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
20932093
int err;
20942094
u32 residency;
20952095
u32 entry_latency, exit_latency;
2096-
const struct of_device_id *match_id;
2097-
2098-
match_id = of_match_node(idle_state_match, state_node);
2099-
if (!match_id)
2100-
return -EINVAL;
21012096

21022097
err = of_property_read_u32(state_node, "entry-latency-us",
21032098
&entry_latency);
@@ -2146,6 +2141,7 @@ int of_genpd_parse_idle_states(struct device_node *dn,
21462141
int err, ret;
21472142
int count;
21482143
struct of_phandle_iterator it;
2144+
const struct of_device_id *match_id;
21492145

21502146
count = of_count_phandle_with_args(dn, "domain-idle-states", NULL);
21512147
if (count <= 0)
@@ -2158,6 +2154,9 @@ int of_genpd_parse_idle_states(struct device_node *dn,
21582154
/* Loop over the phandles until all the requested entry is found */
21592155
of_for_each_phandle(&it, err, dn, "domain-idle-states", NULL, 0) {
21602156
np = it.node;
2157+
match_id = of_match_node(idle_state_match, np);
2158+
if (!match_id)
2159+
continue;
21612160
ret = genpd_parse_state(&st[i++], np);
21622161
if (ret) {
21632162
pr_err
@@ -2169,8 +2168,11 @@ int of_genpd_parse_idle_states(struct device_node *dn,
21692168
}
21702169
}
21712170

2172-
*n = count;
2173-
*states = st;
2171+
*n = i;
2172+
if (!i)
2173+
kfree(st);
2174+
else
2175+
*states = st;
21742176

21752177
return 0;
21762178
}

0 commit comments

Comments
 (0)