From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 03/14] clk: composite: improve rate_hw sanity check logic
Date: Thu, 03 Jul 2014 01:58:14 +0200 [thread overview]
Message-ID: <2694753.hNjIfgCHO5@diego> (raw)
In-Reply-To: <156042792.J76K6jxIGl@diego>
From: Mike Turquette <mturquette@linaro.org>
The function pointer population and sanity checking logic got a bit ugly
with the advent of the .determine_rate callback. Clean it up.
Signed-off-by: Mike Turquette <mturquette@linaro.org>
---
drivers/clk/clk-composite.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index faf7c32..b9355da 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -226,21 +226,27 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
clk = ERR_PTR(-EINVAL);
goto err;
}
+ clk_composite_ops->recalc_rate = clk_composite_recalc_rate;
- /* .round_rate is a prerequisite for .set_rate */
- if (rate_ops->round_rate) {
- clk_composite_ops->round_rate = clk_composite_round_rate;
- if (rate_ops->set_rate) {
- clk_composite_ops->set_rate = clk_composite_set_rate;
- }
+ if (rate_ops->determine_rate)
+ clk_composite_ops->determine_rate =
+ clk_composite_determine_rate;
+ else if (rate_ops->round_rate)
+ clk_composite_ops->round_rate =
+ clk_composite_round_rate;
+
+ /* .set_rate requires either .round_rate or .determine_rate */
+ if (rate_ops->set_rate) {
+ if (rate_ops->determine_rate || rate_ops->round_rate)
+ clk_composite_ops->set_rate =
+ clk_composite_set_rate;
+ else
+ WARN(1, "%s: missing round_rate op is required\n",
+ __func__);
}
composite->rate_hw = rate_hw;
composite->rate_ops = rate_ops;
- clk_composite_ops->recalc_rate = clk_composite_recalc_rate;
- if (rate_ops->determine_rate ||
- (rate_ops->round_rate && clk_composite_ops->set_parent))
- clk_composite_ops->determine_rate = clk_composite_determine_rate;
}
if (gate_hw && gate_ops) {
--
1.9.0
next prev parent reply other threads:[~2014-07-02 23:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 23:53 [PATCH v5 00/14] Clock support for rk3066,rk3188 and rk3288 Heiko Stübner
2014-07-02 23:56 ` [PATCH v5 01/14] clk: composite: support determine_rate using rate_ops->round_rate + mux_ops->set_parent Heiko Stübner
2014-07-18 13:55 ` Gabriel Fernandez
2014-07-18 16:00 ` Heiko Stübner
2014-07-02 23:57 ` [PATCH v5 02/14] clk: composite: allow read-only clocks Heiko Stübner
2014-07-02 23:58 ` Heiko Stübner [this message]
2014-07-02 23:58 ` [PATCH v5 04/14] clk: rockchip: add basic infrastructure for clock branches Heiko Stübner
2014-07-02 23:59 ` [PATCH v5 05/14] clk: rockchip: add clock type for pll clocks and pll used on rk3066 Heiko Stübner
2014-07-02 23:59 ` [PATCH v5 06/14] clk: rockchip: add reset controller Heiko Stübner
2014-07-03 0:00 ` [PATCH v5 07/14] dt-bindings: add documentation for rk3188 clock and reset unit Heiko Stübner
2014-07-03 0:01 ` [PATCH v5 08/14] clk: rockchip: add clock driver for rk3188 and rk3066 clocks Heiko Stübner
2014-07-03 0:02 ` [PATCH v5 09/14] dt-bindings: add documentation for rk3288 cru Heiko Stübner
2014-07-03 0:02 ` [PATCH v5 10/14] clk: rockchip: add clock controller for rk3288 Heiko Stübner
2014-07-03 0:02 ` [PATCH v5 11/14] ARM: rockchip: Select ARCH_HAS_RESET_CONTROLLER Heiko Stübner
2014-07-03 0:03 ` [PATCH v5 12/14] ARM: dts: rockchip: add cru nodes and update device clocks to use it Heiko Stübner
2014-07-03 0:03 ` [PATCH v5 13/14] ARM: dts: rockchip: move oscillator input clock into main dtsi Heiko Stübner
2014-07-03 0:04 ` [PATCH v5 14/14] arm: dts: rockchip: remove obsolete clock gate definitions Heiko Stübner
2014-07-13 19:46 ` [PATCH v5 00/14] Clock support for rk3066,rk3188 and rk3288 Mike Turquette
2014-07-14 3:12 ` Olof Johansson
2014-07-14 8:07 ` Heiko Stübner
2014-07-22 15:45 ` Heiko Stübner
2014-07-24 2:44 ` Mike Turquette
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=2694753.hNjIfgCHO5@diego \
--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).