[PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate()

Brian Masney posted 27 patches 1 month ago
[PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate()
Posted by Brian Masney 1 month ago
The divider_round_rate() function is now deprecated, so let's migrate
to divider_determine_rate() instead so that this deprecated API can be
removed. Additionally, owl_divider_helper_round_rate() is no longer used,
so let's drop that from the header file as well.

Note that when the main function itself was migrated to use
determine_rate, this was mistakenly converted to:

    req->rate = divider_round_rate(...)

This is invalid in the case when an error occurs since it can set the
rate to a negative value.

Fixes: 1b04e12a8bcc ("clk: actions: owl-divider: convert from round_rate() to determine_rate()")
Signed-off-by: Brian Masney <bmasney@redhat.com>

---
To: "Andreas Färber" <afaerber@suse.de>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-actions@lists.infradead.org
---
 drivers/clk/actions/owl-divider.c | 17 ++---------------
 drivers/clk/actions/owl-divider.h |  5 -----
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/clk/actions/owl-divider.c b/drivers/clk/actions/owl-divider.c
index 118f1393c6780f287d26736b2547a8b43751655a..316ace80e87e3b1c22a4011e725644cf37668e5e 100644
--- a/drivers/clk/actions/owl-divider.c
+++ b/drivers/clk/actions/owl-divider.c
@@ -13,26 +13,13 @@
 
 #include "owl-divider.h"
 
-long owl_divider_helper_round_rate(struct owl_clk_common *common,
-				const struct owl_divider_hw *div_hw,
-				unsigned long rate,
-				unsigned long *parent_rate)
-{
-	return divider_round_rate(&common->hw, rate, parent_rate,
-				  div_hw->table, div_hw->width,
-				  div_hw->div_flags);
-}
-
 static int owl_divider_determine_rate(struct clk_hw *hw,
 				      struct clk_rate_request *req)
 {
 	struct owl_divider *div = hw_to_owl_divider(hw);
 
-	req->rate = owl_divider_helper_round_rate(&div->common, &div->div_hw,
-						  req->rate,
-						  &req->best_parent_rate);
-
-	return 0;
+	return divider_determine_rate(hw, req, div->div_hw.table,
+				      div->div_hw.width, div->div_hw.div_flags);
 }
 
 unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
diff --git a/drivers/clk/actions/owl-divider.h b/drivers/clk/actions/owl-divider.h
index d76f58782c52885a66c96e8bf13b0dea3ba51efd..1d3bb4e5898a3ccf729894533ae194ac4c34b6e3 100644
--- a/drivers/clk/actions/owl-divider.h
+++ b/drivers/clk/actions/owl-divider.h
@@ -56,11 +56,6 @@ static inline struct owl_divider *hw_to_owl_divider(struct clk_hw *hw)
 	return container_of(common, struct owl_divider, common);
 }
 
-long owl_divider_helper_round_rate(struct owl_clk_common *common,
-				const struct owl_divider_hw *div_hw,
-				unsigned long rate,
-				unsigned long *parent_rate);
-
 unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
 					 const struct owl_divider_hw *div_hw,
 					 unsigned long parent_rate);

-- 
2.52.0

Re: [PATCH 05/27] clk: actions: owl-divider: convert from divider_round_rate() to divider_determine_rate()
Posted by Manivannan Sadhasivam 3 weeks, 3 days ago
On Thu, Jan 08, 2026 at 04:16:23PM -0500, Brian Masney wrote:
> The divider_round_rate() function is now deprecated, so let's migrate
> to divider_determine_rate() instead so that this deprecated API can be
> removed. Additionally, owl_divider_helper_round_rate() is no longer used,
> so let's drop that from the header file as well.
> 
> Note that when the main function itself was migrated to use
> determine_rate, this was mistakenly converted to:
> 
>     req->rate = divider_round_rate(...)
> 
> This is invalid in the case when an error occurs since it can set the
> rate to a negative value.
> 
> Fixes: 1b04e12a8bcc ("clk: actions: owl-divider: convert from round_rate() to determine_rate()")
> Signed-off-by: Brian Masney <bmasney@redhat.com>

Acked-by: Manivannan Sadhasivam <mani@kernel.org>

- Mani

> 
> ---
> To: "Andreas Färber" <afaerber@suse.de>
> To: Manivannan Sadhasivam <mani@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-actions@lists.infradead.org
> ---
>  drivers/clk/actions/owl-divider.c | 17 ++---------------
>  drivers/clk/actions/owl-divider.h |  5 -----
>  2 files changed, 2 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/clk/actions/owl-divider.c b/drivers/clk/actions/owl-divider.c
> index 118f1393c6780f287d26736b2547a8b43751655a..316ace80e87e3b1c22a4011e725644cf37668e5e 100644
> --- a/drivers/clk/actions/owl-divider.c
> +++ b/drivers/clk/actions/owl-divider.c
> @@ -13,26 +13,13 @@
>  
>  #include "owl-divider.h"
>  
> -long owl_divider_helper_round_rate(struct owl_clk_common *common,
> -				const struct owl_divider_hw *div_hw,
> -				unsigned long rate,
> -				unsigned long *parent_rate)
> -{
> -	return divider_round_rate(&common->hw, rate, parent_rate,
> -				  div_hw->table, div_hw->width,
> -				  div_hw->div_flags);
> -}
> -
>  static int owl_divider_determine_rate(struct clk_hw *hw,
>  				      struct clk_rate_request *req)
>  {
>  	struct owl_divider *div = hw_to_owl_divider(hw);
>  
> -	req->rate = owl_divider_helper_round_rate(&div->common, &div->div_hw,
> -						  req->rate,
> -						  &req->best_parent_rate);
> -
> -	return 0;
> +	return divider_determine_rate(hw, req, div->div_hw.table,
> +				      div->div_hw.width, div->div_hw.div_flags);
>  }
>  
>  unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
> diff --git a/drivers/clk/actions/owl-divider.h b/drivers/clk/actions/owl-divider.h
> index d76f58782c52885a66c96e8bf13b0dea3ba51efd..1d3bb4e5898a3ccf729894533ae194ac4c34b6e3 100644
> --- a/drivers/clk/actions/owl-divider.h
> +++ b/drivers/clk/actions/owl-divider.h
> @@ -56,11 +56,6 @@ static inline struct owl_divider *hw_to_owl_divider(struct clk_hw *hw)
>  	return container_of(common, struct owl_divider, common);
>  }
>  
> -long owl_divider_helper_round_rate(struct owl_clk_common *common,
> -				const struct owl_divider_hw *div_hw,
> -				unsigned long rate,
> -				unsigned long *parent_rate);
> -
>  unsigned long owl_divider_helper_recalc_rate(struct owl_clk_common *common,
>  					 const struct owl_divider_hw *div_hw,
>  					 unsigned long parent_rate);
> 
> -- 
> 2.52.0
> 

-- 
மணிவண்ணன் சதாசிவம்