diff options
author | Mike Turquette <mturquette@linaro.org> | 2012-03-26 19:15:52 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-04-24 19:37:38 -0400 |
commit | d4d7e3ddc76c5ae3b4fbd15cb6f30aa78c28d788 (patch) | |
tree | 419f45ad3531d0f1031096f55125c59fa6d065af /drivers/clk | |
parent | 7452b2191cd55fb3fd6ad65344466ddcdbe4676e (diff) |
clk: core: enforce clk_ops consistency
Documentation/clk.txt has some handsome ASCII art outlining which
clk_ops are mandatory for a given clock, given the capability of the
hardware. Enforce those mandates with sanity checks in __clk_init.
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index d83a9e09e1bf..9924aec17aad 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1202,6 +1202,20 @@ void __clk_init(struct device *dev, struct clk *clk) | |||
1202 | if (__clk_lookup(clk->name)) | 1202 | if (__clk_lookup(clk->name)) |
1203 | goto out; | 1203 | goto out; |
1204 | 1204 | ||
1205 | /* check that clk_ops are sane. See Documentation/clk.txt */ | ||
1206 | if (clk->ops->set_rate && | ||
1207 | !(clk->ops->round_rate && clk->ops->recalc_rate)) { | ||
1208 | pr_warning("%s: %s must implement .round_rate & .recalc_rate\n", | ||
1209 | __func__, clk->name); | ||
1210 | goto out; | ||
1211 | } | ||
1212 | |||
1213 | if (clk->ops->set_parent && !clk->ops->get_parent) { | ||
1214 | pr_warning("%s: %s must implement .get_parent & .set_parent\n", | ||
1215 | __func__, clk->name); | ||
1216 | goto out; | ||
1217 | } | ||
1218 | |||
1205 | /* throw a WARN if any entries in parent_names are NULL */ | 1219 | /* throw a WARN if any entries in parent_names are NULL */ |
1206 | for (i = 0; i < clk->num_parents; i++) | 1220 | for (i = 0; i < clk->num_parents; i++) |
1207 | WARN(!clk->parent_names[i], | 1221 | WARN(!clk->parent_names[i], |