diff mbox

[PM-WIP_CPUFREQ,1/6,v2] OMAP2+: cpufreq: free up table on exit

Message ID 1305704266-17623-2-git-send-email-nm@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nishanth Menon May 18, 2011, 7:37 a.m. UTC
freq_table allocated by opp_init_cpufreq_table in omap_cpu_init
needs to be freed in omap_cpu_exit.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap2plus-cpufreq.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Kevin Hilman May 19, 2011, 10:26 a.m. UTC | #1
Nishanth Menon <nm@ti.com> writes:

> freq_table allocated by opp_init_cpufreq_table in omap_cpu_init
> needs to be freed in omap_cpu_exit.

Actually it needs to be freed by a corresponding OPP layer function.

IOW, what happens if the OPP core code switches from using kmalloc to
static tables, or something else?    The cleanup should be done by the
same layer that does the init/alloc.

Kevin

> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  arch/arm/mach-omap2/omap2plus-cpufreq.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> index d53ce23..e38ebb8 100644
> --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
> +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> @@ -26,6 +26,7 @@
>  #include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/opp.h>
> +#include <linux/slab.h>
>  #include <linux/cpu.h>
>  
>  #include <asm/system.h>
> @@ -216,6 +217,8 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
>  static int omap_cpu_exit(struct cpufreq_policy *policy)
>  {
>  	clk_exit_cpufreq_table(&freq_table);
> +	kfree(freq_table);
> +	freq_table = NULL;
>  	clk_put(mpu_clk);
>  	return 0;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nishanth Menon May 19, 2011, 1:48 p.m. UTC | #2
On Thu, May 19, 2011 at 05:26, Kevin Hilman <khilman@ti.com> wrote:
> Nishanth Menon <nm@ti.com> writes:
>
>> freq_table allocated by opp_init_cpufreq_table in omap_cpu_init
>> needs to be freed in omap_cpu_exit.
>
> Actually it needs to be freed by a corresponding OPP layer function.
>
> IOW, what happens if the OPP core code switches from using kmalloc to
> static tables, or something else?    The cleanup should be done by the
> same layer that does the init/alloc.

Agreed. We can introduce a new api in OPP layer to free up as well. I
will post a patch for it.
Regards,
Nishanth Menon

> Kevin
>
>> Signed-off-by: Nishanth Menon <nm@ti.com>
>> ---
>>  arch/arm/mach-omap2/omap2plus-cpufreq.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
>> index d53ce23..e38ebb8 100644
>> --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
>> +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
>> @@ -26,6 +26,7 @@
>>  #include <linux/clk.h>
>>  #include <linux/io.h>
>>  #include <linux/opp.h>
>> +#include <linux/slab.h>
>>  #include <linux/cpu.h>
>>
>>  #include <asm/system.h>
>> @@ -216,6 +217,8 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
>>  static int omap_cpu_exit(struct cpufreq_policy *policy)
>>  {
>>       clk_exit_cpufreq_table(&freq_table);
>> +     kfree(freq_table);
>> +     freq_table = NULL;
>>       clk_put(mpu_clk);
>>       return 0;
>>  }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index d53ce23..e38ebb8 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -26,6 +26,7 @@ 
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/opp.h>
+#include <linux/slab.h>
 #include <linux/cpu.h>
 
 #include <asm/system.h>
@@ -216,6 +217,8 @@  static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 static int omap_cpu_exit(struct cpufreq_policy *policy)
 {
 	clk_exit_cpufreq_table(&freq_table);
+	kfree(freq_table);
+	freq_table = NULL;
 	clk_put(mpu_clk);
 	return 0;
 }