All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] clk: Use of_clk_get_parent_count() instead of open coding
@ 2015-05-29  9:25 ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Stephen Boyd, Russell King
  Cc: linux-clk, kernel, linux-omap, linux-arm-kernel, Geert Uytterhoeven

	Hi all,

In several places, the functionality of of_clk_get_parent_count() is open
coded. Replace them by of_clk_get_parent_count() to reduce code size.

The first 3 patches can be applied independently, as the affected clock
drivers are used with CONFIG_COMMON_CLK=y and CONFIG_OF=y only.

Patch 4 adds dummy implementations of of_clk_get_parent_count() for the
cases where CONFIG_OF or CONFIG_COMMON_CLK are not set.
This is an RFC, as
  1. Dummies are needed in two places,
  2. We don't have any dummies yet for the !CCF case.

Patch 5 depends on patch 4, since the arm,sp804 timer is also used on
platforms where CONFIG_OF or CONFIG_COMMON_CLK are not set.

This was compile-tested using:
  - multi_v7_defconfig (CCF, OF)
  - realview_defconfig (CCF, no OF)
  - versatile_defconfig (no CCF, no OF)
  - bcm2835_defconfig (CCF, OF)
  - axm55xx_defconfig (CCF, OF)
  - at91_dt_defconfig (CCF, OF)
  - omap2plus_defconfig (CCF, OF)

Thanks!

Geert Uytterhoeven (5):
  clk: at91: Use of_clk_get_parent_count() instead of open coding
  clk: st: Use of_clk_get_parent_count() instead of open coding
  clk: ti: Use of_clk_get_parent_count() instead of open coding
  [RFC] clk: Provide dummy of_clk_get_parent_count() for !OF/!CCF
  [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open
    coding

 arch/arm/common/timer-sp.c          |  3 ++-
 drivers/clk/at91/clk-main.c         |  2 +-
 drivers/clk/at91/clk-master.c       |  2 +-
 drivers/clk/at91/clk-programmable.c |  2 +-
 drivers/clk/at91/clk-slow.c         |  4 ++--
 drivers/clk/at91/clk-smd.c          |  2 +-
 drivers/clk/at91/clk-usb.c          |  2 +-
 drivers/clk/st/clk-flexgen.c        |  2 +-
 drivers/clk/st/clkgen-mux.c         |  2 +-
 drivers/clk/ti/clockdomain.c        |  2 +-
 include/linux/clk-provider.h        | 11 ++++++++++-
 11 files changed, 22 insertions(+), 12 deletions(-)

-- 
1.9.1

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] 26+ messages in thread

* [PATCH 0/5] clk: Use of_clk_get_parent_count() instead of open coding
@ 2015-05-29  9:25 ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

	Hi all,

In several places, the functionality of of_clk_get_parent_count() is open
coded. Replace them by of_clk_get_parent_count() to reduce code size.

The first 3 patches can be applied independently, as the affected clock
drivers are used with CONFIG_COMMON_CLK=y and CONFIG_OF=y only.

Patch 4 adds dummy implementations of of_clk_get_parent_count() for the
cases where CONFIG_OF or CONFIG_COMMON_CLK are not set.
This is an RFC, as
  1. Dummies are needed in two places,
  2. We don't have any dummies yet for the !CCF case.

Patch 5 depends on patch 4, since the arm,sp804 timer is also used on
platforms where CONFIG_OF or CONFIG_COMMON_CLK are not set.

This was compile-tested using:
  - multi_v7_defconfig (CCF, OF)
  - realview_defconfig (CCF, no OF)
  - versatile_defconfig (no CCF, no OF)
  - bcm2835_defconfig (CCF, OF)
  - axm55xx_defconfig (CCF, OF)
  - at91_dt_defconfig (CCF, OF)
  - omap2plus_defconfig (CCF, OF)

Thanks!

Geert Uytterhoeven (5):
  clk: at91: Use of_clk_get_parent_count() instead of open coding
  clk: st: Use of_clk_get_parent_count() instead of open coding
  clk: ti: Use of_clk_get_parent_count() instead of open coding
  [RFC] clk: Provide dummy of_clk_get_parent_count() for !OF/!CCF
  [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open
    coding

 arch/arm/common/timer-sp.c          |  3 ++-
 drivers/clk/at91/clk-main.c         |  2 +-
 drivers/clk/at91/clk-master.c       |  2 +-
 drivers/clk/at91/clk-programmable.c |  2 +-
 drivers/clk/at91/clk-slow.c         |  4 ++--
 drivers/clk/at91/clk-smd.c          |  2 +-
 drivers/clk/at91/clk-usb.c          |  2 +-
 drivers/clk/st/clk-flexgen.c        |  2 +-
 drivers/clk/st/clkgen-mux.c         |  2 +-
 drivers/clk/ti/clockdomain.c        |  2 +-
 include/linux/clk-provider.h        | 11 ++++++++++-
 11 files changed, 22 insertions(+), 12 deletions(-)

-- 
1.9.1

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] 26+ messages in thread

* [PATCH 1/5] clk: at91: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25 ` Geert Uytterhoeven
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Stephen Boyd, Russell King
  Cc: linux-clk, kernel, linux-omap, linux-arm-kernel, Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/at91/clk-main.c         | 2 +-
 drivers/clk/at91/clk-master.c       | 2 +-
 drivers/clk/at91/clk-programmable.c | 2 +-
 drivers/clk/at91/clk-slow.c         | 4 ++--
 drivers/clk/at91/clk-smd.c          | 2 +-
 drivers/clk/at91/clk-usb.c          | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 59fa3cc96c9eb341..c2400456a0447118 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -614,7 +614,7 @@ void __init of_at91sam9x5_clk_main_setup(struct device_node *np,
 	const char *name = np->name;
 	int i;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > 2)
 		return;
 
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
index c1af80bcdf2082c8..f98eafe9b12dc92d 100644
--- a/drivers/clk/at91/clk-master.c
+++ b/drivers/clk/at91/clk-master.c
@@ -224,7 +224,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
 	const char *name = np->name;
 	struct clk_master_characteristics *characteristics;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
 		return;
 
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
index 86c8a073dcc32a20..8c86c0f7847a55a0 100644
--- a/drivers/clk/at91/clk-programmable.c
+++ b/drivers/clk/at91/clk-programmable.c
@@ -237,7 +237,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
 	const char *name;
 	struct device_node *progclknp;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
 		return;
 
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
index 2f13bd5246b5563e..98a84a865fe1cf1b 100644
--- a/drivers/clk/at91/clk-slow.c
+++ b/drivers/clk/at91/clk-slow.c
@@ -373,7 +373,7 @@ void __init of_at91sam9x5_clk_slow_setup(struct device_node *np,
 	const char *name = np->name;
 	int i;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > 2)
 		return;
 
@@ -451,7 +451,7 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
 	const char *name = np->name;
 	int i;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents != 2)
 		return;
 
diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
index 144d47ecfe63c6eb..3817ea865ca258ec 100644
--- a/drivers/clk/at91/clk-smd.c
+++ b/drivers/clk/at91/clk-smd.c
@@ -150,7 +150,7 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
 	const char *parent_names[SMD_SOURCE_MAX];
 	const char *name = np->name;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
 		return;
 
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index 0b7c3e8840bae0eb..b0cbd2b1ff595702 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -378,7 +378,7 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
 	const char *parent_names[USB_SOURCE_MAX];
 	const char *name = np->name;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
 		return;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 1/5] clk: at91: Use of_clk_get_parent_count() instead of open coding
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/at91/clk-main.c         | 2 +-
 drivers/clk/at91/clk-master.c       | 2 +-
 drivers/clk/at91/clk-programmable.c | 2 +-
 drivers/clk/at91/clk-slow.c         | 4 ++--
 drivers/clk/at91/clk-smd.c          | 2 +-
 drivers/clk/at91/clk-usb.c          | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 59fa3cc96c9eb341..c2400456a0447118 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -614,7 +614,7 @@ void __init of_at91sam9x5_clk_main_setup(struct device_node *np,
 	const char *name = np->name;
 	int i;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > 2)
 		return;
 
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
index c1af80bcdf2082c8..f98eafe9b12dc92d 100644
--- a/drivers/clk/at91/clk-master.c
+++ b/drivers/clk/at91/clk-master.c
@@ -224,7 +224,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
 	const char *name = np->name;
 	struct clk_master_characteristics *characteristics;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
 		return;
 
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
index 86c8a073dcc32a20..8c86c0f7847a55a0 100644
--- a/drivers/clk/at91/clk-programmable.c
+++ b/drivers/clk/at91/clk-programmable.c
@@ -237,7 +237,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
 	const char *name;
 	struct device_node *progclknp;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
 		return;
 
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
index 2f13bd5246b5563e..98a84a865fe1cf1b 100644
--- a/drivers/clk/at91/clk-slow.c
+++ b/drivers/clk/at91/clk-slow.c
@@ -373,7 +373,7 @@ void __init of_at91sam9x5_clk_slow_setup(struct device_node *np,
 	const char *name = np->name;
 	int i;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > 2)
 		return;
 
@@ -451,7 +451,7 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
 	const char *name = np->name;
 	int i;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents != 2)
 		return;
 
diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
index 144d47ecfe63c6eb..3817ea865ca258ec 100644
--- a/drivers/clk/at91/clk-smd.c
+++ b/drivers/clk/at91/clk-smd.c
@@ -150,7 +150,7 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
 	const char *parent_names[SMD_SOURCE_MAX];
 	const char *name = np->name;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
 		return;
 
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index 0b7c3e8840bae0eb..b0cbd2b1ff595702 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -378,7 +378,7 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
 	const char *parent_names[USB_SOURCE_MAX];
 	const char *name = np->name;
 
-	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
 		return;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/5] clk: st: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25 ` Geert Uytterhoeven
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Stephen Boyd, Russell King
  Cc: linux-clk, kernel, linux-omap, linux-arm-kernel, Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/st/clk-flexgen.c | 2 +-
 drivers/clk/st/clkgen-mux.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index 409ed4b0b569ff60..657ca14ba709a64b 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -245,7 +245,7 @@ static const char ** __init flexgen_get_parents(struct device_node *np,
 	const char **parents;
 	int nparents, i;
 
-	nparents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	nparents = of_clk_get_parent_count(np);
 	if (WARN_ON(nparents <= 0))
 		return NULL;
 
diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c
index 80aa77dbf660cf0c..4fbe6e099587c054 100644
--- a/drivers/clk/st/clkgen-mux.c
+++ b/drivers/clk/st/clkgen-mux.c
@@ -26,7 +26,7 @@ static const char ** __init clkgen_mux_get_parents(struct device_node *np,
 	const char **parents;
 	int nparents, i;
 
-	nparents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	nparents = of_clk_get_parent_count(np);
 	if (WARN_ON(nparents <= 0))
 		return ERR_PTR(-EINVAL);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/5] clk: st: Use of_clk_get_parent_count() instead of open coding
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/st/clk-flexgen.c | 2 +-
 drivers/clk/st/clkgen-mux.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index 409ed4b0b569ff60..657ca14ba709a64b 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -245,7 +245,7 @@ static const char ** __init flexgen_get_parents(struct device_node *np,
 	const char **parents;
 	int nparents, i;
 
-	nparents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	nparents = of_clk_get_parent_count(np);
 	if (WARN_ON(nparents <= 0))
 		return NULL;
 
diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c
index 80aa77dbf660cf0c..4fbe6e099587c054 100644
--- a/drivers/clk/st/clkgen-mux.c
+++ b/drivers/clk/st/clkgen-mux.c
@@ -26,7 +26,7 @@ static const char ** __init clkgen_mux_get_parents(struct device_node *np,
 	const char **parents;
 	int nparents, i;
 
-	nparents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	nparents = of_clk_get_parent_count(np);
 	if (WARN_ON(nparents <= 0))
 		return ERR_PTR(-EINVAL);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/5] clk: ti: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25 ` Geert Uytterhoeven
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Stephen Boyd, Russell King
  Cc: linux-clk, kernel, linux-omap, linux-arm-kernel, Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/ti/clockdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c
index 35fe1085480cf33d..b82ef07f34034105 100644
--- a/drivers/clk/ti/clockdomain.c
+++ b/drivers/clk/ti/clockdomain.c
@@ -32,7 +32,7 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)
 	int i;
 	int num_clks;
 
-	num_clks = of_count_phandle_with_args(node, "clocks", "#clock-cells");
+	num_clks = of_clk_get_parent_count(node);
 
 	for (i = 0; i < num_clks; i++) {
 		clk = of_clk_get(node, i);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/5] clk: ti: Use of_clk_get_parent_count() instead of open coding
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/ti/clockdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c
index 35fe1085480cf33d..b82ef07f34034105 100644
--- a/drivers/clk/ti/clockdomain.c
+++ b/drivers/clk/ti/clockdomain.c
@@ -32,7 +32,7 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)
 	int i;
 	int num_clks;
 
-	num_clks = of_count_phandle_with_args(node, "clocks", "#clock-cells");
+	num_clks = of_clk_get_parent_count(node);
 
 	for (i = 0; i < num_clks; i++) {
 		clk = of_clk_get(node, i);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/5] [RFC] clk: Provide dummy of_clk_get_parent_count() for !OF/!CCF
  2015-05-29  9:25 ` Geert Uytterhoeven
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Stephen Boyd, Russell King
  Cc: linux-clk, kernel, linux-omap, linux-arm-kernel, Geert Uytterhoeven

Provide dummy implementations of of_clk_get_parent_count() for the
cases where CONFIG_OF or CONFIG_COMMON_CLK are not set.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is an RFC, as
  1. Dummies are needed in two places,
  2. We don't have any dummies yet for the !CCF case.
---
 include/linux/clk-provider.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 5378c2aba4d2eaec..d56bb0c6dd982c32 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -651,6 +651,10 @@ static inline struct clk *of_clk_src_onecell_get(
 {
 	return ERR_PTR(-ENOENT);
 }
+static inline int of_clk_get_parent_count(struct device_node *np)
+{
+	return -ENOENT;
+}
 static inline const char *of_clk_get_parent_name(struct device_node *np,
 						 int index)
 {
@@ -696,5 +700,10 @@ struct dentry *clk_debugfs_add_file(struct clk_hw *hw, char *name, umode_t mode,
 				void *data, const struct file_operations *fops);
 #endif
 
-#endif /* CONFIG_COMMON_CLK */
+#else /* !CONFIG_COMMON_CLK */
+static inline int of_clk_get_parent_count(struct device_node *np)
+{
+	return -ENOENT;
+}
+#endif /* !CONFIG_COMMON_CLK */
 #endif /* CLK_PROVIDER_H */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/5] [RFC] clk: Provide dummy of_clk_get_parent_count() for !OF/!CCF
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

Provide dummy implementations of of_clk_get_parent_count() for the
cases where CONFIG_OF or CONFIG_COMMON_CLK are not set.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is an RFC, as
  1. Dummies are needed in two places,
  2. We don't have any dummies yet for the !CCF case.
---
 include/linux/clk-provider.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 5378c2aba4d2eaec..d56bb0c6dd982c32 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -651,6 +651,10 @@ static inline struct clk *of_clk_src_onecell_get(
 {
 	return ERR_PTR(-ENOENT);
 }
+static inline int of_clk_get_parent_count(struct device_node *np)
+{
+	return -ENOENT;
+}
 static inline const char *of_clk_get_parent_name(struct device_node *np,
 						 int index)
 {
@@ -696,5 +700,10 @@ struct dentry *clk_debugfs_add_file(struct clk_hw *hw, char *name, umode_t mode,
 				void *data, const struct file_operations *fops);
 #endif
 
-#endif /* CONFIG_COMMON_CLK */
+#else /* !CONFIG_COMMON_CLK */
+static inline int of_clk_get_parent_count(struct device_node *np)
+{
+	return -ENOENT;
+}
+#endif /* !CONFIG_COMMON_CLK */
 #endif /* CLK_PROVIDER_H */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25 ` Geert Uytterhoeven
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Stephen Boyd, Russell King
  Cc: linux-clk, kernel, linux-omap, linux-arm-kernel, Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is an RFC, as it depends on "[RFC] clk: Provide dummy
of_clk_get_parent_count() for !OF/!CCF".
---
 arch/arm/common/timer-sp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 19211324772f387c..be87a5d480ffb655 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -21,6 +21,7 @@
 #include <linux/clk.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -234,7 +235,7 @@ static void __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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
@ 2015-05-29  9:25   ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-05-29  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is an RFC, as it depends on "[RFC] clk: Provide dummy
of_clk_get_parent_count() for !OF/!CCF".
---
 arch/arm/common/timer-sp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 19211324772f387c..be87a5d480ffb655 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -21,6 +21,7 @@
 #include <linux/clk.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -234,7 +235,7 @@ static void __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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] clk: at91: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25   ` Geert Uytterhoeven
@ 2015-05-30  7:43     ` Boris Brezillon
  -1 siblings, 0 replies; 26+ messages in thread
From: Boris Brezillon @ 2015-05-30  7:43 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Maxime Coquelin, Patrice Chotard, Tero Kristo, Mike Turquette,
	Stephen Boyd, Russell King, linux-clk, kernel, linux-omap,
	linux-arm-kernel

On Fri, 29 May 2015 11:25:45 +0200
Geert Uytterhoeven <geert+renesas@glider.be> wrote:

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/clk/at91/clk-main.c         | 2 +-
>  drivers/clk/at91/clk-master.c       | 2 +-
>  drivers/clk/at91/clk-programmable.c | 2 +-
>  drivers/clk/at91/clk-slow.c         | 4 ++--
>  drivers/clk/at91/clk-smd.c          | 2 +-
>  drivers/clk/at91/clk-usb.c          | 2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
> index 59fa3cc96c9eb341..c2400456a0447118 100644
> --- a/drivers/clk/at91/clk-main.c
> +++ b/drivers/clk/at91/clk-main.c
> @@ -614,7 +614,7 @@ void __init of_at91sam9x5_clk_main_setup(struct device_node *np,
>  	const char *name = np->name;
>  	int i;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > 2)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
> index c1af80bcdf2082c8..f98eafe9b12dc92d 100644
> --- a/drivers/clk/at91/clk-master.c
> +++ b/drivers/clk/at91/clk-master.c
> @@ -224,7 +224,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
>  	const char *name = np->name;
>  	struct clk_master_characteristics *characteristics;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
> index 86c8a073dcc32a20..8c86c0f7847a55a0 100644
> --- a/drivers/clk/at91/clk-programmable.c
> +++ b/drivers/clk/at91/clk-programmable.c
> @@ -237,7 +237,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
>  	const char *name;
>  	struct device_node *progclknp;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
> index 2f13bd5246b5563e..98a84a865fe1cf1b 100644
> --- a/drivers/clk/at91/clk-slow.c
> +++ b/drivers/clk/at91/clk-slow.c
> @@ -373,7 +373,7 @@ void __init of_at91sam9x5_clk_slow_setup(struct device_node *np,
>  	const char *name = np->name;
>  	int i;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > 2)
>  		return;
>  
> @@ -451,7 +451,7 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
>  	const char *name = np->name;
>  	int i;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents != 2)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
> index 144d47ecfe63c6eb..3817ea865ca258ec 100644
> --- a/drivers/clk/at91/clk-smd.c
> +++ b/drivers/clk/at91/clk-smd.c
> @@ -150,7 +150,7 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
>  	const char *parent_names[SMD_SOURCE_MAX];
>  	const char *name = np->name;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
> index 0b7c3e8840bae0eb..b0cbd2b1ff595702 100644
> --- a/drivers/clk/at91/clk-usb.c
> +++ b/drivers/clk/at91/clk-usb.c
> @@ -378,7 +378,7 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
>  	const char *parent_names[USB_SOURCE_MAX];
>  	const char *name = np->name;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
>  		return;
>  



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/5] clk: at91: Use of_clk_get_parent_count() instead of open coding
@ 2015-05-30  7:43     ` Boris Brezillon
  0 siblings, 0 replies; 26+ messages in thread
From: Boris Brezillon @ 2015-05-30  7:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 29 May 2015 11:25:45 +0200
Geert Uytterhoeven <geert+renesas@glider.be> wrote:

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/clk/at91/clk-main.c         | 2 +-
>  drivers/clk/at91/clk-master.c       | 2 +-
>  drivers/clk/at91/clk-programmable.c | 2 +-
>  drivers/clk/at91/clk-slow.c         | 4 ++--
>  drivers/clk/at91/clk-smd.c          | 2 +-
>  drivers/clk/at91/clk-usb.c          | 2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
> index 59fa3cc96c9eb341..c2400456a0447118 100644
> --- a/drivers/clk/at91/clk-main.c
> +++ b/drivers/clk/at91/clk-main.c
> @@ -614,7 +614,7 @@ void __init of_at91sam9x5_clk_main_setup(struct device_node *np,
>  	const char *name = np->name;
>  	int i;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > 2)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
> index c1af80bcdf2082c8..f98eafe9b12dc92d 100644
> --- a/drivers/clk/at91/clk-master.c
> +++ b/drivers/clk/at91/clk-master.c
> @@ -224,7 +224,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
>  	const char *name = np->name;
>  	struct clk_master_characteristics *characteristics;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
> index 86c8a073dcc32a20..8c86c0f7847a55a0 100644
> --- a/drivers/clk/at91/clk-programmable.c
> +++ b/drivers/clk/at91/clk-programmable.c
> @@ -237,7 +237,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
>  	const char *name;
>  	struct device_node *progclknp;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
> index 2f13bd5246b5563e..98a84a865fe1cf1b 100644
> --- a/drivers/clk/at91/clk-slow.c
> +++ b/drivers/clk/at91/clk-slow.c
> @@ -373,7 +373,7 @@ void __init of_at91sam9x5_clk_slow_setup(struct device_node *np,
>  	const char *name = np->name;
>  	int i;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > 2)
>  		return;
>  
> @@ -451,7 +451,7 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
>  	const char *name = np->name;
>  	int i;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents != 2)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
> index 144d47ecfe63c6eb..3817ea865ca258ec 100644
> --- a/drivers/clk/at91/clk-smd.c
> +++ b/drivers/clk/at91/clk-smd.c
> @@ -150,7 +150,7 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
>  	const char *parent_names[SMD_SOURCE_MAX];
>  	const char *name = np->name;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
>  		return;
>  
> diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
> index 0b7c3e8840bae0eb..b0cbd2b1ff595702 100644
> --- a/drivers/clk/at91/clk-usb.c
> +++ b/drivers/clk/at91/clk-usb.c
> @@ -378,7 +378,7 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
>  	const char *parent_names[USB_SOURCE_MAX];
>  	const char *name = np->name;
>  
> -	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> +	num_parents = of_clk_get_parent_count(np);
>  	if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
>  		return;
>  



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25   ` Geert Uytterhoeven
@ 2015-06-03 23:44     ` Stephen Boyd
  -1 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-03 23:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Russell King, linux-clk, kernel, linux-omap,
	linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This is an RFC, as it depends on "[RFC] clk: Provide dummy
> of_clk_get_parent_count() for !OF/!CCF".
> ---
>  arch/arm/common/timer-sp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
> index 19211324772f387c..be87a5d480ffb655 100644
> --- a/arch/arm/common/timer-sp.c
> +++ b/arch/arm/common/timer-sp.c
> @@ -21,6 +21,7 @@
>  #include <linux/clk.h>
>  #include <linux/clocksource.h>
>  #include <linux/clockchips.h>
> +#include <linux/clk-provider.h>

This looks weird. This is not a clock provider.

>  #include <linux/err.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
> @@ -234,7 +235,7 @@ static void __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) {

So maybe it means if we want to expose of_clk_get_parent_count()
we should move it to some other header file (of_clk.h?). And then
maybe we should always compile said helpers if OF=y and
HAVE_CLK=y.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
@ 2015-06-03 23:44     ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-03 23:44 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This is an RFC, as it depends on "[RFC] clk: Provide dummy
> of_clk_get_parent_count() for !OF/!CCF".
> ---
>  arch/arm/common/timer-sp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
> index 19211324772f387c..be87a5d480ffb655 100644
> --- a/arch/arm/common/timer-sp.c
> +++ b/arch/arm/common/timer-sp.c
> @@ -21,6 +21,7 @@
>  #include <linux/clk.h>
>  #include <linux/clocksource.h>
>  #include <linux/clockchips.h>
> +#include <linux/clk-provider.h>

This looks weird. This is not a clock provider.

>  #include <linux/err.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
> @@ -234,7 +235,7 @@ static void __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) {

So maybe it means if we want to expose of_clk_get_parent_count()
we should move it to some other header file (of_clk.h?). And then
maybe we should always compile said helpers if OF=y and
HAVE_CLK=y.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
  2015-06-03 23:44     ` Stephen Boyd
@ 2015-06-04  7:26       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-06-04  7:26 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Geert Uytterhoeven, Boris Brezillon, Maxime Coquelin,
	Patrice Chotard, Tero Kristo, Mike Turquette, Russell King,
	linux-clk, kernel, linux-omap, linux-arm-kernel

Hi Stephen,

On Thu, Jun 4, 2015 at 1:44 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 05/29, Geert Uytterhoeven wrote:
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> This is an RFC, as it depends on "[RFC] clk: Provide dummy
>> of_clk_get_parent_count() for !OF/!CCF".
>> ---
>>  arch/arm/common/timer-sp.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
>> index 19211324772f387c..be87a5d480ffb655 100644
>> --- a/arch/arm/common/timer-sp.c
>> +++ b/arch/arm/common/timer-sp.c
>> @@ -21,6 +21,7 @@
>>  #include <linux/clk.h>
>>  #include <linux/clocksource.h>
>>  #include <linux/clockchips.h>
>> +#include <linux/clk-provider.h>
>
> This looks weird. This is not a clock provider.

But that's where the declaration of of_clk_get_parent_count() lives...

>>  #include <linux/err.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/irq.h>
>> @@ -234,7 +235,7 @@ static void __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) {
>
> So maybe it means if we want to expose of_clk_get_parent_count()
> we should move it to some other header file (of_clk.h?). And then
> maybe we should always compile said helpers if OF=y and
> HAVE_CLK=y.

That makes sense.

Currently we have lots of of_clk_*() in <linux/clk-provider.h>, and a few
of_clk_get*() in <inux/clk.h>.
And the mysterious of_clk_set_defaults() in <linux/clk/clk-conf.h>.

All of_clk_get*() could be moved to a new <linux/of_clk.h>.

Alternatively, of_clk_get_parent_count() could just move to <linux/clk.h>?

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] 26+ messages in thread

* [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
@ 2015-06-04  7:26       ` Geert Uytterhoeven
  0 siblings, 0 replies; 26+ messages in thread
From: Geert Uytterhoeven @ 2015-06-04  7:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Stephen,

On Thu, Jun 4, 2015 at 1:44 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 05/29, Geert Uytterhoeven wrote:
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> This is an RFC, as it depends on "[RFC] clk: Provide dummy
>> of_clk_get_parent_count() for !OF/!CCF".
>> ---
>>  arch/arm/common/timer-sp.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
>> index 19211324772f387c..be87a5d480ffb655 100644
>> --- a/arch/arm/common/timer-sp.c
>> +++ b/arch/arm/common/timer-sp.c
>> @@ -21,6 +21,7 @@
>>  #include <linux/clk.h>
>>  #include <linux/clocksource.h>
>>  #include <linux/clockchips.h>
>> +#include <linux/clk-provider.h>
>
> This looks weird. This is not a clock provider.

But that's where the declaration of of_clk_get_parent_count() lives...

>>  #include <linux/err.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/irq.h>
>> @@ -234,7 +235,7 @@ static void __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) {
>
> So maybe it means if we want to expose of_clk_get_parent_count()
> we should move it to some other header file (of_clk.h?). And then
> maybe we should always compile said helpers if OF=y and
> HAVE_CLK=y.

That makes sense.

Currently we have lots of of_clk_*() in <linux/clk-provider.h>, and a few
of_clk_get*() in <inux/clk.h>.
And the mysterious of_clk_set_defaults() in <linux/clk/clk-conf.h>.

All of_clk_get*() could be moved to a new <linux/of_clk.h>.

Alternatively, of_clk_get_parent_count() could just move to <linux/clk.h>?

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] 26+ messages in thread

* Re: [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
  2015-06-04  7:26       ` Geert Uytterhoeven
@ 2015-06-04 18:14         ` Stephen Boyd
  -1 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 18:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Geert Uytterhoeven, Boris Brezillon, Maxime Coquelin,
	Patrice Chotard, Tero Kristo, Mike Turquette, Russell King,
	linux-clk, kernel, linux-omap, linux-arm-kernel

On 06/04, Geert Uytterhoeven wrote:
> Hi Stephen,
> 
> On Thu, Jun 4, 2015 at 1:44 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> > On 05/29, Geert Uytterhoeven wrote:
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >>  #include <linux/err.h>
> >>  #include <linux/interrupt.h>
> >>  #include <linux/irq.h>
> >> @@ -234,7 +235,7 @@ static void __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) {
> >
> > So maybe it means if we want to expose of_clk_get_parent_count()
> > we should move it to some other header file (of_clk.h?). And then
> > maybe we should always compile said helpers if OF=y and
> > HAVE_CLK=y.
> 
> That makes sense.
> 
> Currently we have lots of of_clk_*() in <linux/clk-provider.h>, and a few
> of_clk_get*() in <inux/clk.h>.
> And the mysterious of_clk_set_defaults() in <linux/clk/clk-conf.h>.
> 
> All of_clk_get*() could be moved to a new <linux/of_clk.h>.
> 
> Alternatively, of_clk_get_parent_count() could just move to <linux/clk.h>?

Hmm... of_clk_*() functions that return a struct clk * or work
with a struct clk * should stay within clk.h. But these ones in
clk-provider.h should probably move to a new of_clk.h file:

	of_clk_get_parent_count
	of_clk_get_parent_name
	of_clk_init

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding
@ 2015-06-04 18:14         ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/04, Geert Uytterhoeven wrote:
> Hi Stephen,
> 
> On Thu, Jun 4, 2015 at 1:44 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> > On 05/29, Geert Uytterhoeven wrote:
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >>  #include <linux/err.h>
> >>  #include <linux/interrupt.h>
> >>  #include <linux/irq.h>
> >> @@ -234,7 +235,7 @@ static void __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) {
> >
> > So maybe it means if we want to expose of_clk_get_parent_count()
> > we should move it to some other header file (of_clk.h?). And then
> > maybe we should always compile said helpers if OF=y and
> > HAVE_CLK=y.
> 
> That makes sense.
> 
> Currently we have lots of of_clk_*() in <linux/clk-provider.h>, and a few
> of_clk_get*() in <inux/clk.h>.
> And the mysterious of_clk_set_defaults() in <linux/clk/clk-conf.h>.
> 
> All of_clk_get*() could be moved to a new <linux/of_clk.h>.
> 
> Alternatively, of_clk_get_parent_count() could just move to <linux/clk.h>?

Hmm... of_clk_*() functions that return a struct clk * or work
with a struct clk * should stay within clk.h. But these ones in
clk-provider.h should probably move to a new of_clk.h file:

	of_clk_get_parent_count
	of_clk_get_parent_name
	of_clk_init

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] clk: at91: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25   ` Geert Uytterhoeven
@ 2015-06-04 20:52     ` Stephen Boyd
  -1 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 20:52 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Russell King, linux-clk, kernel, linux-omap,
	linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/5] clk: at91: Use of_clk_get_parent_count() instead of open coding
@ 2015-06-04 20:52     ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 20:52 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 3/5] clk: ti: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25   ` Geert Uytterhoeven
@ 2015-06-04 20:53     ` Stephen Boyd
  -1 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 20:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Russell King, linux-clk, kernel, linux-omap,
	linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 3/5] clk: ti: Use of_clk_get_parent_count() instead of open coding
@ 2015-06-04 20:53     ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 20:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/5] clk: st: Use of_clk_get_parent_count() instead of open coding
  2015-05-29  9:25   ` Geert Uytterhoeven
@ 2015-06-04 20:53     ` Stephen Boyd
  -1 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 20:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Boris Brezillon, Maxime Coquelin, Patrice Chotard, Tero Kristo,
	Mike Turquette, Russell King, linux-clk, kernel, linux-omap,
	linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 2/5] clk: st: Use of_clk_get_parent_count() instead of open coding
@ 2015-06-04 20:53     ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2015-06-04 20:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/29, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-06-04 20:53 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29  9:25 [PATCH 0/5] clk: Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
2015-05-29  9:25 ` Geert Uytterhoeven
2015-05-29  9:25 ` [PATCH 1/5] clk: at91: " Geert Uytterhoeven
2015-05-29  9:25   ` Geert Uytterhoeven
2015-05-30  7:43   ` Boris Brezillon
2015-05-30  7:43     ` Boris Brezillon
2015-06-04 20:52   ` Stephen Boyd
2015-06-04 20:52     ` Stephen Boyd
2015-05-29  9:25 ` [PATCH 2/5] clk: st: " Geert Uytterhoeven
2015-05-29  9:25   ` Geert Uytterhoeven
2015-06-04 20:53   ` Stephen Boyd
2015-06-04 20:53     ` Stephen Boyd
2015-05-29  9:25 ` [PATCH 3/5] clk: ti: " Geert Uytterhoeven
2015-05-29  9:25   ` Geert Uytterhoeven
2015-06-04 20:53   ` Stephen Boyd
2015-06-04 20:53     ` Stephen Boyd
2015-05-29  9:25 ` [PATCH 4/5] [RFC] clk: Provide dummy of_clk_get_parent_count() for !OF/!CCF Geert Uytterhoeven
2015-05-29  9:25   ` Geert Uytterhoeven
2015-05-29  9:25 ` [PATCH 5/5] [RFC] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
2015-05-29  9:25   ` Geert Uytterhoeven
2015-06-03 23:44   ` Stephen Boyd
2015-06-03 23:44     ` Stephen Boyd
2015-06-04  7:26     ` Geert Uytterhoeven
2015-06-04  7:26       ` Geert Uytterhoeven
2015-06-04 18:14       ` Stephen Boyd
2015-06-04 18:14         ` Stephen Boyd

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.