lkml.org 
[lkml]   [2013]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 01/17] clk: ensure __clk_of_table is only initialized once
Date
This patch ensures DT clock providers are only initialized once by
using a static bool that is set after first call to of_clk_init().

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/clk/clk.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 56a00db..0a8a750 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2117,9 +2117,15 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
void __init of_clk_init(const struct of_device_id *matches)
{
struct device_node *np;
+ static bool table_done;

- if (!matches)
+ if (!matches) {
+ /* init __clk_of_table drivers only once */
+ if (table_done)
+ return;
matches = __clk_of_table;
+ table_done = true;
+ }

for_each_matching_node(np, matches) {
const struct of_device_id *match = of_match_node(matches, np);
--
1.7.10.4


\
 
 \ /
  Last update: 2013-08-20 04:21    [W:0.386 / U:4.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site