From a8e8f1d390f40565b89115e01b6e54738be9b8d2 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 3 Jan 2013 09:34:20 +0000 Subject: [PATCH] --- yaml --- r: 360019 b: refs/heads/master c: 42913c7992e9aca4deded016a05f6654e9b0807b h: refs/heads/master i: 360017: b6daceb8ec9133d4b4042d273b5059e201422146 360015: e63266164778ce45a1508f7a4147df5fe5b7ceab v: v3 --- [refs] | 2 +- .../arch/mips/kernel/cpufreq/loongson2_cpufreq.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index f20ea57375bb..33426a96c77e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0f3a05cb43e731b8cf861dee30e7e4bddd6c5ccc +refs/heads/master: 42913c7992e9aca4deded016a05f6654e9b0807b diff --git a/trunk/arch/mips/kernel/cpufreq/loongson2_cpufreq.c b/trunk/arch/mips/kernel/cpufreq/loongson2_cpufreq.c index bb51d3193ad4..3237c5235f9c 100644 --- a/trunk/arch/mips/kernel/cpufreq/loongson2_cpufreq.c +++ b/trunk/arch/mips/kernel/cpufreq/loongson2_cpufreq.c @@ -107,6 +107,8 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) { int i; + unsigned long rate; + int ret; if (!cpu_online(policy->cpu)) return -ENODEV; @@ -117,15 +119,22 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) return PTR_ERR(cpuclk); } - cpuclk->rate = cpu_clock_freq / 1000; - if (!cpuclk->rate) + rate = cpu_clock_freq / 1000; + if (!rate) { + clk_put(cpuclk); return -EINVAL; + } + ret = clk_set_rate(cpuclk, rate); + if (ret) { + clk_put(cpuclk); + return ret; + } /* clock table init */ for (i = 2; (loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) - loongson2_clockmod_table[i].frequency = (cpuclk->rate * i) / 8; + loongson2_clockmod_table[i].frequency = (rate * i) / 8; policy->cur = loongson2_cpufreq_get(policy->cpu);