diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2012-11-28 05:27:43 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-01-07 10:03:25 -0500 |
commit | 9291cf9d0c30f79758b3a0fe87ccd1d7bbb36f45 (patch) | |
tree | 4c087dd45173913958d40c06991f9ae2866dfd84 /drivers/cpufreq | |
parent | 3e27996ca876a4cf38b4821140819e962104f82c (diff) |
cpufreq: dbx500: Minor code cleanup
Some minor code cleanup and some minor changes to printed
error messages.
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/dbx500-cpufreq.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c index d974a8e32d85..d4cb78253a89 100644 --- a/drivers/cpufreq/dbx500-cpufreq.c +++ b/drivers/cpufreq/dbx500-cpufreq.c | |||
@@ -36,6 +36,7 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy, | |||
36 | { | 36 | { |
37 | struct cpufreq_freqs freqs; | 37 | struct cpufreq_freqs freqs; |
38 | unsigned int idx; | 38 | unsigned int idx; |
39 | int ret; | ||
39 | 40 | ||
40 | /* scale the target frequency to one of the extremes supported */ | 41 | /* scale the target frequency to one of the extremes supported */ |
41 | if (target_freq < policy->cpuinfo.min_freq) | 42 | if (target_freq < policy->cpuinfo.min_freq) |
@@ -44,10 +45,9 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy, | |||
44 | target_freq = policy->cpuinfo.max_freq; | 45 | target_freq = policy->cpuinfo.max_freq; |
45 | 46 | ||
46 | /* Lookup the next frequency */ | 47 | /* Lookup the next frequency */ |
47 | if (cpufreq_frequency_table_target | 48 | if (cpufreq_frequency_table_target(policy, freq_table, target_freq, |
48 | (policy, freq_table, target_freq, relation, &idx)) { | 49 | relation, &idx)) |
49 | return -EINVAL; | 50 | return -EINVAL; |
50 | } | ||
51 | 51 | ||
52 | freqs.old = policy->cur; | 52 | freqs.old = policy->cur; |
53 | freqs.new = freq_table[idx].frequency; | 53 | freqs.new = freq_table[idx].frequency; |
@@ -60,9 +60,12 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy, | |||
60 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 60 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
61 | 61 | ||
62 | /* update armss clk frequency */ | 62 | /* update armss clk frequency */ |
63 | if (clk_set_rate(armss_clk, freq_table[idx].frequency * 1000)) { | 63 | ret = clk_set_rate(armss_clk, freqs.new * 1000); |
64 | pr_err("dbx500-cpufreq: Failed to update armss clk\n"); | 64 | |
65 | return -EINVAL; | 65 | if (ret) { |
66 | pr_err("dbx500-cpufreq: Failed to set armss_clk to %d Hz: error %d\n", | ||
67 | freqs.new * 1000, ret); | ||
68 | return ret; | ||
66 | } | 69 | } |
67 | 70 | ||
68 | /* post change notification */ | 71 | /* post change notification */ |
@@ -97,7 +100,7 @@ static int __cpuinit dbx500_cpufreq_init(struct cpufreq_policy *policy) | |||
97 | if (!res) | 100 | if (!res) |
98 | cpufreq_frequency_table_get_attr(freq_table, policy->cpu); | 101 | cpufreq_frequency_table_get_attr(freq_table, policy->cpu); |
99 | else { | 102 | else { |
100 | pr_err("dbx500-cpufreq : Failed to read policy table\n"); | 103 | pr_err("dbx500-cpufreq: Failed to read policy table\n"); |
101 | return res; | 104 | return res; |
102 | } | 105 | } |
103 | 106 | ||
@@ -143,11 +146,11 @@ static int dbx500_cpufreq_probe(struct platform_device *pdev) | |||
143 | 146 | ||
144 | armss_clk = clk_get(&pdev->dev, "armss"); | 147 | armss_clk = clk_get(&pdev->dev, "armss"); |
145 | if (IS_ERR(armss_clk)) { | 148 | if (IS_ERR(armss_clk)) { |
146 | pr_err("dbx500-cpufreq : Failed to get armss clk\n"); | 149 | pr_err("dbx500-cpufreq: Failed to get armss clk\n"); |
147 | return PTR_ERR(armss_clk); | 150 | return PTR_ERR(armss_clk); |
148 | } | 151 | } |
149 | 152 | ||
150 | pr_info("dbx500-cpufreq : Available frequencies:\n"); | 153 | pr_info("dbx500-cpufreq: Available frequencies:\n"); |
151 | while (freq_table[i].frequency != CPUFREQ_TABLE_END) { | 154 | while (freq_table[i].frequency != CPUFREQ_TABLE_END) { |
152 | pr_info(" %d Mhz\n", freq_table[i].frequency/1000); | 155 | pr_info(" %d Mhz\n", freq_table[i].frequency/1000); |
153 | i++; | 156 | i++; |
@@ -169,7 +172,6 @@ static int __init dbx500_cpufreq_register(void) | |||
169 | if (!cpu_is_u8500_family()) | 172 | if (!cpu_is_u8500_family()) |
170 | return -ENODEV; | 173 | return -ENODEV; |
171 | 174 | ||
172 | pr_info("cpufreq for DBX500 started\n"); | ||
173 | return platform_driver_register(&dbx500_cpufreq_plat_driver); | 175 | return platform_driver_register(&dbx500_cpufreq_plat_driver); |
174 | } | 176 | } |
175 | device_initcall(dbx500_cpufreq_register); | 177 | device_initcall(dbx500_cpufreq_register); |