]> asedeno.scripts.mit.edu Git - linux.git/commit
PM / OPP: Fix shared OPP table support in dev_pm_opp_set_supported_hw()
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 22 May 2018 11:08:08 +0000 (16:38 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Tue, 22 May 2018 11:30:09 +0000 (17:00 +0530)
commit25419de1b8dda24f3e02478b12b724a9b0cc4e78
tree711d9dea1741493b2310780a42f0f4a4ef169598
parent6a89e012aaf4a978d4c896f3299cfc365e4a5eb8
PM / OPP: Fix shared OPP table support in dev_pm_opp_set_supported_hw()

It should be fine to call dev_pm_opp_set_supported_hw() for all possible
CPUs, even if some of them share the OPP table as the caller may not be
aware of sharing policy.

Lets increment the reference count of the OPP table and return its
pointer. The caller need to call dev_pm_opp_put_supported_hw() the same
number of times later on to drop all the references.

To avoid adding another counter to count how many times
dev_pm_opp_set_supported_hw() is called for the same OPP table,
dev_pm_opp_put_supported_hw() frees the resources on the very first call
made to it, assuming that the caller would be calling it sequentially
for all the CPUs. We can revisit that if that assumption is broken in
the future.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c