diff mbox series

[v9,2/7] clk: rockchip: handle missing clocks with -EPROBE_DEFER

Message ID 20240325193609.237182-3-sebastian.reichel@collabora.com (mailing list archive)
State New, archived
Headers show
Series rockchip: clk: add GATE_LINK support | expand

Commit Message

Sebastian Reichel March 25, 2024, 7:33 p.m. UTC
In the future some clocks will be registered using CLK_OF_DECLARE
and some are registered later from the driver probe routine. Any
clock handled by the probe routine should return -EPROBE_DEFER
until that routine has been called.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/clk/rockchip/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heiko Stuebner Aug. 31, 2024, 10:48 a.m. UTC | #1
Am Montag, 25. März 2024, 20:33:33 CEST schrieb Sebastian Reichel:
> In the future some clocks will be registered using CLK_OF_DECLARE
> and some are registered later from the driver probe routine. Any
> clock handled by the probe routine should return -EPROBE_DEFER
> until that routine has been called.

So this changes the behaviour for misconfigured systems/devicetrees.
Before a driver would get the ENOENT if they requested a clock from an
empty lookup field, but now they will just defer forever.

Can we do some rockchip_clk_finalize() that runs after _all_ clocks are
registered (in the CLK_OF_DECLARE function for most drivers, at the end
of probe for i.e. rk3588) that takes all lookup entries that are still
EPROBE_DEFER and set it to ENOENT again please?


Thanks
Heiko


> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  drivers/clk/rockchip/clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
> index 73d2cbdc716b..31b7cc243d82 100644
> --- a/drivers/clk/rockchip/clk.c
> +++ b/drivers/clk/rockchip/clk.c
> @@ -376,7 +376,7 @@ struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np,
>  		goto err_free;
>  
>  	for (i = 0; i < nr_clks; ++i)
> -		clk_table[i] = ERR_PTR(-ENOENT);
> +		clk_table[i] = ERR_PTR(-EPROBE_DEFER);
>  
>  	ctx->reg_base = base;
>  	ctx->clk_data.clks = clk_table;
>
diff mbox series

Patch

diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 73d2cbdc716b..31b7cc243d82 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -376,7 +376,7 @@  struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np,
 		goto err_free;
 
 	for (i = 0; i < nr_clks; ++i)
-		clk_table[i] = ERR_PTR(-ENOENT);
+		clk_table[i] = ERR_PTR(-EPROBE_DEFER);
 
 	ctx->reg_base = base;
 	ctx->clk_data.clks = clk_table;