diff mbox series

[05/27] clk: ti: clkctrl: add support for retrying failed init

Message ID 1509368685-29112-6-git-send-email-t-kristo@ti.com
State Superseded
Headers show
Series clk: ti: clkctrl fixes and support for additional SoCs | expand

Commit Message

Tero Kristo Oct. 30, 2017, 1:04 p.m. UTC
In case the clkctrl node contains assigned-clock-* entries, registering
the provider can fail with -EPROBE_DEFER. In this case, add the
provider to the retry_init clock list so it will be cleaned up later.

Signed-off-by: Tero Kristo <t-kristo@ti.com>

---
 drivers/clk/ti/clkctrl.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

-- 
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Stephen Boyd Nov. 3, 2017, 5:04 p.m. UTC | #1
On 10/30, Tero Kristo wrote:
> @@ -508,7 +515,11 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)

>  		reg_data++;

>  	}

>  

> -	of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);

> +	ret = of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);

> +	if (ret == -EPROBE_DEFER)

> +		ti_clk_retry_init(node, (void *)provider,


You need the cast? The type of ti_clk_retry_init's second
parameter should probably be a void pointer instead.

> +				  (ti_of_clk_init_cb_t)_clkctrl_add_provider);

> +

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tero Kristo Nov. 6, 2017, 7:42 a.m. UTC | #2
On 03/11/17 19:04, Stephen Boyd wrote:
> On 10/30, Tero Kristo wrote:

>> @@ -508,7 +515,11 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)

>>   		reg_data++;

>>   	}

>>   

>> -	of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);

>> +	ret = of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);

>> +	if (ret == -EPROBE_DEFER)

>> +		ti_clk_retry_init(node, (void *)provider,

> 

> You need the cast? The type of ti_clk_retry_init's second

> parameter should probably be a void pointer instead.


The compiler burps out a warning if there is no cast. I'll change the 
parameter type though, becomes slightly larger patch but that would be 
cleaner.

-Tero

> 

>> +				  (ti_of_clk_init_cb_t)_clkctrl_add_provider);

>> +


--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 91ddc92..0f78219 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -403,6 +403,12 @@  static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
 	}
 }
 
+static void __init _clkctrl_add_provider(void *data,
+					 struct device_node *np)
+{
+	of_clk_add_hw_provider(np, _ti_omap4_clkctrl_xlate, data);
+}
+
 static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
 {
 	struct omap_clkctrl_provider *provider;
@@ -414,6 +420,7 @@  static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
 	struct omap_clkctrl_clk *clkctrl_clk;
 	const __be32 *addrp;
 	u32 addr;
+	int ret;
 
 	addrp = of_get_address(node, 0, NULL, NULL);
 	addr = (u32)of_translate_address(node, addrp);
@@ -508,7 +515,11 @@  static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
 		reg_data++;
 	}
 
-	of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);
+	ret = of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);
+	if (ret == -EPROBE_DEFER)
+		ti_clk_retry_init(node, (void *)provider,
+				  (ti_of_clk_init_cb_t)_clkctrl_add_provider);
+
 	return;
 
 cleanup: