From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Turquette Subject: [PATCH v3 2/5] clk: of: helper for determining number of parent clocks Date: Thu, 20 Jun 2013 23:14:13 -0700 Message-ID: <1371795256-16703-3-git-send-email-mturquette@linaro.org> References: <1371795256-16703-1-git-send-email-mturquette@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1371795256-16703-1-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Mike Turquette , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Stephen Boyd , Tero Kristo , Haojian Zhuang , Matt Sealey , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: devicetree@vger.kernel.org Walks the "clocks" array of parent clock phandles and returns the number. Signed-off-by: Mike Turquette --- No change since v2 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 edf3fe1..a9feab6 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2081,6 +2081,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 4920fd1..8730cb9 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -457,6 +457,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