On 8 October 2012 13:48, Viresh Kumar <viresh.ku...@linaro.org> wrote:
> This patch tries to optimize vexpress_cpufreq_of_init() routine of vexpress_bl
> cpufreq driver.
>
> Following are the optimizations:
> - No need to allocate freq table array and copy it into struct
>   cpufreq_frequency_table. This removes the need of
>   _cpufreq_copy_table_from_array() routine too.
> - Use global freq_table variable instead of creating local copy freqtable.
> - replace kzalloc with kmalloc, as we are updating all the fields.
> - free_mem: path expects the clusters to be defined in ascending order, which
>   shouldn't be enforced. Instead try to free freq_table for all clusters.

Tested it today on TC2 and found to be working BUT with following fix :)

commit 3fb76ff621e023601bfff51326c8967c2fee0e7a
Author: Viresh Kumar <viresh.ku...@linaro.org>
Date:   Tue Oct 9 11:25:43 2012 +0530

    fixup! cpufreq: vexpress_bl: Optimize vexpress_cpufreq_of_init()
---
 drivers/cpufreq/vexpress_bL_cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/vexpress_bL_cpufreq.c
b/drivers/cpufreq/vexpress_bL_cpufreq.c
index 9af38cf..8b7ec18 100644
--- a/drivers/cpufreq/vexpress_bL_cpufreq.c
+++ b/drivers/cpufreq/vexpress_bL_cpufreq.c
@@ -151,7 +151,7 @@ static int vexpress_cpufreq_of_init(void)
        struct device_node *cluster = NULL;
        const struct property *pp;
        uint32_t cpu_opp_num;
-       int ret = 0, cluster_id = 0, len, i = -1;
+       int ret = 0, cluster_id = 0, len, i;
        const u32 *hwid;
        const __be32 *val;

@@ -176,7 +176,7 @@ static int vexpress_cpufreq_of_init(void)
                }

                val = pp->value;
-               while (++i < cpu_opp_num) {
+               for (i = 0; i < cpu_opp_num; i++) {
                        freq_table[cluster_id][i].index = i;
                        freq_table[cluster_id][i].frequency =
                                be32_to_cpup(val++) / 1000; /* in kHZ */


variable 'i' wasn't getting reset for the next loop on clusters.

--
viresh

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to