opp: Allocate genpd_virt_devs from dev_pm_opp_attach_genpd()
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 8 May 2019 10:13:36 +0000 (15:43 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 20 May 2019 06:34:45 +0000 (12:04 +0530)
commitc0ab9e0812da8e2134dd63d030c8a8abd2112a5a
treed5cc1b2ec0bb7a40f9498b06b1fa8639eadc6126
parent6319aee10e530315689db7609a7d4c444124ff22
opp: Allocate genpd_virt_devs from dev_pm_opp_attach_genpd()

Currently the space for the array of virtual devices is allocated along
with the OPP table, but that isn't going to work well from now onwards.
For single power domain case, a driver can either use the original
device structure for setting the performance state (if genpd attached
with dev_pm_domain_attach()) or use the virtual device structure (if
genpd attached with dev_pm_domain_attach_by_name(), which returns the
virtual device) and so we can't know in advance if we are going to need
genpd_virt_devs array or not.

Lets delay the allocation a bit and do it along with
dev_pm_opp_attach_genpd() rather. The deallocation is done from
dev_pm_opp_detach_genpd().

Tested-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c
drivers/opp/of.c