Re: [PATCH 2/2] opp: Manage empty OPP tables with clk handle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 7/3/2019 3:17 PM, Viresh Kumar wrote:
On 03-07-19, 14:41, Rajendra Nayak wrote:
[]..

Explain the rationale behind this code here in a comment.

+	if (!_get_opp_count(opp_table)) {
+		ret = _generic_set_opp_clk_only(dev, clk, freq);
+		goto put_opp_table;
+	}
+
   	temp_freq = old_freq;
   	old_opp = _find_freq_ceil(opp_table, &temp_freq);
   	if (IS_ERR(old_opp)) {

Also, rebase over the OPP branch please:

thanks, I will fix/rebase and repost,
in the meantime while I was testing this a little more I realized I also need
something like the change below to avoid a refcount mismatch WARN when empty OPP
table is removed using dev_pm_opp_of_remove_table()

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index fa7d4d6d37b3..20128a88baf2 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2118,7 +2118,8 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev)
                 return;
         }
-       _put_opp_list_kref(opp_table);
+       if (_get_opp_count(opp_table))
+               _put_opp_list_kref(opp_table);
         /* Drop reference taken by _find_opp_table() */
         dev_pm_opp_put_opp_table(opp_table);

Does this look like a good way to fix it?

No. If an OPP table only has dynamic OPPs, this will still generate
warning. Below is the fix I would suggest. Please test it, I haven't
tested it at all :)

thanks, yes, this seems to work.

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux