linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17
@ 2014-06-23  2:25 Simon Horman
  2014-06-23  2:25 ` [PATCH] ARM: shmobile: Fix device node reference leakage in shmobile_init_delay Simon Horman
  2014-07-07  0:06 ` [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17 Olof Johansson
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Horman @ 2014-06-23  2:25 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Olof, Hi Kevin, Hi Arnd,

Please consider this Renesas ARM based SoC clock update for v3.17.


The following changes since commit 7171511eaec5bf23fb06078f59784a3a0626b38f:

  Linux 3.16-rc1 (2014-06-15 17:45:28 -1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git renesas-clock-for-v3.17

for you to fetch changes up to edc8fb1d6ebdfc4efa009073586d3567c3368475:

  ARM: shmobile: Fix device node reference leakage in shmobile_init_delay (2014-06-16 19:52:00 +0900)

----------------------------------------------------------------
Renesas ARM Based SoC Clock Updates for v3.17

* Fix device node reference leakage in shmobile_init_delay

----------------------------------------------------------------
Laurent Pinchart (1):
      ARM: shmobile: Fix device node reference leakage in shmobile_init_delay

 arch/arm/mach-shmobile/timer.c | 50 ++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 21 deletions(-)

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

* [PATCH] ARM: shmobile: Fix device node reference leakage in shmobile_init_delay
  2014-06-23  2:25 [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17 Simon Horman
@ 2014-06-23  2:25 ` Simon Horman
  2014-07-07  0:06 ` [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17 Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2014-06-23  2:25 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The of_find_compatible_node() function returns a new reference to the
found node. Instead of just adding of_node_put() calls, simplify the
code by moving the CPU identification logic inside the loop over cpu
nodes, in order to lower complexity from O(n) to O(1) by replacing
of_find_compatible_node() calls with of_device_is_compatible().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/timer.c | 50 ++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 68bc0b8..942efdc 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -59,29 +59,37 @@ void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
 
 void __init shmobile_init_delay(void)
 {
-	struct device_node *np, *parent;
-	u32 max_freq, freq;
-
-	max_freq = 0;
-
-	parent = of_find_node_by_path("/cpus");
-	if (parent) {
-		for_each_child_of_node(parent, np) {
-			if (!of_property_read_u32(np, "clock-frequency", &freq))
-				max_freq = max(max_freq, freq);
-		}
-		of_node_put(parent);
-	}
+	struct device_node *np, *cpus;
+	bool is_a8_a9 = false;
+	bool is_a15 = false;
+	u32 max_freq = 0;
+
+	cpus = of_find_node_by_path("/cpus");
+	if (!cpus)
+		return;
+
+	for_each_child_of_node(cpus, np) {
+		u32 freq;
+
+		if (!of_property_read_u32(np, "clock-frequency", &freq))
+			max_freq = max(max_freq, freq);
 
-	if (max_freq) {
-		if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
-			shmobile_setup_delay_hz(max_freq, 1, 3);
-		else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
-			shmobile_setup_delay_hz(max_freq, 1, 3);
-		else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15"))
-			if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
-				shmobile_setup_delay_hz(max_freq, 2, 4);
+		if (of_device_is_compatible(np, "arm,cortex-a8") ||
+		    of_device_is_compatible(np, "arm,cortex-a9"))
+			is_a8_a9 = true;
+		else if (of_device_is_compatible(np, "arm,cortex-a15"))
+			is_a15 = true;
 	}
+
+	of_node_put(cpus);
+
+	if (!max_freq)
+		return;
+
+	if (is_a8_a9)
+		shmobile_setup_delay_hz(max_freq, 1, 3);
+	else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
+		shmobile_setup_delay_hz(max_freq, 2, 4);
 }
 
 static void __init shmobile_late_time_init(void)
-- 
2.0.0.rc2

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

* [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17
  2014-06-23  2:25 [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17 Simon Horman
  2014-06-23  2:25 ` [PATCH] ARM: shmobile: Fix device node reference leakage in shmobile_init_delay Simon Horman
@ 2014-07-07  0:06 ` Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2014-07-07  0:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 23, 2014 at 11:25:16AM +0900, Simon Horman wrote:
> Hi Olof, Hi Kevin, Hi Arnd,
> 
> Please consider this Renesas ARM based SoC clock update for v3.17.
> 
> 
> The following changes since commit 7171511eaec5bf23fb06078f59784a3a0626b38f:
> 
>   Linux 3.16-rc1 (2014-06-15 17:45:28 -1000)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git renesas-clock-for-v3.17

Merged into next/soc.

-Olof

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

end of thread, other threads:[~2014-07-07  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-23  2:25 [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17 Simon Horman
2014-06-23  2:25 ` [PATCH] ARM: shmobile: Fix device node reference leakage in shmobile_init_delay Simon Horman
2014-07-07  0:06 ` [GIT PULL] Renesas ARM Based SoC Clock Updates for v3.17 Olof Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).