Re: [PATCH v2 4/4] OMAP clock/CPUFreq: avoid leaking the CPUFreq frequency table

2010-01-06 Thread Kevin Hilman
Paul Walmsley p...@pwsan.com writes:

 OMAP2xxx uses a dynamically-allocated cpufreq_frequency_table array,
 so this patch ensures that it is freed if CPUFreq terminates.

 Signed-off-by: Paul Walmsley p...@pwsan.com

Minor nit, but shouldn't this be just folded into PATCH 3/4 since you
add the dynamic allocation there?

Kevin


 ---
  arch/arm/mach-omap2/clock2xxx.c |7 +++
  arch/arm/plat-omap/clock.c  |   10 ++
  arch/arm/plat-omap/cpu-omap.c   |1 +
  arch/arm/plat-omap/include/plat/clock.h |2 ++
  4 files changed, 20 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
 index 3bfd045..74f5586 100644
 --- a/arch/arm/mach-omap2/clock2xxx.c
 +++ b/arch/arm/mach-omap2/clock2xxx.c
 @@ -515,6 +515,12 @@ void omap2_clk_init_cpufreq_table(struct 
 cpufreq_frequency_table **table)
  
   *table = freq_table[0];
  }
 +
 +void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
 +{
 + kfree(freq_table);
 +}
 +
  #endif
  
  struct clk_functions omap2_clk_functions = {
 @@ -526,6 +532,7 @@ struct clk_functions omap2_clk_functions = {
   .clk_disable_unused = omap2_clk_disable_unused,
  #ifdef   CONFIG_CPU_FREQ
   .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
 + .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table,
  #endif
  };
  
 diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
 index a64d84c..d9f8c84 100644
 --- a/arch/arm/plat-omap/clock.c
 +++ b/arch/arm/plat-omap/clock.c
 @@ -329,6 +329,16 @@ void clk_init_cpufreq_table(struct 
 cpufreq_frequency_table **table)
   arch_clock-clk_init_cpufreq_table(table);
   spin_unlock_irqrestore(clockfw_lock, flags);
  }
 +
 +void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
 +{
 + unsigned long flags;
 +
 + spin_lock_irqsave(clockfw_lock, flags);
 + if (arch_clock-clk_exit_cpufreq_table)
 + arch_clock-clk_exit_cpufreq_table(table);
 + spin_unlock_irqrestore(clockfw_lock, flags);
 +}
  #endif
  
  /*-*/
 diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
 index f8ddbdd..6d3d333 100644
 --- a/arch/arm/plat-omap/cpu-omap.c
 +++ b/arch/arm/plat-omap/cpu-omap.c
 @@ -134,6 +134,7 @@ static int __init omap_cpu_init(struct cpufreq_policy 
 *policy)
  
  static int omap_cpu_exit(struct cpufreq_policy *policy)
  {
 + clk_exit_cpufreq_table(freq_table);
   clk_put(mpu_clk);
   return 0;
  }
 diff --git a/arch/arm/plat-omap/include/plat/clock.h 
 b/arch/arm/plat-omap/include/plat/clock.h
 index 309b6d1..94fe2a0 100644
 --- a/arch/arm/plat-omap/include/plat/clock.h
 +++ b/arch/arm/plat-omap/include/plat/clock.h
 @@ -119,6 +119,7 @@ struct clk_functions {
   void(*clk_disable_unused)(struct clk *clk);
  #ifdef CONFIG_CPU_FREQ
   void(*clk_init_cpufreq_table)(struct 
 cpufreq_frequency_table **);
 + void(*clk_exit_cpufreq_table)(struct 
 cpufreq_frequency_table **);
  #endif
  };
  
 @@ -135,6 +136,7 @@ extern unsigned long followparent_recalc(struct clk *clk);
  extern void clk_enable_init_clocks(void);
  #ifdef CONFIG_CPU_FREQ
  extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
 +extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
  #endif
  
  extern const struct clkops clkops_null;


 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] OMAP clock/CPUFreq: avoid leaking the CPUFreq frequency table

2010-01-06 Thread Paul Walmsley
On Wed, 6 Jan 2010, Kevin Hilman wrote:

 Paul Walmsley p...@pwsan.com writes:
 
  OMAP2xxx uses a dynamically-allocated cpufreq_frequency_table array,
  so this patch ensures that it is freed if CPUFreq terminates.
 
  Signed-off-by: Paul Walmsley p...@pwsan.com
 
 Minor nit, but shouldn't this be just folded into PATCH 3/4 since you
 add the dynamic allocation there?

I guess it's a matter of taste.  Maybe this is what Felipe was talking 
about.

The addition of clk_exit_cpufreq_table belongs in a separate patch.  So I 
will split that part out and put it earlier in the series.


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/4] OMAP clock/CPUFreq: avoid leaking the CPUFreq frequency table

2010-01-05 Thread Paul Walmsley
OMAP2xxx uses a dynamically-allocated cpufreq_frequency_table array,
so this patch ensures that it is freed if CPUFreq terminates.

Signed-off-by: Paul Walmsley p...@pwsan.com
---
 arch/arm/mach-omap2/clock2xxx.c |7 +++
 arch/arm/plat-omap/clock.c  |   10 ++
 arch/arm/plat-omap/cpu-omap.c   |1 +
 arch/arm/plat-omap/include/plat/clock.h |2 ++
 4 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index 3bfd045..74f5586 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -515,6 +515,12 @@ void omap2_clk_init_cpufreq_table(struct 
cpufreq_frequency_table **table)
 
*table = freq_table[0];
 }
+
+void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
+{
+   kfree(freq_table);
+}
+
 #endif
 
 struct clk_functions omap2_clk_functions = {
@@ -526,6 +532,7 @@ struct clk_functions omap2_clk_functions = {
.clk_disable_unused = omap2_clk_disable_unused,
 #ifdef CONFIG_CPU_FREQ
.clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
+   .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table,
 #endif
 };
 
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index a64d84c..d9f8c84 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -329,6 +329,16 @@ void clk_init_cpufreq_table(struct cpufreq_frequency_table 
**table)
arch_clock-clk_init_cpufreq_table(table);
spin_unlock_irqrestore(clockfw_lock, flags);
 }
+
+void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(clockfw_lock, flags);
+   if (arch_clock-clk_exit_cpufreq_table)
+   arch_clock-clk_exit_cpufreq_table(table);
+   spin_unlock_irqrestore(clockfw_lock, flags);
+}
 #endif
 
 /*-*/
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index f8ddbdd..6d3d333 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -134,6 +134,7 @@ static int __init omap_cpu_init(struct cpufreq_policy 
*policy)
 
 static int omap_cpu_exit(struct cpufreq_policy *policy)
 {
+   clk_exit_cpufreq_table(freq_table);
clk_put(mpu_clk);
return 0;
 }
diff --git a/arch/arm/plat-omap/include/plat/clock.h 
b/arch/arm/plat-omap/include/plat/clock.h
index 309b6d1..94fe2a0 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -119,6 +119,7 @@ struct clk_functions {
void(*clk_disable_unused)(struct clk *clk);
 #ifdef CONFIG_CPU_FREQ
void(*clk_init_cpufreq_table)(struct 
cpufreq_frequency_table **);
+   void(*clk_exit_cpufreq_table)(struct 
cpufreq_frequency_table **);
 #endif
 };
 
@@ -135,6 +136,7 @@ extern unsigned long followparent_recalc(struct clk *clk);
 extern void clk_enable_init_clocks(void);
 #ifdef CONFIG_CPU_FREQ
 extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
+extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
 #endif
 
 extern const struct clkops clkops_null;


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html