diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2015-03-12 03:07:37 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-03-12 22:20:36 +0300 |
commit | 5cf065f556cb5926127b52563f494c2dd0a878e4 (patch) | |
tree | 8bd8b39baaa0df2e5c8ce3c66ef4c2433b6130e1 /drivers/clk/clk.c | |
parent | 306c342f9cb1f573af57a6afd1b3549aa97b9281 (diff) | |
parent | aaa6d06282a749d0df8e5e22e73f8a3372f96853 (diff) | |
download | linux-5cf065f556cb5926127b52563f494c2dd0a878e4.tar.xz |
Merge branch 'clk-fixes' into clk-next
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r-- | drivers/clk/clk.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 9872ec255f9a..fa5a00e5ee41 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1382,7 +1382,6 @@ static unsigned long clk_core_get_rate(struct clk_core *clk) return rate; } -EXPORT_SYMBOL_GPL(clk_core_get_rate); /** * clk_get_rate - return the rate of clk @@ -2217,6 +2216,32 @@ int clk_get_phase(struct clk *clk) } /** + * clk_is_match - check if two clk's point to the same hardware clock + * @p: clk compared against q + * @q: clk compared against p + * + * Returns true if the two struct clk pointers both point to the same hardware + * clock node. Put differently, returns true if struct clk *p and struct clk *q + * share the same struct clk_core object. + * + * Returns false otherwise. Note that two NULL clks are treated as matching. + */ +bool clk_is_match(const struct clk *p, const struct clk *q) +{ + /* trivial case: identical struct clk's or both NULL */ + if (p == q) + return true; + + /* true if clk->core pointers match. Avoid derefing garbage */ + if (!IS_ERR_OR_NULL(p) && !IS_ERR_OR_NULL(q)) + if (p->core == q->core) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(clk_is_match); + +/** * __clk_init - initialize the data structures in a struct clk * @dev: device initializing this clk, placeholder for now * @clk: clk being initialized |