[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1334192572-12499-5-git-send-email-mturquette@linaro.org>
Date: Wed, 11 Apr 2012 18:02:42 -0700
From: Mike Turquette <mturquette@...aro.org>
To: <arnd.bergmann@...aro.org>
CC: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linaro-dev@...ts.linaro.org>, <patches@...aro.org>,
Mike Turquette <mturquette@...aro.org>,
Olof Johansson <olof@...om.net>,
Russell King <linux@....linux.org.uk>,
Sascha Hauer <s.hauer@...gutronix.de>,
Shawn Guo <shawn.guo@...escale.com>,
Richard Zhao <richard.zhao@...aro.org>,
Saravana Kannan <skannan@...eaurora.org>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Andrew Lunn <andrew@...n.ch>, Rajendra Nayak <rnayak@...com>,
Viresh Kumar <viresh.kumar@...com>
Subject: [PATCH 04/13] 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@...aro.org>
Cc: Arnd Bergman <arnd.bergmann@...aro.org>
Cc: Olof Johansson <olof@...om.net>
Cc: Russell King <linux@....linux.org.uk>
Cc: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Shawn Guo <shawn.guo@...escale.com>
Cc: Richard Zhao <richard.zhao@...aro.org>
Cc: Saravana Kannan <skannan@...eaurora.org>
Cc: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Rajendra Nayak <rnayak@...com>
Cc: Viresh Kumar <viresh.kumar@...com>
---
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 d83a9e0..9924aec 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1202,6 +1202,20 @@ void __clk_init(struct device *dev, struct clk *clk)
if (__clk_lookup(clk->name))
goto out;
+ /* check that clk_ops are sane. See Documentation/clk.txt */
+ if (clk->ops->set_rate &&
+ !(clk->ops->round_rate && clk->ops->recalc_rate)) {
+ pr_warning("%s: %s must implement .round_rate & .recalc_rate\n",
+ __func__, clk->name);
+ goto out;
+ }
+
+ if (clk->ops->set_parent && !clk->ops->get_parent) {
+ pr_warning("%s: %s must implement .get_parent & .set_parent\n",
+ __func__, clk->name);
+ goto out;
+ }
+
/* throw a WARN if any entries in parent_names are NULL */
for (i = 0; i < clk->num_parents; i++)
WARN(!clk->parent_names[i],
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists