From: heiko@sntech.de (Heiko Stuebner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/2] clk: prevent orphan clocks from being used
Date: Wed, 22 Apr 2015 22:53:06 +0200 [thread overview]
Message-ID: <1429735986-18592-3-git-send-email-heiko@sntech.de> (raw)
In-Reply-To: <1429735986-18592-1-git-send-email-heiko@sntech.de>
Orphan clocks or children of orphan clocks don't have rate information at
all and can produce strange results if they're allowed to be used and the
parent becomes available later on.
So using the newly introduced orphan status bit defer
__of_clk_get_from_provider calls for orphan clocks.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Alex Elder <elder@linaro.org>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: kernel at pengutronix.de
Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Chao Xie <chao.xie@marvell.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Georgi Djakov <georgi.djakov@linaro.org>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Barry Song <baohua@kernel.org>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Gabriel FERNANDEZ <gabriel.fernandez@st.com>
Cc: emilio at elopez.com.ar
Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Michal Simek <michal.simek@xilinx.com>
---
drivers/clk/clk.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 341904f..27d2d4b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2226,6 +2226,14 @@ bool clk_is_match(const struct clk *p, const struct clk *q)
}
EXPORT_SYMBOL_GPL(clk_is_match);
+static bool clk_is_orphan(const struct clk *clk)
+{
+ if (!clk)
+ return false;
+
+ return clk->core->orphan;
+}
+
/**
* __clk_init - initialize the data structures in a struct clk
* @dev: device initializing this clk, placeholder for now
@@ -2968,6 +2976,11 @@ struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,
if (provider->node == clkspec->np)
clk = provider->get(clkspec, provider->data);
if (!IS_ERR(clk)) {
+ if (clk_is_orphan(clk)) {
+ clk = ERR_PTR(-EPROBE_DEFER);
+ break;
+ }
+
clk = __clk_create_clk(__clk_get_hw(clk), dev_id,
con_id);
--
2.1.4
next prev parent reply other threads:[~2015-04-22 20:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 20:53 [PATCH v3 0/2] clk: improve handling of orphan clocks Heiko Stuebner
2015-04-22 20:53 ` [PATCH v3 1/2] clk: track the orphan status of clocks and their children Heiko Stuebner
2015-04-30 23:20 ` Stephen Boyd
2015-04-22 20:53 ` Heiko Stuebner [this message]
2015-04-30 23:20 ` [PATCH v3 2/2] clk: prevent orphan clocks from being used Stephen Boyd
2015-04-25 12:23 ` [PATCH v3 0/2] clk: improve handling of orphan clocks Stefan Wahren
2015-04-25 13:44 ` Heiko Stübner
2015-04-26 19:58 ` Robert Jarzmik
2015-05-01 0:19 ` Stephen Boyd
2015-05-01 19:59 ` Heiko Stübner
2015-05-01 20:52 ` Stephen Boyd
2015-05-01 22:07 ` Heiko Stübner
2015-05-01 23:40 ` Stephen Boyd
2015-05-07 8:22 ` Tero Kristo
2015-05-07 18:18 ` Stephen Boyd
2015-05-08 11:41 ` Tero Kristo
2015-05-07 15:17 ` Kevin Hilman
2015-05-07 21:03 ` Stephen Boyd
2015-05-08 0:27 ` Kevin Hilman
2015-05-08 6:53 ` Stephen Boyd
2015-05-08 8:13 ` Sascha Hauer
2015-05-08 9:30 ` Heiko Stübner
2015-05-08 9:53 ` Sascha Hauer
2015-05-08 10:02 ` Maxime Ripard
2015-05-12 22:35 ` Stephen Boyd
2015-05-13 13:03 ` Maxime Ripard
2015-05-13 14:33 ` Kevin Hilman
2015-05-13 20:14 ` Maxime Ripard
2015-05-13 20:44 ` Kevin Hilman
2015-05-13 20:51 ` Maxime Ripard
2015-07-27 8:57 ` Heiko Stübner
2015-07-30 10:09 ` Maxime Ripard
2015-08-11 22:34 ` Stephen Boyd
2015-08-12 8:26 ` Heiko Stübner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429735986-18592-3-git-send-email-heiko@sntech.de \
--to=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).