LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v1] opp: Drop empty-table checks from _put functions
@ 2021-08-15 16:43 Dmitry Osipenko
  2021-08-16  4:17 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Osipenko @ 2021-08-15 16:43 UTC (permalink / raw)
  To: Viresh Kumar, Stephen Boyd, Nishanth Menon; +Cc: linux-kernel, linux-pm

The current_opp is released only when whole OPP table is released,
otherwise it's only marked as removed by dev_pm_opp_remove_table().
Functions like dev_pm_opp_put_clkname() and dev_pm_opp_put_supported_hw()
are checking whether OPP table is empty and it's not if current_opp is
set since it holds the refcount of OPP, this produces a noisy warning
from these functions about busy OPP table. Remove the checks to fix it.

Cc: stable@vger.kernel.org
Fixes: 81c4d8a3c414 ("opp: Keep track of currently programmed OPP")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/opp/core.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index b335c077f215..5543c54dacc5 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1856,9 +1856,6 @@ void dev_pm_opp_put_supported_hw(struct opp_table *opp_table)
 	if (unlikely(!opp_table))
 		return;
 
-	/* Make sure there are no concurrent readers while updating opp_table */
-	WARN_ON(!list_empty(&opp_table->opp_list));
-
 	kfree(opp_table->supported_hw);
 	opp_table->supported_hw = NULL;
 	opp_table->supported_hw_count = 0;
@@ -1944,9 +1941,6 @@ void dev_pm_opp_put_prop_name(struct opp_table *opp_table)
 	if (unlikely(!opp_table))
 		return;
 
-	/* Make sure there are no concurrent readers while updating opp_table */
-	WARN_ON(!list_empty(&opp_table->opp_list));
-
 	kfree(opp_table->prop_name);
 	opp_table->prop_name = NULL;
 
@@ -2056,9 +2050,6 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table)
 	if (!opp_table->regulators)
 		goto put_opp_table;
 
-	/* Make sure there are no concurrent readers while updating opp_table */
-	WARN_ON(!list_empty(&opp_table->opp_list));
-
 	if (opp_table->enabled) {
 		for (i = opp_table->regulator_count - 1; i >= 0; i--)
 			regulator_disable(opp_table->regulators[i]);
@@ -2178,9 +2169,6 @@ void dev_pm_opp_put_clkname(struct opp_table *opp_table)
 	if (unlikely(!opp_table))
 		return;
 
-	/* Make sure there are no concurrent readers while updating opp_table */
-	WARN_ON(!list_empty(&opp_table->opp_list));
-
 	clk_put(opp_table->clk);
 	opp_table->clk = ERR_PTR(-EINVAL);
 
@@ -2279,9 +2267,6 @@ void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table)
 	if (unlikely(!opp_table))
 		return;
 
-	/* Make sure there are no concurrent readers while updating opp_table */
-	WARN_ON(!list_empty(&opp_table->opp_list));
-
 	opp_table->set_opp = NULL;
 
 	mutex_lock(&opp_table->lock);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] opp: Drop empty-table checks from _put functions
  2021-08-15 16:43 [PATCH v1] opp: Drop empty-table checks from _put functions Dmitry Osipenko
@ 2021-08-16  4:17 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2021-08-16  4:17 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Viresh Kumar, Stephen Boyd, Nishanth Menon, linux-kernel, linux-pm

On 15-08-21, 19:43, Dmitry Osipenko wrote:
> The current_opp is released only when whole OPP table is released,
> otherwise it's only marked as removed by dev_pm_opp_remove_table().
> Functions like dev_pm_opp_put_clkname() and dev_pm_opp_put_supported_hw()
> are checking whether OPP table is empty and it's not if current_opp is
> set since it holds the refcount of OPP, this produces a noisy warning
> from these functions about busy OPP table. Remove the checks to fix it.
> 
> Cc: stable@vger.kernel.org
> Fixes: 81c4d8a3c414 ("opp: Keep track of currently programmed OPP")
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/opp/core.c | 15 ---------------
>  1 file changed, 15 deletions(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index b335c077f215..5543c54dacc5 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1856,9 +1856,6 @@ void dev_pm_opp_put_supported_hw(struct opp_table *opp_table)
>  	if (unlikely(!opp_table))
>  		return;
>  
> -	/* Make sure there are no concurrent readers while updating opp_table */
> -	WARN_ON(!list_empty(&opp_table->opp_list));
> -
>  	kfree(opp_table->supported_hw);
>  	opp_table->supported_hw = NULL;
>  	opp_table->supported_hw_count = 0;
> @@ -1944,9 +1941,6 @@ void dev_pm_opp_put_prop_name(struct opp_table *opp_table)
>  	if (unlikely(!opp_table))
>  		return;
>  
> -	/* Make sure there are no concurrent readers while updating opp_table */
> -	WARN_ON(!list_empty(&opp_table->opp_list));
> -
>  	kfree(opp_table->prop_name);
>  	opp_table->prop_name = NULL;
>  
> @@ -2056,9 +2050,6 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table)
>  	if (!opp_table->regulators)
>  		goto put_opp_table;
>  
> -	/* Make sure there are no concurrent readers while updating opp_table */
> -	WARN_ON(!list_empty(&opp_table->opp_list));
> -
>  	if (opp_table->enabled) {
>  		for (i = opp_table->regulator_count - 1; i >= 0; i--)
>  			regulator_disable(opp_table->regulators[i]);
> @@ -2178,9 +2169,6 @@ void dev_pm_opp_put_clkname(struct opp_table *opp_table)
>  	if (unlikely(!opp_table))
>  		return;
>  
> -	/* Make sure there are no concurrent readers while updating opp_table */
> -	WARN_ON(!list_empty(&opp_table->opp_list));
> -
>  	clk_put(opp_table->clk);
>  	opp_table->clk = ERR_PTR(-EINVAL);
>  
> @@ -2279,9 +2267,6 @@ void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table)
>  	if (unlikely(!opp_table))
>  		return;
>  
> -	/* Make sure there are no concurrent readers while updating opp_table */
> -	WARN_ON(!list_empty(&opp_table->opp_list));
> -
>  	opp_table->set_opp = NULL;
>  
>  	mutex_lock(&opp_table->lock);

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-16  4:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-15 16:43 [PATCH v1] opp: Drop empty-table checks from _put functions Dmitry Osipenko
2021-08-16  4:17 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).