linux/drivers/base/power
Ulf Hansson a3381e3a65 PM / domains: Fix up domain-idle-states OF parsing
Commit b539cc82d4 (PM / Domains: Ignore domain-idle-states that are
not compatible), made it possible to ignore non-compatible
domain-idle-states OF nodes. However, in case that happens while doing
the OF parsing, the number of elements in the allocated array would
exceed the numbers actually needed, thus wasting memory.

Fix this by pre-iterating the genpd OF node and counting the number of
compatible domain-idle-states nodes, before doing the allocation. While
doing this, it makes sense to rework the code a bit to avoid open coding,
of parts responsible for the OF node iteration.

Let's also take the opportunity to clarify the function header for
of_genpd_parse_idle_states(), about what is being returned in case of
errors.

Fixes: b539cc82d4 (PM / Domains: Ignore domain-idle-states that are not compatible)
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2018-02-07 12:02:01 +01:00
..
clock_ops.c PM / clk: Add support for adding a specific clock from device-tree 2016-06-28 00:42:10 +02:00
common.c PM: Avoid false-positive warnings in dev_pm_domain_set() 2016-02-03 19:10:37 +01:00
domain_governor.c PM / QoS: Fix device resume latency framework 2017-11-08 12:14:51 +01:00
domain.c PM / domains: Fix up domain-idle-states OF parsing 2018-02-07 12:02:01 +01:00
generic_ops.c PM / sleep: Remove pm_complete_with_resume_check() 2017-10-11 15:40:29 +02:00
main.c PM / core: Propagate wakeup_path status flag in __device_suspend_late() 2018-01-10 13:13:57 +01:00
Makefile Merge branches 'pm-cpufreq-sched' and 'pm-opp' 2017-11-13 01:40:52 +01:00
power.h PM / wakeup: Do not fail dev_pm_attach_wake_irq() unnecessarily 2018-01-09 13:09:16 +01:00
qos.c PM / QoS: Fix device resume latency framework 2017-11-08 12:14:51 +01:00
runtime.c PM / runtime: Allow no callbacks in pm_runtime_force_suspend|resume() 2018-01-17 12:42:49 +01:00
sysfs.c PM / sysfs: Convert to use DEVICE_ATTR_RO / DEVICE_ATTR_RW 2017-12-05 01:59:57 +01:00
trace.c timekeeping: Ignore the bogus sleep time if pm_trace is enabled 2016-11-29 18:02:58 +01:00
wakeirq.c PM / wakeup: Do not fail dev_pm_attach_wake_irq() unnecessarily 2018-01-09 13:09:16 +01:00
wakeup.c PM / wakeup: Print warn if device gets enabled as wakeup source during sleep 2018-01-11 18:50:54 +01:00