Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753644Ab3HVFxb (ORCPT ); Thu, 22 Aug 2013 01:53:31 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:43164 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753556Ab3HVFx0 (ORCPT ); Thu, 22 Aug 2013 01:53:26 -0400 From: Mike Turquette To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Matt Sealey , Stephen Boyd , Haojian Zhuang , Tero Kristo , =?UTF-8?q?Heiko=20St=C3=BCbner?= , devicetree@vger.kernel.org, Mike Turquette Subject: [PATCH v4 2/5] clk: of: helper for determining number of parent clocks Date: Wed, 21 Aug 2013 22:53:10 -0700 Message-Id: <1377150793-27864-3-git-send-email-mturquette@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1377150793-27864-1-git-send-email-mturquette@linaro.org> References: <1377150793-27864-1-git-send-email-mturquette@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1731 Lines: 50 Walks the "clocks" array of parent clock phandles and returns the number. Signed-off-by: Mike Turquette Tested-by: Heiko Stuebner Reviewed-by: Heiko Stuebner --- No change since v3 drivers/clk/clk.c | 6 ++++++ include/linux/clk-provider.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index bc02037..2655882 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2189,6 +2189,12 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) return clk; } +int of_clk_get_parent_count(struct device_node *np) +{ + return of_count_phandle_with_args(np, "clocks", "#clock-cells"); +} +EXPORT_SYMBOL_GPL(of_clk_get_parent_count); + const char *of_clk_get_parent_name(struct device_node *np, int index) { struct of_phandle_args clkspec; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 015f18c..5497739 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -471,6 +471,7 @@ void of_clk_del_provider(struct device_node *np); struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, void *data); struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); +int of_clk_get_parent_count(struct device_node *np); const char *of_clk_get_parent_name(struct device_node *np, int index); void of_clk_init(const struct of_device_id *matches); -- 1.8.1.2 -- 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/