linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback
@ 2025-07-21 19:07 Akhilesh Patil
  2025-07-22  1:08 ` Haylen Chu
  2025-07-22 12:32 ` Alex Elder
  0 siblings, 2 replies; 4+ messages in thread
From: Akhilesh Patil @ 2025-07-21 19:07 UTC (permalink / raw)
  To: mturquette, sboyd, dlan, heylenay, elder, inochiama, akhilesh,
	robh, krzk+dt, conor+dt, heylenay, paul.walmsley, palmer, aou,
	alex
  Cc: linux-clk, linux-riscv, spacemit, linux-kernel, unicornxdotw,
	jszhang, zhangmeng.kevin, akhileshpatilvnit, skhan

Return 0 instead of -EINVAL if function ccu_pll_recalc_rate() fails to
get correct rate entry. Follow .recalc_rate callback documentation
as mentioned in include/linux/clk-provider.h for error return value.

Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
---
 drivers/clk/spacemit/ccu_pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/spacemit/ccu_pll.c b/drivers/clk/spacemit/ccu_pll.c
index 4427dcfbbb97..45f540073a65 100644
--- a/drivers/clk/spacemit/ccu_pll.c
+++ b/drivers/clk/spacemit/ccu_pll.c
@@ -122,7 +122,7 @@ static unsigned long ccu_pll_recalc_rate(struct clk_hw *hw,
 
 	WARN_ON_ONCE(!entry);
 
-	return entry ? entry->rate : -EINVAL;
+	return entry ? entry->rate : 0;
 }
 
 static long ccu_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-- 
2.34.1


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

* Re: [PATCH] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback
  2025-07-21 19:07 [PATCH] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback Akhilesh Patil
@ 2025-07-22  1:08 ` Haylen Chu
  2025-07-23  5:37   ` Akhilesh Patil
  2025-07-22 12:32 ` Alex Elder
  1 sibling, 1 reply; 4+ messages in thread
From: Haylen Chu @ 2025-07-22  1:08 UTC (permalink / raw)
  To: Akhilesh Patil, mturquette, sboyd, dlan, elder, inochiama, robh,
	krzk+dt, conor+dt, heylenay, paul.walmsley, palmer, aou, alex
  Cc: linux-clk, linux-riscv, spacemit, linux-kernel, unicornxdotw,
	jszhang, zhangmeng.kevin, akhileshpatilvnit, skhan

On Tue, Jul 22, 2025 at 12:37:10AM +0530, Akhilesh Patil wrote:
> Return 0 instead of -EINVAL if function ccu_pll_recalc_rate() fails to
> get correct rate entry. Follow .recalc_rate callback documentation
> as mentioned in include/linux/clk-provider.h for error return value.

Nice catch, thanks.

> Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>

Here misses a Fixes tag. With this added,

Reviewed-by: Haylen Chu <heylenay@4d2.org>

> ---
>  drivers/clk/spacemit/ccu_pll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/spacemit/ccu_pll.c b/drivers/clk/spacemit/ccu_pll.c
> index 4427dcfbbb97..45f540073a65 100644
> --- a/drivers/clk/spacemit/ccu_pll.c
> +++ b/drivers/clk/spacemit/ccu_pll.c
> @@ -122,7 +122,7 @@ static unsigned long ccu_pll_recalc_rate(struct clk_hw *hw,
>  
>  	WARN_ON_ONCE(!entry);
>  
> -	return entry ? entry->rate : -EINVAL;
> +	return entry ? entry->rate : 0;
>  }
>  
>  static long ccu_pll_round_rate(struct clk_hw *hw, unsigned long rate,
> -- 
> 2.34.1
> 

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

* Re: [PATCH] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback
  2025-07-21 19:07 [PATCH] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback Akhilesh Patil
  2025-07-22  1:08 ` Haylen Chu
@ 2025-07-22 12:32 ` Alex Elder
  1 sibling, 0 replies; 4+ messages in thread
From: Alex Elder @ 2025-07-22 12:32 UTC (permalink / raw)
  To: Akhilesh Patil, mturquette, sboyd, dlan, heylenay, inochiama,
	robh, krzk+dt, conor+dt, heylenay, paul.walmsley, palmer, aou,
	alex
  Cc: linux-clk, linux-riscv, spacemit, linux-kernel, unicornxdotw,
	jszhang, zhangmeng.kevin, akhileshpatilvnit, skhan

On 7/21/25 2:07 PM, Akhilesh Patil wrote:
> Return 0 instead of -EINVAL if function ccu_pll_recalc_rate() fails to
> get correct rate entry. Follow .recalc_rate callback documentation
> as mentioned in include/linux/clk-provider.h for error return value.

"If the driver cannot figure out a rate for this clock, it
must return 0."

Looks good.

Reviewed-by: Alex Elder <elder@riscstar.com>

> 
> Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
> ---
>   drivers/clk/spacemit/ccu_pll.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/spacemit/ccu_pll.c b/drivers/clk/spacemit/ccu_pll.c
> index 4427dcfbbb97..45f540073a65 100644
> --- a/drivers/clk/spacemit/ccu_pll.c
> +++ b/drivers/clk/spacemit/ccu_pll.c
> @@ -122,7 +122,7 @@ static unsigned long ccu_pll_recalc_rate(struct clk_hw *hw,
>   
>   	WARN_ON_ONCE(!entry);
>   
> -	return entry ? entry->rate : -EINVAL;
> +	return entry ? entry->rate : 0;
>   }
>   
>   static long ccu_pll_round_rate(struct clk_hw *hw, unsigned long rate,


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

* Re: [PATCH] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback
  2025-07-22  1:08 ` Haylen Chu
@ 2025-07-23  5:37   ` Akhilesh Patil
  0 siblings, 0 replies; 4+ messages in thread
From: Akhilesh Patil @ 2025-07-23  5:37 UTC (permalink / raw)
  To: Haylen Chu
  Cc: mturquette, sboyd, dlan, elder, inochiama, robh, krzk+dt,
	conor+dt, heylenay, paul.walmsley, palmer, aou, alex, linux-clk,
	linux-riscv, spacemit, linux-kernel, unicornxdotw, jszhang,
	zhangmeng.kevin, akhileshpatilvnit, skhan

On Tue, Jul 22, 2025 at 01:08:30AM +0000, Haylen Chu wrote:
> On Tue, Jul 22, 2025 at 12:37:10AM +0530, Akhilesh Patil wrote:
> > Return 0 instead of -EINVAL if function ccu_pll_recalc_rate() fails to
> > get correct rate entry. Follow .recalc_rate callback documentation
> > as mentioned in include/linux/clk-provider.h for error return value.
> 
> Nice catch, thanks.
> 
> > Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
> 
> Here misses a Fixes tag. With this added,
> 
> Reviewed-by: Haylen Chu <heylenay@4d2.org>
> 
Thanks Haylen and Alex for the review. Sent V2 patch with Fixes tag.

> > ---
> >  drivers/clk/spacemit/ccu_pll.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/clk/spacemit/ccu_pll.c b/drivers/clk/spacemit/ccu_pll.c
> > index 4427dcfbbb97..45f540073a65 100644
> > --- a/drivers/clk/spacemit/ccu_pll.c
> > +++ b/drivers/clk/spacemit/ccu_pll.c
> > @@ -122,7 +122,7 @@ static unsigned long ccu_pll_recalc_rate(struct clk_hw *hw,
> >  
> >  	WARN_ON_ONCE(!entry);
> >  
> > -	return entry ? entry->rate : -EINVAL;
> > +	return entry ? entry->rate : 0;
> >  }
> >  
> >  static long ccu_pll_round_rate(struct clk_hw *hw, unsigned long rate,
> > -- 
> > 2.34.1
> > 

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

end of thread, other threads:[~2025-07-23  5:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 19:07 [PATCH] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback Akhilesh Patil
2025-07-22  1:08 ` Haylen Chu
2025-07-23  5:37   ` Akhilesh Patil
2025-07-22 12:32 ` Alex Elder

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).