Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[CELL] cbe_cpufreq: fix minor issues

Minor issues have been fixed:
* added a missing call to of_node_put()
* signedness of a function parameter
* added some line breaks
* changed global pmi_frequency_limit to a
per node pmi_slow_mode_limit array

Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

authored by

Christian Krafft and committed by
Arnd Bergmann
1e21fd5a e5ecc871

+40 -18
+40 -18
arch/powerpc/platforms/cell/cbe_cpufreq.c
··· 67 67 0x00003FC000000000ull, 68 68 }; 69 69 70 - static unsigned int pmi_frequency_limit = 0; 70 + static u8 pmi_slow_mode_limit[MAX_BE]; 71 71 72 72 /* 73 73 * hardware specific functions ··· 169 169 170 170 static int set_pmode(int cpu, unsigned int slow_mode) 171 171 { 172 + int rc; 172 173 #ifdef CONFIG_PPC_PMI 173 174 if (cbe_cpufreq_has_pmi) 174 - return set_pmode_pmi(cpu, slow_mode); 175 + rc = set_pmode_pmi(cpu, slow_mode); 176 + else 175 177 #endif 176 - return set_pmode_reg(cpu, slow_mode); 178 + rc = set_pmode_reg(cpu, slow_mode); 179 + 180 + pr_debug("register contains slow mode %d\n", get_pmode(cpu)); 181 + 182 + return rc; 177 183 } 178 184 179 185 static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg) 180 186 { 181 - u8 cpu; 182 - u8 cbe_pmode_new; 187 + u8 node; slow_mode; 183 188 184 189 BUG_ON(pmi_msg.type != PMI_TYPE_FREQ_CHANGE); 185 190 186 - cpu = cbe_node_to_cpu(pmi_msg.data1); 187 - cbe_pmode_new = pmi_msg.data2; 191 + node = pmi_msg.data1; 192 + slow_mode = pmi_msg.data2; 188 193 189 - pmi_frequency_limit = cbe_freqs[cbe_pmode_new].frequency; 194 + pmi_slow_mode_limit[node] = slow_mode; 190 195 191 - pr_debug("cbe_handle_pmi: max freq=%d\n", pmi_frequency_limit); 196 + pr_debug("cbe_handle_pmi: node: %d, max slow_mode=%d\n", slow_mode); 192 197 } 193 198 194 199 static int pmi_notifier(struct notifier_block *nb, 195 200 unsigned long event, void *data) 196 201 { 197 202 struct cpufreq_policy *policy = data; 203 + u8 node; 198 204 199 - if (pmi_frequency_limit) 200 - cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit); 205 + node = cbe_cpu_to_node(policy->cpu); 206 + 207 + pr_debug("got notified, event=%lu, node=%u\n", event, node); 208 + 209 + if (pmi_slow_mode_limit[node] != 0) { 210 + pr_debug("limiting node %d to slow mode %d\n", 211 + node, pmi_slow_mode_limit[node]); 212 + 213 + cpufreq_verify_within_limits(policy, 0, 214 + cbe_freqs[pmi_slow_mode_limit[node]].frequency); 215 + } 201 216 202 217 return 0; 203 218 } ··· 247 232 248 233 max_freqp = of_get_property(cpu, "clock-frequency", NULL); 249 234 235 + of_node_put(cpu); 236 + 250 237 if (!max_freqp) 251 238 return -EINVAL; 252 239 ··· 265 248 } 266 249 267 250 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 268 - /* if DEBUG is enabled set_pmode() measures the correct latency of a transition */ 251 + 252 + /* if DEBUG is enabled set_pmode() measures the latency 253 + * of a transition */ 269 254 policy->cpuinfo.transition_latency = 25000; 270 255 271 256 cur_pmode = get_pmode(policy->cpu); ··· 281 262 282 263 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); 283 264 284 - 285 - /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ 265 + /* this ensures that policy->cpuinfo_min 266 + * and policy->cpuinfo_max are set correctly */ 286 267 return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); 287 268 } 288 269 ··· 298 279 } 299 280 300 281 301 - static int cbe_cpufreq_target(struct cpufreq_policy *policy, unsigned int target_freq, 302 - unsigned int relation) 282 + static int cbe_cpufreq_target(struct cpufreq_policy *policy, 283 + unsigned int target_freq, 284 + unsigned int relation) 303 285 { 304 286 int rc; 305 287 struct cpufreq_freqs freqs; 306 - int cbe_pmode_new; 288 + unsigned int cbe_pmode_new; 307 289 308 290 cpufreq_frequency_table_target(policy, 309 291 cbe_freqs, ··· 319 299 mutex_lock(&cbe_switch_mutex); 320 300 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 321 301 322 - pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", 302 + pr_debug("setting frequency for cpu %d to %d kHz, " \ 303 + "1/%d of max frequency\n", 323 304 policy->cpu, 324 305 cbe_freqs[cbe_pmode_new].frequency, 325 306 cbe_freqs[cbe_pmode_new].index); 326 307 327 308 rc = set_pmode(policy->cpu, cbe_pmode_new); 309 + 328 310 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 329 311 mutex_unlock(&cbe_switch_mutex); 330 312