Skip to contentSkip to conversation

ASoC: clk: probe defer when clock not yet ready

PATCH RESEND In review Jean-Francois Moine 2 participants 2 messages Nov 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ASoC: clk: probe defer when clock not yet ready

At probe time, a clock device may not be ready when some other device wants to use it.

This patch lets the functions clk_get/devm_clk_get return a probe defer when the clock is defined in the DT but not yet available.

It also fixes an erroneous call to clk_get_sys() when __clk_get() fails.

---
resend: - patch subject change from
[PATCH v3 1/2] ASoC: kirkwood: clk: probe defer when clock not yet ready
- base kernel 3.13.0-rc1
v2: fix __clk_get() failure (from Russell King)

---
 drivers/clk/clk.c    | 2 +-
 drivers/clk/clkdev.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/clk/clk.c +1 -1
index 2cf2ea6..41361c6 100644
@@ -2187,7 +2187,7 @@ EXPORT_SYMBOL_GPL(of_clk_del_provider);
 struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
 {
 	struct of_clk_provider *provider;
-	struct clk *clk = ERR_PTR(-ENOENT);
+	struct clk *clk = ERR_PTR(-EPROBE_DEFER);
 
 	/* Check if we have such a provider in our array */
 	mutex_lock(&of_clk_lock);
drivers/clk/clkdev.c +6 -1
index 442a313..1f402b9 100644
@@ -157,7 +157,12 @@ struct clk *clk_get(struct device *dev, const char *con_id)
 
 	if (dev) {
 		clk = of_clk_get_by_name(dev->of_node, con_id);
-		if (!IS_ERR(clk) && __clk_get(clk))
+		if (!IS_ERR(clk)) {
+			if (!__clk_get(clk))
+				clk = ERR_PTR(-ENOENT);
+			return clk;
+		}
+		if (PTR_ERR(clk) == -EPROBE_DEFER)
 			return clk;
 	}
 
Signature · 6 lines
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 2 lines · Jean-Francois Moine

At probe time, a clock device may not be ready when some other device wants to use it.

The patch subject starts of "ASoC:" but this is a patch for the clock
API only (it does then say clk:) - you probably want to fix that, it's
not going to help get it noticed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131125/8baff26a/attachment.sig>