[PATCH] clk: imx: composite-93: return timeout from gate enable

Linkai Gong posted 1 patch 1 month, 1 week ago
drivers/clk/imx/clk-composite-93.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
[PATCH] clk: imx: composite-93: return timeout from gate enable
Posted by Linkai Gong 1 month, 1 week ago
imx93_clk_composite_gate_enable() always returns 0, even when
imx93_clk_composite_wait_ready() times out.

Fixes: 4a3de5aa7743 ("clk: imx: clk-composite-93: check slice busy")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
 drivers/clk/imx/clk-composite-93.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/imx/clk-composite-93.c b/drivers/clk/imx/clk-composite-93.c
index ef20ceb2d255..953f67d13978 100644
--- a/drivers/clk/imx/clk-composite-93.c
+++ b/drivers/clk/imx/clk-composite-93.c
@@ -43,11 +43,12 @@ static int imx93_clk_composite_wait_ready(struct clk_hw *hw, void __iomem *reg)
 	return ret;
 }
 
-static void imx93_clk_composite_gate_endisable(struct clk_hw *hw, int enable)
+static int imx93_clk_composite_gate_endisable(struct clk_hw *hw, int enable)
 {
 	struct clk_gate *gate = to_clk_gate(hw);
 	unsigned long flags;
 	u32 reg;
+	int ret;
 
 	if (gate->lock)
 		spin_lock_irqsave(gate->lock, flags);
@@ -61,17 +62,17 @@ static void imx93_clk_composite_gate_endisable(struct clk_hw *hw, int enable)
 
 	writel(reg, gate->reg);
 
-	imx93_clk_composite_wait_ready(hw, gate->reg);
+	ret = imx93_clk_composite_wait_ready(hw, gate->reg);
 
 	if (gate->lock)
 		spin_unlock_irqrestore(gate->lock, flags);
+
+	return ret;
 }
 
 static int imx93_clk_composite_gate_enable(struct clk_hw *hw)
 {
-	imx93_clk_composite_gate_endisable(hw, 1);
-
-	return 0;
+	return imx93_clk_composite_gate_endisable(hw, 1);
 }
 
 static void imx93_clk_composite_gate_disable(struct clk_hw *hw)
-- 
2.25.1
Re: [PATCH] clk: imx: composite-93: return timeout from gate enable
Posted by Frank Li 2 weeks, 3 days ago
On Fri, Aug 21, 2026 at 04:56:16PM +0800, Linkai Gong wrote:
> [You don't often get email from gonglinkai@kylinos.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> imx93_clk_composite_gate_enable() always returns 0, even when
> imx93_clk_composite_wait_ready() times out.
>
> Fixes: 4a3de5aa7743 ("clk: imx: clk-composite-93: check slice busy")
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/clk/imx/clk-composite-93.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-composite-93.c b/drivers/clk/imx/clk-composite-93.c
> index ef20ceb2d255..953f67d13978 100644
> --- a/drivers/clk/imx/clk-composite-93.c
> +++ b/drivers/clk/imx/clk-composite-93.c
> @@ -43,11 +43,12 @@ static int imx93_clk_composite_wait_ready(struct clk_hw *hw, void __iomem *reg)
>         return ret;
>  }
>
> -static void imx93_clk_composite_gate_endisable(struct clk_hw *hw, int enable)
> +static int imx93_clk_composite_gate_endisable(struct clk_hw *hw, int enable)
>  {
>         struct clk_gate *gate = to_clk_gate(hw);
>         unsigned long flags;
>         u32 reg;
> +       int ret;
>
>         if (gate->lock)
>                 spin_lock_irqsave(gate->lock, flags);
> @@ -61,17 +62,17 @@ static void imx93_clk_composite_gate_endisable(struct clk_hw *hw, int enable)
>
>         writel(reg, gate->reg);
>
> -       imx93_clk_composite_wait_ready(hw, gate->reg);
> +       ret = imx93_clk_composite_wait_ready(hw, gate->reg);
>
>         if (gate->lock)
>                 spin_unlock_irqrestore(gate->lock, flags);
> +
> +       return ret;
>  }
>
>  static int imx93_clk_composite_gate_enable(struct clk_hw *hw)
>  {
> -       imx93_clk_composite_gate_endisable(hw, 1);
> -
> -       return 0;
> +       return imx93_clk_composite_gate_endisable(hw, 1);
>  }
>
>  static void imx93_clk_composite_gate_disable(struct clk_hw *hw)
> --
> 2.25.1
>
>
Re: [PATCH] clk: imx: composite-93: return timeout from gate enable
Posted by Peng Fan 3 weeks, 5 days ago
On Fri, Aug 21, 2026 at 04:56:16PM +0800, Linkai Gong wrote:
>imx93_clk_composite_gate_enable() always returns 0, even when
>imx93_clk_composite_wait_ready() times out.

Do you meet any issues or just code inspection?

Thanks,
Peng
Re: [PATCH] clk: imx: composite-93: return timeout from gate enable
Posted by Abel Vesa 1 month, 1 week ago
On 26-08-21 16:56:16, Linkai Gong wrote:
> imx93_clk_composite_gate_enable() always returns 0, even when
> imx93_clk_composite_wait_ready() times out.
> 

Ok, so you are describing what it does, not why you are doing it.

Please make the commit message a bit more clear about why this change is
needed.