devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] ASoC: clk: probe defer when clock not yet ready
@ 2013-11-25  8:38 Jean-Francois Moine
  2013-11-25 17:11 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Francois Moine @ 2013-11-25  8:38 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Grant Likely,
	Rob Herring, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Mike Turquette,
	Russell King

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.

Signed-off-by: Jean-Francois Moine <moinejf-GANU6spQydw@public.gmane.org>
---
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(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2cf2ea6..41361c6 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -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);
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 442a313..1f402b9 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -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;
 	}
 
-- 
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH RESEND] ASoC: clk: probe defer when clock not yet ready
  2013-11-25  8:38 [PATCH RESEND] ASoC: clk: probe defer when clock not yet ready Jean-Francois Moine
@ 2013-11-25 17:11 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-11-25 17:11 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: devicetree, alsa-devel, Mike Turquette, Takashi Iwai,
	Liam Girdwood, Rob Herring, Grant Likely, Russell King,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 344 bytes --]

On Mon, Nov 25, 2013 at 09:38:49AM +0100, Jean-Francois Moine wrote:
> 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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2013-11-25 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25  8:38 [PATCH RESEND] ASoC: clk: probe defer when clock not yet ready Jean-Francois Moine
2013-11-25 17:11 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).