Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 44eef489 authored by Viresh Kumar's avatar Viresh Kumar Committed by Taniya Das
Browse files

cpufreq: scpi/scmi: Fix freeing of dynamic OPPs



Since the commit 2a4eb7358aba "OPP: Don't remove dynamic OPPs from
_dev_pm_opp_remove_table()", dynamically created OPP aren't
automatically removed anymore by dev_pm_opp_cpumask_remove_table(). This
affects the scpi and scmi cpufreq drivers which no longer free OPPs on
failures or on invocations of the policy->exit() callback.

Create a generic OPP helper dev_pm_opp_remove_all_dynamic() which can be
called from these drivers instead of dev_pm_opp_cpumask_remove_table().

In dev_pm_opp_remove_all_dynamic(), we need to make sure that the
opp_list isn't getting accessed simultaneously from other parts of the
OPP core while the helper is freeing dynamic OPPs, i.e. we can't drop
the opp_table->lock while traversing through the OPP list. And to
accomplish that, this patch also creates _opp_kref_release_unlocked()
which can be called from this new helper with the opp_table lock already
held.

Change-Id: Ib4c70662cfc56575ba6f978627fe8c6658a5d8bc
Cc: 4.20 <stable@vger.kernel.org> # v4.20
Reported-by: default avatarValentin Schneider <valentin.schneider@arm.com>
Fixes: 2a4eb7358aba "OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table()"
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Tested-by: default avatarValentin Schneider <valentin.schneider@arm.com>
Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Git-commit: 1690d8bb91e370ab772062b79bd434ce815c4729
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent 54f3590a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment