* [PATCH 0/3] Use of_clk_get_parent_count() instead of open coding
@ 2018-01-19 15:18 Geert Uytterhoeven
2018-01-19 15:18 ` Geert Uytterhoeven
[not found] ` <1516375101-29836-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
0 siblings, 2 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: Maxime Ripard, Chen-Yu Tsai, Heiko Stuebner, Thierry Reding,
Jonathan Hunter
Cc: Linus Walleij, linux-arm-kernel, linux-gpio, linux-rockchip,
linux-tegra, linux-clk, Geert Uytterhoeven
Hi all,
This patch series replaces open-coded versions of
of_clk_get_parent_count() by calls to the helper function.
These patches are independent, so they can be applied where appropriate.
Thanks!
Geert Uytterhoeven (3):
pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding
soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of
open coding
soc/tegra: pmc: Use of_clk_get_parent_count() instead of open coding
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 3 ++-
drivers/soc/rockchip/pm_domains.c | 3 ++-
drivers/soc/tegra/pmc.c | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
--
2.7.4
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/3] pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding
2018-01-19 15:18 [PATCH 0/3] Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
@ 2018-01-19 15:18 ` Geert Uytterhoeven
[not found] ` <1516375101-29836-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
1 sibling, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: Maxime Ripard, Chen-Yu Tsai, Heiko Stuebner, Thierry Reding,
Jonathan Hunter
Cc: Linus Walleij, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-gpio-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-clk-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 4b6cb25bc796f86d..ab425eb45bf5e0f4 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -12,6 +12,7 @@
#include <linux/io.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/gpio/driver.h>
#include <linux/irqdomain.h>
#include <linux/irqchip/chained_irq.h>
@@ -1185,7 +1186,7 @@ static int sunxi_pinctrl_setup_debounce(struct sunxi_pinctrl *pctl,
int i, ret;
/* Deal with old DTs that didn't have the oscillators */
- if (of_count_phandle_with_args(node, "clocks", "#clock-cells") != 3)
+ if (of_clk_get_parent_count(node) != 3)
return 0;
/* If we don't have any setup, bail out */
--
2.7.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 1/3] pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding
@ 2018-01-19 15:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: Maxime Ripard, Chen-Yu Tsai, Heiko Stuebner, Thierry Reding,
Jonathan Hunter
Cc: Linus Walleij, linux-arm-kernel, linux-gpio, linux-rockchip,
linux-tegra, linux-clk, Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 4b6cb25bc796f86d..ab425eb45bf5e0f4 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -12,6 +12,7 @@
#include <linux/io.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/gpio/driver.h>
#include <linux/irqdomain.h>
#include <linux/irqchip/chained_irq.h>
@@ -1185,7 +1186,7 @@ static int sunxi_pinctrl_setup_debounce(struct sunxi_pinctrl *pctl,
int i, ret;
/* Deal with old DTs that didn't have the oscillators */
- if (of_count_phandle_with_args(node, "clocks", "#clock-cells") != 3)
+ if (of_clk_get_parent_count(node) != 3)
return 0;
/* If we don't have any setup, bail out */
--
2.7.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
2018-01-19 15:18 [PATCH 0/3] Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
@ 2018-01-19 15:18 ` Geert Uytterhoeven
[not found] ` <1516375101-29836-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
1 sibling, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: Maxime Ripard, Chen-Yu Tsai, Heiko Stuebner, Thierry Reding,
Jonathan Hunter
Cc: Linus Walleij, linux-arm-kernel, linux-gpio, linux-rockchip,
linux-tegra, linux-clk, Geert Uytterhoeven
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 <geert+renesas@glider.be>
---
drivers/soc/rockchip/pm_domains.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
index 5c342167b9db7a16..9936038d38771784 100644
--- a/drivers/soc/rockchip/pm_domains.c
+++ b/drivers/soc/rockchip/pm_domains.c
@@ -16,6 +16,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <dt-bindings/power/rk3288-power.h>
@@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
return -EINVAL;
}
- clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
+ clk_cnt = of_clk_get_parent_count(node);
pd = devm_kzalloc(pmu->dev,
sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
GFP_KERNEL);
--
2.7.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-01-19 15:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: linux-arm-kernel
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 <geert+renesas@glider.be>
---
drivers/soc/rockchip/pm_domains.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
index 5c342167b9db7a16..9936038d38771784 100644
--- a/drivers/soc/rockchip/pm_domains.c
+++ b/drivers/soc/rockchip/pm_domains.c
@@ -16,6 +16,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <dt-bindings/power/rk3288-power.h>
@@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
return -EINVAL;
}
- clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
+ clk_cnt = of_clk_get_parent_count(node);
pd = devm_kzalloc(pmu->dev,
sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
GFP_KERNEL);
--
2.7.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/3] soc/tegra: pmc: Use of_clk_get_parent_count() instead of open coding
2018-01-19 15:18 [PATCH 0/3] Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
2018-01-19 15:18 ` Geert Uytterhoeven
@ 2018-01-19 15:18 ` Geert Uytterhoeven
1 sibling, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: Maxime Ripard, Chen-Yu Tsai, Heiko Stuebner, Thierry Reding,
Jonathan Hunter
Cc: Linus Walleij, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-gpio-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-clk-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven
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 <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
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 ce62a47a6647a817..4379e4d602bc5428 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -21,6 +21,7 @@
#include <linux/kernel.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/clk/tegra.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -743,7 +744,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;
--
2.7.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/3] soc/tegra: pmc: Use of_clk_get_parent_count() instead of open coding
@ 2018-01-19 15:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: Maxime Ripard, Chen-Yu Tsai, Heiko Stuebner, Thierry Reding,
Jonathan Hunter
Cc: Linus Walleij, linux-arm-kernel, linux-gpio, linux-rockchip,
linux-tegra, linux-clk, Geert Uytterhoeven
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 <geert+renesas@glider.be>
---
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 ce62a47a6647a817..4379e4d602bc5428 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -21,6 +21,7 @@
#include <linux/kernel.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/clk/tegra.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -743,7 +744,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;
--
2.7.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/3] soc/tegra: pmc: Use of_clk_get_parent_count() instead of open coding
@ 2018-01-19 15:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-01-19 15:18 UTC (permalink / raw)
To: linux-arm-kernel
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 <geert+renesas@glider.be>
---
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 ce62a47a6647a817..4379e4d602bc5428 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -21,6 +21,7 @@
#include <linux/kernel.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/clk/tegra.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -743,7 +744,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;
--
2.7.4
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding
2018-01-19 15:18 ` Geert Uytterhoeven
@ 2018-01-22 8:55 ` Linus Walleij
-1 siblings, 0 replies; 21+ messages in thread
From: Linus Walleij @ 2018-01-22 8:55 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Maxime Ripard, Chen-Yu Tsai, Heiko Stuebner, Thierry Reding,
Jonathan Hunter, Linux ARM, linux-gpio,
open list:ARM/Rockchip SoC...,
linux-tegra, linux-clk
On Fri, Jan 19, 2018 at 4:18 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/3] pinctrl: sunxi: Use of_clk_get_parent_count() instead of open coding
@ 2018-01-22 8:55 ` Linus Walleij
0 siblings, 0 replies; 21+ messages in thread
From: Linus Walleij @ 2018-01-22 8:55 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jan 19, 2018 at 4:18 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
2018-01-19 15:18 ` Geert Uytterhoeven
@ 2018-02-10 16:35 ` Heiko Stuebner
-1 siblings, 0 replies; 21+ messages in thread
From: Heiko Stuebner @ 2018-02-10 16:35 UTC (permalink / raw)
To: Geert Uytterhoeven, Stephen Boyd, mturquette
Cc: Maxime Ripard, Chen-Yu Tsai, Thierry Reding, Jonathan Hunter,
Linus Walleij, linux-arm-kernel, linux-gpio, linux-rockchip,
linux-tegra, linux-clk
Hi Geert,
Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
> 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 <geert+renesas@glider.be>
> ---
> drivers/soc/rockchip/pm_domains.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
> index 5c342167b9db7a16..9936038d38771784 100644
> --- a/drivers/soc/rockchip/pm_domains.c
> +++ b/drivers/soc/rockchip/pm_domains.c
> @@ -16,6 +16,7 @@
> #include <linux/of_address.h>
> #include <linux/of_platform.h>
> #include <linux/clk.h>
> +#include <linux/clk-provider.h>
not wanting to be to nitpicky, but clk-provider.h seems that it should be
used from drivers exposing clocks to the system, not from clock users.
I just remember that in the past clk maintainers tried to keep their
layering intact, so I've included them for clarification.
Mike, Stephen: the power-domain driver of Rockchip socs needs
to toggle all clocks of domain peripherals when turning a domain
on or off, so has a variable list of clocks in the clocks property in dt.
Hence the of_count_... call which could be replaced with
of_clk_get_parent_count to not open-code this.
Heiko
> #include <linux/regmap.h>
> #include <linux/mfd/syscon.h>
> #include <dt-bindings/power/rk3288-power.h>
> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
> return -EINVAL;
> }
>
> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
> + clk_cnt = of_clk_get_parent_count(node);
> pd = devm_kzalloc(pmu->dev,
> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
> GFP_KERNEL);
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-02-10 16:35 ` Heiko Stuebner
0 siblings, 0 replies; 21+ messages in thread
From: Heiko Stuebner @ 2018-02-10 16:35 UTC (permalink / raw)
To: linux-arm-kernel
Hi Geert,
Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
> 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 <geert+renesas@glider.be>
> ---
> drivers/soc/rockchip/pm_domains.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
> index 5c342167b9db7a16..9936038d38771784 100644
> --- a/drivers/soc/rockchip/pm_domains.c
> +++ b/drivers/soc/rockchip/pm_domains.c
> @@ -16,6 +16,7 @@
> #include <linux/of_address.h>
> #include <linux/of_platform.h>
> #include <linux/clk.h>
> +#include <linux/clk-provider.h>
not wanting to be to nitpicky, but clk-provider.h seems that it should be
used from drivers exposing clocks to the system, not from clock users.
I just remember that in the past clk maintainers tried to keep their
layering intact, so I've included them for clarification.
Mike, Stephen: the power-domain driver of Rockchip socs needs
to toggle all clocks of domain peripherals when turning a domain
on or off, so has a variable list of clocks in the clocks property in dt.
Hence the of_count_... call which could be replaced with
of_clk_get_parent_count to not open-code this.
Heiko
> #include <linux/regmap.h>
> #include <linux/mfd/syscon.h>
> #include <dt-bindings/power/rk3288-power.h>
> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
> return -EINVAL;
> }
>
> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
> + clk_cnt = of_clk_get_parent_count(node);
> pd = devm_kzalloc(pmu->dev,
> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
> GFP_KERNEL);
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
2018-02-10 16:35 ` Heiko Stuebner
(?)
@ 2018-02-18 19:09 ` Michael Turquette
-1 siblings, 0 replies; 21+ messages in thread
From: Michael Turquette @ 2018-02-18 19:09 UTC (permalink / raw)
To: Heiko Stuebner
Cc: Geert Uytterhoeven, open list:ARM/Rockchip SoC...,
Linus Walleij, Stephen Boyd, Jonathan Hunter, linux-gpio,
Chen-Yu Tsai, Thierry Reding, linux-tegra, Maxime Ripard,
linux-clk, Stephen Boyd <sboyd@codeaurora.org>,
Emilio Lopez <emilio@elopez.com.ar>,
Hans de Goede <hdegoede@redhat.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-arm-kernel
Heiko, Geert,
On Sat, Feb 10, 2018 at 8:35 AM, Heiko Stuebner <heiko@sntech.de> wrote:
> Hi Geert,
>
> Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
>> 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 <geert+renesas@glider.be>
>> ---
>> drivers/soc/rockchip/pm_domains.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
>> index 5c342167b9db7a16..9936038d38771784 100644
>> --- a/drivers/soc/rockchip/pm_domains.c
>> +++ b/drivers/soc/rockchip/pm_domains.c
>> @@ -16,6 +16,7 @@
>> #include <linux/of_address.h>
>> #include <linux/of_platform.h>
>> #include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>
> not wanting to be to nitpicky, but clk-provider.h seems that it should be
> used from drivers exposing clocks to the system, not from clock users.
>
> I just remember that in the past clk maintainers tried to keep their
> layering intact, so I've included them for clarification.
>
> Mike, Stephen: the power-domain driver of Rockchip socs needs
> to toggle all clocks of domain peripherals when turning a domain
> on or off, so has a variable list of clocks in the clocks property in dt.
> Hence the of_count_... call which could be replaced with
> of_clk_get_parent_count to not open-code this.
Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
more of an of-specific helper than a provider-specific helper.
Anyone up to submit a patch so that this one doesn't need to include
clk-provider.h?
Regards,
Mike
>
>
> Heiko
>
>> #include <linux/regmap.h>
>> #include <linux/mfd/syscon.h>
>> #include <dt-bindings/power/rk3288-power.h>
>> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>> return -EINVAL;
>> }
>>
>> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
>> + clk_cnt = of_clk_get_parent_count(node);
>> pd = devm_kzalloc(pmu->dev,
>> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
>> GFP_KERNEL);
>>
>
>
--
Michael Turquette
CEO
BayLibre - At the Heart of Embedded Linux
http://baylibre.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-02-18 19:09 ` Michael Turquette
0 siblings, 0 replies; 21+ messages in thread
From: Michael Turquette @ 2018-02-18 19:09 UTC (permalink / raw)
To: Heiko Stuebner
Cc: Geert Uytterhoeven, Stephen Boyd, Maxime Ripard, Chen-Yu Tsai,
Thierry Reding, Jonathan Hunter, Linus Walleij,
Stephen Boyd <sboyd@codeaurora.org>,
Emilio Lopez <emilio@elopez.com.ar>,
Hans de Goede <hdegoede@redhat.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-arm-kernel, linux-gpio, open list:ARM/Rockchip SoC...,
linux-tegra, linux-clk
Heiko, Geert,
On Sat, Feb 10, 2018 at 8:35 AM, Heiko Stuebner <heiko@sntech.de> wrote:
> Hi Geert,
>
> Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
>> 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 <geert+renesas@glider.be>
>> ---
>> drivers/soc/rockchip/pm_domains.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
>> index 5c342167b9db7a16..9936038d38771784 100644
>> --- a/drivers/soc/rockchip/pm_domains.c
>> +++ b/drivers/soc/rockchip/pm_domains.c
>> @@ -16,6 +16,7 @@
>> #include <linux/of_address.h>
>> #include <linux/of_platform.h>
>> #include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>
> not wanting to be to nitpicky, but clk-provider.h seems that it should be
> used from drivers exposing clocks to the system, not from clock users.
>
> I just remember that in the past clk maintainers tried to keep their
> layering intact, so I've included them for clarification.
>
> Mike, Stephen: the power-domain driver of Rockchip socs needs
> to toggle all clocks of domain peripherals when turning a domain
> on or off, so has a variable list of clocks in the clocks property in dt.
> Hence the of_count_... call which could be replaced with
> of_clk_get_parent_count to not open-code this.
Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
more of an of-specific helper than a provider-specific helper.
Anyone up to submit a patch so that this one doesn't need to include
clk-provider.h?
Regards,
Mike
>
>
> Heiko
>
>> #include <linux/regmap.h>
>> #include <linux/mfd/syscon.h>
>> #include <dt-bindings/power/rk3288-power.h>
>> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>> return -EINVAL;
>> }
>>
>> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
>> + clk_cnt = of_clk_get_parent_count(node);
>> pd = devm_kzalloc(pmu->dev,
>> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
>> GFP_KERNEL);
>>
>
>
--
Michael Turquette
CEO
BayLibre - At the Heart of Embedded Linux
http://baylibre.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-02-18 19:09 ` Michael Turquette
0 siblings, 0 replies; 21+ messages in thread
From: Michael Turquette @ 2018-02-18 19:09 UTC (permalink / raw)
To: linux-arm-kernel
Heiko, Geert,
On Sat, Feb 10, 2018 at 8:35 AM, Heiko Stuebner <heiko@sntech.de> wrote:
> Hi Geert,
>
> Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
>> 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 <geert+renesas@glider.be>
>> ---
>> drivers/soc/rockchip/pm_domains.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
>> index 5c342167b9db7a16..9936038d38771784 100644
>> --- a/drivers/soc/rockchip/pm_domains.c
>> +++ b/drivers/soc/rockchip/pm_domains.c
>> @@ -16,6 +16,7 @@
>> #include <linux/of_address.h>
>> #include <linux/of_platform.h>
>> #include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>
> not wanting to be to nitpicky, but clk-provider.h seems that it should be
> used from drivers exposing clocks to the system, not from clock users.
>
> I just remember that in the past clk maintainers tried to keep their
> layering intact, so I've included them for clarification.
>
> Mike, Stephen: the power-domain driver of Rockchip socs needs
> to toggle all clocks of domain peripherals when turning a domain
> on or off, so has a variable list of clocks in the clocks property in dt.
> Hence the of_count_... call which could be replaced with
> of_clk_get_parent_count to not open-code this.
Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
more of an of-specific helper than a provider-specific helper.
Anyone up to submit a patch so that this one doesn't need to include
clk-provider.h?
Regards,
Mike
>
>
> Heiko
>
>> #include <linux/regmap.h>
>> #include <linux/mfd/syscon.h>
>> #include <dt-bindings/power/rk3288-power.h>
>> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>> return -EINVAL;
>> }
>>
>> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
>> + clk_cnt = of_clk_get_parent_count(node);
>> pd = devm_kzalloc(pmu->dev,
>> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
>> GFP_KERNEL);
>>
>
>
--
Michael Turquette
CEO
BayLibre - At the Heart of Embedded Linux
http://baylibre.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
2018-02-18 19:09 ` Michael Turquette
(?)
@ 2018-03-02 13:15 ` Geert Uytterhoeven
-1 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-03-02 13:15 UTC (permalink / raw)
To: Michael Turquette
Cc: Heiko Stuebner, Geert Uytterhoeven, open list:ARM/Rockchip SoC...,
Linus Walleij, Stephen Boyd, Jonathan Hunter,
open list:GPIO SUBSYSTEM, Chen-Yu Tsai, Thierry Reding,
linux-tegra, Maxime Ripard, linux-clk,
Stephen Boyd <sboyd@codeaurora.org>,
Emilio Lopez <emilio@elopez.com.ar>,
Hans de Goede <hdegoede@redhat.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-arm-kernel
Hi Mike,
On Sun, Feb 18, 2018 at 8:09 PM, Michael Turquette
<mturquette@baylibre.com> wrote:
> On Sat, Feb 10, 2018 at 8:35 AM, Heiko Stuebner <heiko@sntech.de> wrote:
>> Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
>>> 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 <geert+renesas@glider.be>
>>> ---
>>> drivers/soc/rockchip/pm_domains.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
>>> index 5c342167b9db7a16..9936038d38771784 100644
>>> --- a/drivers/soc/rockchip/pm_domains.c
>>> +++ b/drivers/soc/rockchip/pm_domains.c
>>> @@ -16,6 +16,7 @@
>>> #include <linux/of_address.h>
>>> #include <linux/of_platform.h>
>>> #include <linux/clk.h>
>>> +#include <linux/clk-provider.h>
>>
>> not wanting to be to nitpicky, but clk-provider.h seems that it should be
>> used from drivers exposing clocks to the system, not from clock users.
>>
>> I just remember that in the past clk maintainers tried to keep their
>> layering intact, so I've included them for clarification.
>>
>> Mike, Stephen: the power-domain driver of Rockchip socs needs
>> to toggle all clocks of domain peripherals when turning a domain
>> on or off, so has a variable list of clocks in the clocks property in dt.
>> Hence the of_count_... call which could be replaced with
>> of_clk_get_parent_count to not open-code this.
>
> Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
> more of an of-specific helper than a provider-specific helper.
>
> Anyone up to submit a patch so that this one doesn't need to include
> clk-provider.h?
I gave it a try.
Just moving of_clk_get_parent_count() from clk-provider.h to clk.h causes
breakage, as half of the clock providers using of_clk_get_parent_count()
do not include <linux/clk.h>:
drivers/clk/at91/clk-generated.c
drivers/clk/at91/clk-main.c
drivers/clk/at91/clk-master.c
drivers/clk/at91/clk-programmable.c
drivers/clk/at91/clk-slow.c
drivers/clk/at91/clk-smd.c
drivers/clk/at91/clk-usb.c
drivers/clk/at91/sckc.c
drivers/clk/clk-axi-clkgen.c
drivers/clk/clk-gpio.c
drivers/clk/clk-hsdk-pll.c
drivers/clk/h8300/clk-div.c
drivers/clk/h8300/clk-h8s2678.c
drivers/clk/renesas/clk-div6.c
drivers/clk/ti/composite.c
drivers/clk/ti/gate.c
drivers/clk/ti/mux.c
So our options are:
1. Add #include <linux/clk.h> to each of the above,
2. Add #include <linux/clk.h> to <linux/clk-provider.h>,
3. Do nothing, i.e. users of of_clk_get_parent_count () need to
#include <linux/clk-provider.h>, cfr. this patch series.
Any preference? Any option I'm missing?
Thanks!
>>> #include <linux/regmap.h>
>>> #include <linux/mfd/syscon.h>
>>> #include <dt-bindings/power/rk3288-power.h>
>>> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>>> return -EINVAL;
>>> }
>>>
>>> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
>>> + clk_cnt = of_clk_get_parent_count(node);
>>> pd = devm_kzalloc(pmu->dev,
>>> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
>>> GFP_KERNEL);
>>>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-03-02 13:15 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-03-02 13:15 UTC (permalink / raw)
To: Michael Turquette
Cc: Heiko Stuebner, Geert Uytterhoeven, Stephen Boyd, Maxime Ripard,
Chen-Yu Tsai, Thierry Reding, Jonathan Hunter, Linus Walleij,
Stephen Boyd <sboyd@codeaurora.org>,
Emilio Lopez <emilio@elopez.com.ar>,
Hans de Goede <hdegoede@redhat.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-arm-kernel, open list:GPIO SUBSYSTEM,
open list:ARM/Rockchip SoC...,
linux-tegra, linux-clk
Hi Mike,
On Sun, Feb 18, 2018 at 8:09 PM, Michael Turquette
<mturquette@baylibre.com> wrote:
> On Sat, Feb 10, 2018 at 8:35 AM, Heiko Stuebner <heiko@sntech.de> wrote:
>> Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
>>> 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 <geert+renesas@glider.be>
>>> ---
>>> drivers/soc/rockchip/pm_domains.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
>>> index 5c342167b9db7a16..9936038d38771784 100644
>>> --- a/drivers/soc/rockchip/pm_domains.c
>>> +++ b/drivers/soc/rockchip/pm_domains.c
>>> @@ -16,6 +16,7 @@
>>> #include <linux/of_address.h>
>>> #include <linux/of_platform.h>
>>> #include <linux/clk.h>
>>> +#include <linux/clk-provider.h>
>>
>> not wanting to be to nitpicky, but clk-provider.h seems that it should be
>> used from drivers exposing clocks to the system, not from clock users.
>>
>> I just remember that in the past clk maintainers tried to keep their
>> layering intact, so I've included them for clarification.
>>
>> Mike, Stephen: the power-domain driver of Rockchip socs needs
>> to toggle all clocks of domain peripherals when turning a domain
>> on or off, so has a variable list of clocks in the clocks property in dt.
>> Hence the of_count_... call which could be replaced with
>> of_clk_get_parent_count to not open-code this.
>
> Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
> more of an of-specific helper than a provider-specific helper.
>
> Anyone up to submit a patch so that this one doesn't need to include
> clk-provider.h?
I gave it a try.
Just moving of_clk_get_parent_count() from clk-provider.h to clk.h causes
breakage, as half of the clock providers using of_clk_get_parent_count()
do not include <linux/clk.h>:
drivers/clk/at91/clk-generated.c
drivers/clk/at91/clk-main.c
drivers/clk/at91/clk-master.c
drivers/clk/at91/clk-programmable.c
drivers/clk/at91/clk-slow.c
drivers/clk/at91/clk-smd.c
drivers/clk/at91/clk-usb.c
drivers/clk/at91/sckc.c
drivers/clk/clk-axi-clkgen.c
drivers/clk/clk-gpio.c
drivers/clk/clk-hsdk-pll.c
drivers/clk/h8300/clk-div.c
drivers/clk/h8300/clk-h8s2678.c
drivers/clk/renesas/clk-div6.c
drivers/clk/ti/composite.c
drivers/clk/ti/gate.c
drivers/clk/ti/mux.c
So our options are:
1. Add #include <linux/clk.h> to each of the above,
2. Add #include <linux/clk.h> to <linux/clk-provider.h>,
3. Do nothing, i.e. users of of_clk_get_parent_count () need to
#include <linux/clk-provider.h>, cfr. this patch series.
Any preference? Any option I'm missing?
Thanks!
>>> #include <linux/regmap.h>
>>> #include <linux/mfd/syscon.h>
>>> #include <dt-bindings/power/rk3288-power.h>
>>> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>>> return -EINVAL;
>>> }
>>>
>>> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
>>> + clk_cnt = of_clk_get_parent_count(node);
>>> pd = devm_kzalloc(pmu->dev,
>>> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
>>> GFP_KERNEL);
>>>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-03-02 13:15 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2018-03-02 13:15 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mike,
On Sun, Feb 18, 2018 at 8:09 PM, Michael Turquette
<mturquette@baylibre.com> wrote:
> On Sat, Feb 10, 2018 at 8:35 AM, Heiko Stuebner <heiko@sntech.de> wrote:
>> Am Freitag, 19. Januar 2018, 16:18:20 CET schrieb Geert Uytterhoeven:
>>> 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 <geert+renesas@glider.be>
>>> ---
>>> drivers/soc/rockchip/pm_domains.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
>>> index 5c342167b9db7a16..9936038d38771784 100644
>>> --- a/drivers/soc/rockchip/pm_domains.c
>>> +++ b/drivers/soc/rockchip/pm_domains.c
>>> @@ -16,6 +16,7 @@
>>> #include <linux/of_address.h>
>>> #include <linux/of_platform.h>
>>> #include <linux/clk.h>
>>> +#include <linux/clk-provider.h>
>>
>> not wanting to be to nitpicky, but clk-provider.h seems that it should be
>> used from drivers exposing clocks to the system, not from clock users.
>>
>> I just remember that in the past clk maintainers tried to keep their
>> layering intact, so I've included them for clarification.
>>
>> Mike, Stephen: the power-domain driver of Rockchip socs needs
>> to toggle all clocks of domain peripherals when turning a domain
>> on or off, so has a variable list of clocks in the clocks property in dt.
>> Hence the of_count_... call which could be replaced with
>> of_clk_get_parent_count to not open-code this.
>
> Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
> more of an of-specific helper than a provider-specific helper.
>
> Anyone up to submit a patch so that this one doesn't need to include
> clk-provider.h?
I gave it a try.
Just moving of_clk_get_parent_count() from clk-provider.h to clk.h causes
breakage, as half of the clock providers using of_clk_get_parent_count()
do not include <linux/clk.h>:
drivers/clk/at91/clk-generated.c
drivers/clk/at91/clk-main.c
drivers/clk/at91/clk-master.c
drivers/clk/at91/clk-programmable.c
drivers/clk/at91/clk-slow.c
drivers/clk/at91/clk-smd.c
drivers/clk/at91/clk-usb.c
drivers/clk/at91/sckc.c
drivers/clk/clk-axi-clkgen.c
drivers/clk/clk-gpio.c
drivers/clk/clk-hsdk-pll.c
drivers/clk/h8300/clk-div.c
drivers/clk/h8300/clk-h8s2678.c
drivers/clk/renesas/clk-div6.c
drivers/clk/ti/composite.c
drivers/clk/ti/gate.c
drivers/clk/ti/mux.c
So our options are:
1. Add #include <linux/clk.h> to each of the above,
2. Add #include <linux/clk.h> to <linux/clk-provider.h>,
3. Do nothing, i.e. users of of_clk_get_parent_count () need to
#include <linux/clk-provider.h>, cfr. this patch series.
Any preference? Any option I'm missing?
Thanks!
>>> #include <linux/regmap.h>
>>> #include <linux/mfd/syscon.h>
>>> #include <dt-bindings/power/rk3288-power.h>
>>> @@ -391,7 +392,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>>> return -EINVAL;
>>> }
>>>
>>> - clk_cnt = of_count_phandle_with_args(node, "clocks", "#clock-cells");
>>> + clk_cnt = of_clk_get_parent_count(node);
>>> pd = devm_kzalloc(pmu->dev,
>>> sizeof(*pd) + clk_cnt * sizeof(pd->clks[0]),
>>> GFP_KERNEL);
>>>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
2018-03-02 13:15 ` Geert Uytterhoeven
(?)
@ 2018-03-12 22:32 ` Stephen Boyd
-1 siblings, 0 replies; 21+ messages in thread
From: Stephen Boyd @ 2018-03-12 22:32 UTC (permalink / raw)
To: Geert Uytterhoeven, Michael Turquette
Cc: Heiko Stuebner, Geert Uytterhoeven, open list:GPIO SUBSYSTEM,
Linus Walleij, Stephen Boyd, Jonathan Hunter,
open list:ARM/Rockchip SoC...,
Chen-Yu Tsai, Thierry Reding, linux-tegra, Maxime Ripard,
linux-clk, Stephen Boyd <sboyd@codeaurora.org>,
Emilio Lopez <emilio@elopez.com.ar>,
Hans de Goede <hdegoede@redhat.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-arm-kernel
Quoting Geert Uytterhoeven (2018-03-02 05:15:35)
> Hi Mike,
>
> On Sun, Feb 18, 2018 at 8:09 PM, Michael Turquette
> <mturquette@baylibre.com> wrote:
> > Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
> > more of an of-specific helper than a provider-specific helper.
> >
> > Anyone up to submit a patch so that this one doesn't need to include
> > clk-provider.h?
>
> I gave it a try.
> Just moving of_clk_get_parent_count() from clk-provider.h to clk.h causes
> breakage, as half of the clock providers using of_clk_get_parent_count()
> do not include <linux/clk.h>:
>
> drivers/clk/at91/clk-generated.c
> drivers/clk/at91/clk-main.c
> drivers/clk/at91/clk-master.c
> drivers/clk/at91/clk-programmable.c
> drivers/clk/at91/clk-slow.c
> drivers/clk/at91/clk-smd.c
> drivers/clk/at91/clk-usb.c
> drivers/clk/at91/sckc.c
> drivers/clk/clk-axi-clkgen.c
> drivers/clk/clk-gpio.c
> drivers/clk/clk-hsdk-pll.c
> drivers/clk/h8300/clk-div.c
> drivers/clk/h8300/clk-h8s2678.c
> drivers/clk/renesas/clk-div6.c
> drivers/clk/ti/composite.c
> drivers/clk/ti/gate.c
> drivers/clk/ti/mux.c
>
> So our options are:
> 1. Add #include <linux/clk.h> to each of the above,
> 2. Add #include <linux/clk.h> to <linux/clk-provider.h>,
> 3. Do nothing, i.e. users of of_clk_get_parent_count () need to
> #include <linux/clk-provider.h>, cfr. this patch series.
>
> Any preference? Any option I'm missing?
>
#2 is a definite no.
How about option #4? Move of_clk_get_parent_count() and
of_clk_get_parent_name() to a new include/linux/of_clk.h, include that
in clk-provider.h, and then have non-clk provider drivers include that
file? After that, we can also move of_clk_init() into this new file, and
then non-provider arch code can call of_clk_init() without including the
provider APIs. I'd also like to get rid of the include of linux/of.h in
clk-provider.h, but that's a ways away.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-03-12 22:32 ` Stephen Boyd
0 siblings, 0 replies; 21+ messages in thread
From: Stephen Boyd @ 2018-03-12 22:32 UTC (permalink / raw)
To: Geert Uytterhoeven, Michael Turquette
Cc: Heiko Stuebner, Geert Uytterhoeven, open list:ARM/Rockchip SoC...,
Linus Walleij, Stephen Boyd, Jonathan Hunter,
open list:GPIO SUBSYSTEM, Chen-Yu Tsai, Thierry Reding,
linux-tegra, Maxime Ripard, linux-clk,
Stephen Boyd <sboyd@codeaurora.org>,
Emilio Lopez <emilio@elopez.com.ar>,
Hans de Goede <hdegoede@redhat.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-arm-kernel
Quoting Geert Uytterhoeven (2018-03-02 05:15:35)
> Hi Mike,
> =
> On Sun, Feb 18, 2018 at 8:09 PM, Michael Turquette
> <mturquette@baylibre.com> wrote:
> > Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
> > more of an of-specific helper than a provider-specific helper.
> >
> > Anyone up to submit a patch so that this one doesn't need to include
> > clk-provider.h?
> =
> I gave it a try.
> Just moving of_clk_get_parent_count() from clk-provider.h to clk.h causes
> breakage, as half of the clock providers using of_clk_get_parent_count()
> do not include <linux/clk.h>:
> =
> drivers/clk/at91/clk-generated.c
> drivers/clk/at91/clk-main.c
> drivers/clk/at91/clk-master.c
> drivers/clk/at91/clk-programmable.c
> drivers/clk/at91/clk-slow.c
> drivers/clk/at91/clk-smd.c
> drivers/clk/at91/clk-usb.c
> drivers/clk/at91/sckc.c
> drivers/clk/clk-axi-clkgen.c
> drivers/clk/clk-gpio.c
> drivers/clk/clk-hsdk-pll.c
> drivers/clk/h8300/clk-div.c
> drivers/clk/h8300/clk-h8s2678.c
> drivers/clk/renesas/clk-div6.c
> drivers/clk/ti/composite.c
> drivers/clk/ti/gate.c
> drivers/clk/ti/mux.c
> =
> So our options are:
> 1. Add #include <linux/clk.h> to each of the above,
> 2. Add #include <linux/clk.h> to <linux/clk-provider.h>,
> 3. Do nothing, i.e. users of of_clk_get_parent_count () need to
> #include <linux/clk-provider.h>, cfr. this patch series.
> =
> Any preference? Any option I'm missing?
> =
#2 is a definite no.
How about option #4? Move of_clk_get_parent_count() and
of_clk_get_parent_name() to a new include/linux/of_clk.h, include that
in clk-provider.h, and then have non-clk provider drivers include that
file? After that, we can also move of_clk_init() into this new file, and
then non-provider arch code can call of_clk_init() without including the
provider APIs. I'd also like to get rid of the include of linux/of.h in
clk-provider.h, but that's a ways away.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/3] soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
@ 2018-03-12 22:32 ` Stephen Boyd
0 siblings, 0 replies; 21+ messages in thread
From: Stephen Boyd @ 2018-03-12 22:32 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Geert Uytterhoeven (2018-03-02 05:15:35)
> Hi Mike,
>
> On Sun, Feb 18, 2018 at 8:09 PM, Michael Turquette
> <mturquette@baylibre.com> wrote:
> > Moving of_clk_get_parent_count to clk.h seems reasonable to me. It's
> > more of an of-specific helper than a provider-specific helper.
> >
> > Anyone up to submit a patch so that this one doesn't need to include
> > clk-provider.h?
>
> I gave it a try.
> Just moving of_clk_get_parent_count() from clk-provider.h to clk.h causes
> breakage, as half of the clock providers using of_clk_get_parent_count()
> do not include <linux/clk.h>:
>
> drivers/clk/at91/clk-generated.c
> drivers/clk/at91/clk-main.c
> drivers/clk/at91/clk-master.c
> drivers/clk/at91/clk-programmable.c
> drivers/clk/at91/clk-slow.c
> drivers/clk/at91/clk-smd.c
> drivers/clk/at91/clk-usb.c
> drivers/clk/at91/sckc.c
> drivers/clk/clk-axi-clkgen.c
> drivers/clk/clk-gpio.c
> drivers/clk/clk-hsdk-pll.c
> drivers/clk/h8300/clk-div.c
> drivers/clk/h8300/clk-h8s2678.c
> drivers/clk/renesas/clk-div6.c
> drivers/clk/ti/composite.c
> drivers/clk/ti/gate.c
> drivers/clk/ti/mux.c
>
> So our options are:
> 1. Add #include <linux/clk.h> to each of the above,
> 2. Add #include <linux/clk.h> to <linux/clk-provider.h>,
> 3. Do nothing, i.e. users of of_clk_get_parent_count () need to
> #include <linux/clk-provider.h>, cfr. this patch series.
>
> Any preference? Any option I'm missing?
>
#2 is a definite no.
How about option #4? Move of_clk_get_parent_count() and
of_clk_get_parent_name() to a new include/linux/of_clk.h, include that
in clk-provider.h, and then have non-clk provider drivers include that
file? After that, we can also move of_clk_init() into this new file, and
then non-provider arch code can call of_clk_init() without including the
provider APIs. I'd also like to get rid of the include of linux/of.h in
clk-provider.h, but that's a ways away.
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2018-03-12 22:32 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 15:18 [PATCH 0/3] Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
2018-01-19 15:18 ` [PATCH 2/3] soc: rockchip: power-domain: " Geert Uytterhoeven
2018-01-19 15:18 ` Geert Uytterhoeven
2018-02-10 16:35 ` Heiko Stuebner
2018-02-10 16:35 ` Heiko Stuebner
2018-02-18 19:09 ` Michael Turquette
2018-02-18 19:09 ` Michael Turquette
2018-02-18 19:09 ` Michael Turquette
2018-03-02 13:15 ` Geert Uytterhoeven
2018-03-02 13:15 ` Geert Uytterhoeven
2018-03-02 13:15 ` Geert Uytterhoeven
2018-03-12 22:32 ` Stephen Boyd
2018-03-12 22:32 ` Stephen Boyd
2018-03-12 22:32 ` Stephen Boyd
[not found] ` <1516375101-29836-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2018-01-19 15:18 ` [PATCH 1/3] pinctrl: sunxi: " Geert Uytterhoeven
2018-01-19 15:18 ` Geert Uytterhoeven
2018-01-22 8:55 ` Linus Walleij
2018-01-22 8:55 ` Linus Walleij
2018-01-19 15:18 ` [PATCH 3/3] soc/tegra: pmc: " Geert Uytterhoeven
2018-01-19 15:18 ` Geert Uytterhoeven
2018-01-19 15:18 ` Geert Uytterhoeven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.