From patchwork Tue Apr 10 12:51:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 896654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=glider.be Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40L6X30V24z9s3B for ; Tue, 10 Apr 2018 22:52:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753025AbeDJMwc (ORCPT ); Tue, 10 Apr 2018 08:52:32 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:44206 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752978AbeDJMwC (ORCPT ); Tue, 10 Apr 2018 08:52:02 -0400 Received: from ayla.of.borg ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id Ycrj1x00U3XaVaC01crj7N; Tue, 10 Apr 2018 14:52:00 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1f5skR-00054M-N7; Tue, 10 Apr 2018 14:51:43 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1f5skR-000410-Lx; Tue, 10 Apr 2018 14:51:43 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Rob Herring , Frank Rowand , Daniel Lezcano , Thomas Gleixner , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Heiko Stuebner , Thierry Reding , Jonathan Hunter , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 1/5] clk: Extract OF clock helpers in Date: Tue, 10 Apr 2018 14:51:37 +0200 Message-Id: <1523364701-15383-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> References: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org The use of of_clk_get_parent_{count,name}() and of_clk_init() is not limited to clock providers. Hence move these helpers into their own header file, so callers that are not clock providers no longer have to include . Suggested-by: Stephen Boyd Signed-off-by: Geert Uytterhoeven Reviewed-by: Heiko Stuebner --- v2: - New. I have't added an SPDX-License-Identifier line, as also doesn't have one yet. Other candidates to be moved here later? - of_clk_get(), - of_clk_get_by_name(), - of_clk_get_from_provider(). --- include/linux/clk-provider.h | 14 +------------- include/linux/of_clk.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 include/linux/of_clk.h diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 210a890008f9e129..61cb4729f22acd6b 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -13,6 +13,7 @@ #include #include +#include #ifdef CONFIG_COMMON_CLK @@ -890,13 +891,10 @@ struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data); -unsigned int of_clk_get_parent_count(struct device_node *np); int of_clk_parent_fill(struct device_node *np, const char **parents, unsigned int size); -const char *of_clk_get_parent_name(struct device_node *np, int index); int of_clk_detect_critical(struct device_node *np, int index, unsigned long *flags); -void of_clk_init(const struct of_device_id *matches); #else /* !CONFIG_OF */ @@ -943,26 +941,16 @@ of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data) { return ERR_PTR(-ENOENT); } -static inline unsigned int of_clk_get_parent_count(struct device_node *np) -{ - return 0; -} static inline int of_clk_parent_fill(struct device_node *np, const char **parents, unsigned int size) { return 0; } -static inline const char *of_clk_get_parent_name(struct device_node *np, - int index) -{ - return NULL; -} static inline int of_clk_detect_critical(struct device_node *np, int index, unsigned long *flags) { return 0; } -static inline void of_clk_init(const struct of_device_id *matches) {} #endif /* CONFIG_OF */ /* diff --git a/include/linux/of_clk.h b/include/linux/of_clk.h new file mode 100644 index 0000000000000000..ba3c0e6983ec1543 --- /dev/null +++ b/include/linux/of_clk.h @@ -0,0 +1,29 @@ +/* + * OF clock helpers + */ + +#ifndef __LINUX_OF_CLK_H +#define __LINUX_OF_CLK_H + +#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF) + +unsigned 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); + +#else /* !CONFIG_COMMON_CLK || !CONFIG_OF */ + +static inline unsigned int of_clk_get_parent_count(struct device_node *np) +{ + return 0; +} +static inline const char *of_clk_get_parent_name(struct device_node *np, + int index) +{ + return NULL; +} +static inline void of_clk_init(const struct of_device_id *matches) {} + +#endif /* !CONFIG_COMMON_CLK || !CONFIG_OF */ + +#endif /* __LINUX_OF_CLK_H */ From patchwork Tue Apr 10 12:51:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 896658 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=glider.be Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40L6X84xnGz9s3B for ; Tue, 10 Apr 2018 22:52:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753096AbeDJMwi (ORCPT ); Tue, 10 Apr 2018 08:52:38 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:44190 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752946AbeDJMwB (ORCPT ); Tue, 10 Apr 2018 08:52:01 -0400 Received: from ayla.of.borg ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id Ycrj1x00V3XaVaC01crj7Q; Tue, 10 Apr 2018 14:52:00 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1f5skR-00054P-Ny; Tue, 10 Apr 2018 14:51:43 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1f5skR-000414-N1; Tue, 10 Apr 2018 14:51:43 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Rob Herring , Frank Rowand , Daniel Lezcano , Thomas Gleixner , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Heiko Stuebner , Thierry Reding , Jonathan Hunter , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 2/5] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding Date: Tue, 10 Apr 2018 14:51:38 +0200 Message-Id: <1523364701-15383-3-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> References: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Signed-off-by: Geert Uytterhoeven Acked-by: Daniel Lezcano Reviewed-by: Linus Walleij --- This depends on "[PATCH v2 1/5] clk: Extract OF clock helpers in ". v2: - of_clk_get_parent_count() was moved to , - Dropped RFC, as a dummy is now available in the !CONFIG_COMMON_CLK case. --- drivers/clocksource/timer-sp804.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-sp804.c index 3ac9dec9a03852f9..e01222ea888ff9d2 100644 --- a/drivers/clocksource/timer-sp804.c +++ b/drivers/clocksource/timer-sp804.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -245,7 +246,7 @@ static int __init sp804_of_init(struct device_node *np) clk1 = NULL; /* Get the 2nd clock if the timer has 3 timer clocks */ - if (of_count_phandle_with_args(np, "clocks", "#clock-cells") == 3) { + if (of_clk_get_parent_count(np) == 3) { clk2 = of_clk_get(np, 1); if (IS_ERR(clk2)) { pr_err("sp804: %s clock not found: %d\n", np->name, From patchwork Tue Apr 10 12:51:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 896667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=glider.be Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40L6Y21CQdz9s1p for ; Tue, 10 Apr 2018 22:53:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753037AbeDJMv6 (ORCPT ); Tue, 10 Apr 2018 08:51:58 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:50962 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752815AbeDJMv4 (ORCPT ); Tue, 10 Apr 2018 08:51:56 -0400 Received: from ayla.of.borg ([84.194.111.163]) by michel.telenet-ops.be with bizsmtp id Ycrj1x00T3XaVaC06crj6E; Tue, 10 Apr 2018 14:51:54 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1f5skR-00054U-Oo; Tue, 10 Apr 2018 14:51:43 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1f5skR-00041A-Nq; Tue, 10 Apr 2018 14:51:43 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Rob Herring , Frank Rowand , Daniel Lezcano , Thomas Gleixner , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Heiko Stuebner , Thierry Reding , Jonathan Hunter , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 3/5] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding Date: Tue, 10 Apr 2018 14:51:39 +0200 Message-Id: <1523364701-15383-4-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> References: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org As of_clk_get_parent_count() returns zero on failure, while of_count_phandle_with_args() might return a negative error code, this also fixes the issue of possibly using a negative number in the allocation below. Signed-off-by: Geert Uytterhoeven Reviewed-by: Heiko Stuebner --- This depends on "[PATCH v2 1/5] clk: Extract OF clock helpers in ". v2: - of_clk_get_parent_count() was moved to . --- drivers/soc/rockchip/pm_domains.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index 53efc386b1ada8cf..13913d40c8213e36 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -400,8 +401,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, pd->info = pd_info; pd->pmu = pmu; - pd->num_clks = of_count_phandle_with_args(node, "clocks", - "#clock-cells"); + pd->num_clks = of_clk_get_parent_count(node); if (pd->num_clks > 0) { pd->clks = devm_kcalloc(pmu->dev, pd->num_clks, sizeof(*pd->clks), GFP_KERNEL); From patchwork Tue Apr 10 12:51:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 896653 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=glider.be Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40L6WV11lNz9s3B for ; Tue, 10 Apr 2018 22:52:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752980AbeDJMwD (ORCPT ); Tue, 10 Apr 2018 08:52:03 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:53622 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbeDJMv4 (ORCPT ); Tue, 10 Apr 2018 08:51:56 -0400 Received: from ayla.of.borg ([84.194.111.163]) by laurent.telenet-ops.be with bizsmtp id Ycrj1x00i3XaVaC01crjpj; Tue, 10 Apr 2018 14:51:54 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1f5skR-00054a-Qf; Tue, 10 Apr 2018 14:51:43 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1f5skR-00041F-Oh; Tue, 10 Apr 2018 14:51:43 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Rob Herring , Frank Rowand , Daniel Lezcano , Thomas Gleixner , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Heiko Stuebner , Thierry Reding , Jonathan Hunter , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 4/5] soc/tegra: pmc: Use of_clk_get_parent_count() instead of open coding Date: Tue, 10 Apr 2018 14:51:40 +0200 Message-Id: <1523364701-15383-5-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> References: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org As of_clk_get_parent_count() returns zero on failure, while of_count_phandle_with_args() might return a negative error code, this also fixes the issue of possibly using a very big number in the allocation below. Signed-off-by: Geert Uytterhoeven Acked-by: Jon Hunter --- This depends on "[PATCH v2 1/5] clk: Extract OF clock helpers in ". v2: - of_clk_get_parent_count() was moved to . --- drivers/soc/tegra/pmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index d9fcdb592b3966a5..d8cb48a4b8eb1b78 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -725,7 +726,7 @@ static int tegra_powergate_of_get_clks(struct tegra_powergate *pg, unsigned int i, count; int err; - count = of_count_phandle_with_args(np, "clocks", "#clock-cells"); + count = of_clk_get_parent_count(np); if (count == 0) return -ENODEV; From patchwork Tue Apr 10 12:51:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 896665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=glider.be Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40L6Xs6294z9s3B for ; Tue, 10 Apr 2018 22:53:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752847AbeDJMwA (ORCPT ); Tue, 10 Apr 2018 08:52:00 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:50992 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752845AbeDJMv4 (ORCPT ); Tue, 10 Apr 2018 08:51:56 -0400 Received: from ayla.of.borg ([84.194.111.163]) by michel.telenet-ops.be with bizsmtp id Ycrj1x00V3XaVaC06crj6F; Tue, 10 Apr 2018 14:51:54 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1f5skR-00054e-Rl; Tue, 10 Apr 2018 14:51:43 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1f5skR-00041K-Po; Tue, 10 Apr 2018 14:51:43 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Cc: Rob Herring , Frank Rowand , Daniel Lezcano , Thomas Gleixner , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Heiko Stuebner , Thierry Reding , Jonathan Hunter , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 5/5] pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding Date: Tue, 10 Apr 2018 14:51:41 +0200 Message-Id: <1523364701-15383-6-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> References: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org A new open coder has crept in since 470b73a38470e8ba ("pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding"), replace it. of_clk_get_parent_count() was moved to , so include that instead of . Signed-off-by: Geert Uytterhoeven Acked-by: Maxime Ripard --- This depends on "[PATCH v2 1/5] clk: Extract OF clock helpers in ". v2: - New. --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 020d6d84639ca002..25e80a5370ca02f6 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -12,12 +12,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -1361,7 +1361,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, goto gpiochip_error; } - ret = of_count_phandle_with_args(node, "clocks", "#clock-cells"); + ret = of_clk_get_parent_count(node); clk = devm_clk_get(&pdev->dev, ret == 1 ? NULL : "apb"); if (IS_ERR(clk)) { ret = PTR_ERR(clk);