Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751883Ab3HTCEm (ORCPT ); Mon, 19 Aug 2013 22:04:42 -0400 Received: from mail-ee0-f50.google.com ([74.125.83.50]:55974 "EHLO mail-ee0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764Ab3HTCEe (ORCPT ); Mon, 19 Aug 2013 22:04:34 -0400 From: Sebastian Hesselbarth To: Sebastian Hesselbarth Cc: Mike Turquette , Russell King , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 01/17] clk: ensure __clk_of_table is only initialized once Date: Tue, 20 Aug 2013 04:04:15 +0200 Message-Id: <1376964271-22715-2-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1376964271-22715-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1376964271-22715-1-git-send-email-sebastian.hesselbarth@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1338 Lines: 43 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 --- Cc: Mike Turquette Cc: Russell King Cc: Arnd Bergmann 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/