mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] clk: clk-gpio: Use clk_register instead of bclk_register
@ 2025-07-18 13:37 Jonas Rebmann
  2025-07-18 17:07 ` Ahmad Fatoum
  2025-08-05  8:33 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Jonas Rebmann @ 2025-07-18 13:37 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Alexander Shiyan, Jonas Rebmann

GPIO-gated clocks wrongfully used barebox clock interface which leads to
bugs due to clk not being initialized from init->ops.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 drivers/clk/clk-gpio.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
index dc61c88b9f..3f9760c921 100644
--- a/drivers/clk/clk-gpio.c
+++ b/drivers/clk/clk-gpio.c
@@ -96,7 +96,6 @@ static struct clk_hw *clk_register_gpio(struct device *dev, u8 num_parents,
 	struct clk_hw *hw;
 	struct clk_init_data init = {};
 	const char *parent_names[2];
-	int err;
 
 	clk_gpio = xzalloc(sizeof(*clk_gpio));
 	if (!clk_gpio)
@@ -116,11 +115,7 @@ static struct clk_hw *clk_register_gpio(struct device *dev, u8 num_parents,
 	clk_gpio->hw.init = &init;
 
 	hw = &clk_gpio->hw;
-	err =  bclk_register(&clk_gpio->hw.clk);
-	if (err)
-		return ERR_PTR(err);
-
-	return hw;
+	return clk_to_clk_hw(clk_register(dev, hw));
 }
 
 static struct clk_hw *clk_hw_register_gpio_gate(struct device *dev,

---
base-commit: 89bf1fcc998fc5fea0ce613d9930dd9ee39c0fb2
change-id: 20250717-clk_register-3ff98f73451e

Best regards,
--  
Jonas Rebmann <jre@pengutronix.de>




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

* Re: [PATCH] clk: clk-gpio: Use clk_register instead of bclk_register
  2025-07-18 13:37 [PATCH] clk: clk-gpio: Use clk_register instead of bclk_register Jonas Rebmann
@ 2025-07-18 17:07 ` Ahmad Fatoum
  2025-08-05  8:33 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-07-18 17:07 UTC (permalink / raw)
  To: Jonas Rebmann, Sascha Hauer, BAREBOX; +Cc: Alexander Shiyan

On 18.07.25 15:37, Jonas Rebmann wrote:
> GPIO-gated clocks wrongfully used barebox clock interface which leads to
> bugs due to clk not being initialized from init->ops.
> 

Fixes: b1fb0aac1ed5 ("gpio: clk-gpio: Updating the driver from the kernel repository")

> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  drivers/clk/clk-gpio.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
> index dc61c88b9f..3f9760c921 100644
> --- a/drivers/clk/clk-gpio.c
> +++ b/drivers/clk/clk-gpio.c
> @@ -96,7 +96,6 @@ static struct clk_hw *clk_register_gpio(struct device *dev, u8 num_parents,
>  	struct clk_hw *hw;
>  	struct clk_init_data init = {};
>  	const char *parent_names[2];
> -	int err;
>  
>  	clk_gpio = xzalloc(sizeof(*clk_gpio));
>  	if (!clk_gpio)
> @@ -116,11 +115,7 @@ static struct clk_hw *clk_register_gpio(struct device *dev, u8 num_parents,
>  	clk_gpio->hw.init = &init;
>  
>  	hw = &clk_gpio->hw;
> -	err =  bclk_register(&clk_gpio->hw.clk);
> -	if (err)
> -		return ERR_PTR(err);
> -
> -	return hw;
> +	return clk_to_clk_hw(clk_register(dev, hw));
>  }
>  
>  static struct clk_hw *clk_hw_register_gpio_gate(struct device *dev,
> 
> ---
> base-commit: 89bf1fcc998fc5fea0ce613d9930dd9ee39c0fb2
> change-id: 20250717-clk_register-3ff98f73451e
> 
> Best regards,
> --  
> Jonas Rebmann <jre@pengutronix.de>
> 
> 
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

* Re: [PATCH] clk: clk-gpio: Use clk_register instead of bclk_register
  2025-07-18 13:37 [PATCH] clk: clk-gpio: Use clk_register instead of bclk_register Jonas Rebmann
  2025-07-18 17:07 ` Ahmad Fatoum
@ 2025-08-05  8:33 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-08-05  8:33 UTC (permalink / raw)
  To: BAREBOX, Jonas Rebmann; +Cc: Alexander Shiyan


On Fri, 18 Jul 2025 15:37:18 +0200, Jonas Rebmann wrote:
> GPIO-gated clocks wrongfully used barebox clock interface which leads to
> bugs due to clk not being initialized from init->ops.
> 
> 

Applied, thanks!

[1/1] clk: clk-gpio: Use clk_register instead of bclk_register
      https://git.pengutronix.de/cgit/barebox/commit/?id=6ee81f9cee04 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2025-08-05  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-18 13:37 [PATCH] clk: clk-gpio: Use clk_register instead of bclk_register Jonas Rebmann
2025-07-18 17:07 ` Ahmad Fatoum
2025-08-05  8:33 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox