diff options
author | Dave Jones <davej@redhat.com> | 2006-10-18 00:41:48 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-10-18 00:41:48 -0400 |
commit | 95dd722700dc9bbb000d51cab07dde48720e9178 (patch) | |
tree | dccd5c12ad497b96f795251bdc8f3351bcf4a009 /arch | |
parent | 0a1230acb549593949397d331f1ecf07889dde20 (diff) |
[CPUFREQ] acpi-cpufreq: Fix up some CodingStyle nits leftover from the lindenting.
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 75 |
1 files changed, 34 insertions, 41 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 71b934067545..23f83531524d 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -92,7 +92,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data) | |||
92 | 92 | ||
93 | perf = data->acpi_data; | 93 | perf = data->acpi_data; |
94 | 94 | ||
95 | for (i = 0; i < perf->state_count; i++) { | 95 | for (i=0; i<perf->state_count; i++) { |
96 | if (value == perf->states[i].status) | 96 | if (value == perf->states[i].status) |
97 | return data->freq_table[i].frequency; | 97 | return data->freq_table[i].frequency; |
98 | } | 98 | } |
@@ -107,7 +107,7 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) | |||
107 | msr &= INTEL_MSR_RANGE; | 107 | msr &= INTEL_MSR_RANGE; |
108 | perf = data->acpi_data; | 108 | perf = data->acpi_data; |
109 | 109 | ||
110 | for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { | 110 | for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { |
111 | if (msr == perf->states[data->freq_table[i].index].status) | 111 | if (msr == perf->states[data->freq_table[i].index].status) |
112 | return data->freq_table[i].frequency; | 112 | return data->freq_table[i].frequency; |
113 | } | 113 | } |
@@ -128,25 +128,23 @@ static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data) | |||
128 | 128 | ||
129 | static void wrport(u16 port, u8 bit_width, u32 value) | 129 | static void wrport(u16 port, u8 bit_width, u32 value) |
130 | { | 130 | { |
131 | if (bit_width <= 8) { | 131 | if (bit_width <= 8) |
132 | outb(value, port); | 132 | outb(value, port); |
133 | } else if (bit_width <= 16) { | 133 | else if (bit_width <= 16) |
134 | outw(value, port); | 134 | outw(value, port); |
135 | } else if (bit_width <= 32) { | 135 | else if (bit_width <= 32) |
136 | outl(value, port); | 136 | outl(value, port); |
137 | } | ||
138 | } | 137 | } |
139 | 138 | ||
140 | static void rdport(u16 port, u8 bit_width, u32 * ret) | 139 | static void rdport(u16 port, u8 bit_width, u32 * ret) |
141 | { | 140 | { |
142 | *ret = 0; | 141 | *ret = 0; |
143 | if (bit_width <= 8) { | 142 | if (bit_width <= 8) |
144 | *ret = inb(port); | 143 | *ret = inb(port); |
145 | } else if (bit_width <= 16) { | 144 | else if (bit_width <= 16) |
146 | *ret = inw(port); | 145 | *ret = inw(port); |
147 | } else if (bit_width <= 32) { | 146 | else if (bit_width <= 32) |
148 | *ret = inl(port); | 147 | *ret = inl(port); |
149 | } | ||
150 | } | 148 | } |
151 | 149 | ||
152 | struct msr_addr { | 150 | struct msr_addr { |
@@ -202,7 +200,7 @@ static void do_drv_write(struct drv_cmd *cmd) | |||
202 | } | 200 | } |
203 | } | 201 | } |
204 | 202 | ||
205 | static inline void drv_read(struct drv_cmd *cmd) | 203 | static void drv_read(struct drv_cmd *cmd) |
206 | { | 204 | { |
207 | cpumask_t saved_mask = current->cpus_allowed; | 205 | cpumask_t saved_mask = current->cpus_allowed; |
208 | cmd->val = 0; | 206 | cmd->val = 0; |
@@ -210,7 +208,6 @@ static inline void drv_read(struct drv_cmd *cmd) | |||
210 | set_cpus_allowed(current, cmd->mask); | 208 | set_cpus_allowed(current, cmd->mask); |
211 | do_drv_read(cmd); | 209 | do_drv_read(cmd); |
212 | set_cpus_allowed(current, saved_mask); | 210 | set_cpus_allowed(current, saved_mask); |
213 | |||
214 | } | 211 | } |
215 | 212 | ||
216 | static void drv_write(struct drv_cmd *cmd) | 213 | static void drv_write(struct drv_cmd *cmd) |
@@ -323,11 +320,10 @@ static unsigned int get_measured_perf(unsigned int cpu) | |||
323 | mperf_cur.split.lo >>= shift_count; | 320 | mperf_cur.split.lo >>= shift_count; |
324 | } | 321 | } |
325 | 322 | ||
326 | if (aperf_cur.split.lo && mperf_cur.split.lo) { | 323 | if (aperf_cur.split.lo && mperf_cur.split.lo) |
327 | perf_percent = (aperf_cur.split.lo * 100) / mperf_cur.split.lo; | 324 | perf_percent = (aperf_cur.split.lo * 100) / mperf_cur.split.lo; |
328 | } else { | 325 | else |
329 | perf_percent = 0; | 326 | perf_percent = 0; |
330 | } | ||
331 | 327 | ||
332 | #else | 328 | #else |
333 | if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) { | 329 | if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) { |
@@ -336,11 +332,10 @@ static unsigned int get_measured_perf(unsigned int cpu) | |||
336 | mperf_cur.whole >>= shift_count; | 332 | mperf_cur.whole >>= shift_count; |
337 | } | 333 | } |
338 | 334 | ||
339 | if (aperf_cur.whole && mperf_cur.whole) { | 335 | if (aperf_cur.whole && mperf_cur.whole) |
340 | perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole; | 336 | perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole; |
341 | } else { | 337 | else |
342 | perf_percent = 0; | 338 | perf_percent = 0; |
343 | } | ||
344 | 339 | ||
345 | #endif | 340 | #endif |
346 | 341 | ||
@@ -377,7 +372,7 @@ static unsigned int check_freqs(cpumask_t mask, unsigned int freq, | |||
377 | unsigned int cur_freq; | 372 | unsigned int cur_freq; |
378 | unsigned int i; | 373 | unsigned int i; |
379 | 374 | ||
380 | for (i = 0; i < 100; i++) { | 375 | for (i=0; i<100; i++) { |
381 | cur_freq = extract_freq(get_cur_val(mask), data); | 376 | cur_freq = extract_freq(get_cur_val(mask), data); |
382 | if (cur_freq == freq) | 377 | if (cur_freq == freq) |
383 | return 1; | 378 | return 1; |
@@ -403,7 +398,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, | |||
403 | dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); | 398 | dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu); |
404 | 399 | ||
405 | if (unlikely(data == NULL || | 400 | if (unlikely(data == NULL || |
406 | data->acpi_data == NULL || data->freq_table == NULL)) { | 401 | data->acpi_data == NULL || data->freq_table == NULL)) { |
407 | return -ENODEV; | 402 | return -ENODEV; |
408 | } | 403 | } |
409 | 404 | ||
@@ -507,15 +502,15 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) | |||
507 | unsigned long freq; | 502 | unsigned long freq; |
508 | unsigned long freqn = perf->states[0].core_frequency * 1000; | 503 | unsigned long freqn = perf->states[0].core_frequency * 1000; |
509 | 504 | ||
510 | for (i = 0; i < (perf->state_count - 1); i++) { | 505 | for (i=0; i<(perf->state_count-1); i++) { |
511 | freq = freqn; | 506 | freq = freqn; |
512 | freqn = perf->states[i + 1].core_frequency * 1000; | 507 | freqn = perf->states[i+1].core_frequency * 1000; |
513 | if ((2 * cpu_khz) > (freqn + freq)) { | 508 | if ((2 * cpu_khz) > (freqn + freq)) { |
514 | perf->state = i; | 509 | perf->state = i; |
515 | return freq; | 510 | return freq; |
516 | } | 511 | } |
517 | } | 512 | } |
518 | perf->state = perf->state_count - 1; | 513 | perf->state = perf->state_count-1; |
519 | return freqn; | 514 | return freqn; |
520 | } else { | 515 | } else { |
521 | /* assume CPU is at P0... */ | 516 | /* assume CPU is at P0... */ |
@@ -608,9 +603,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
608 | data->acpi_data = acpi_perf_data[cpu]; | 603 | data->acpi_data = acpi_perf_data[cpu]; |
609 | drv_data[cpu] = data; | 604 | drv_data[cpu] = data; |
610 | 605 | ||
611 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { | 606 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) |
612 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | 607 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; |
613 | } | ||
614 | 608 | ||
615 | result = acpi_processor_register_performance(data->acpi_data, cpu); | 609 | result = acpi_processor_register_performance(data->acpi_data, cpu); |
616 | if (result) | 610 | if (result) |
@@ -618,8 +612,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
618 | 612 | ||
619 | perf = data->acpi_data; | 613 | perf = data->acpi_data; |
620 | policy->shared_type = perf->shared_type; | 614 | policy->shared_type = perf->shared_type; |
615 | |||
621 | /* | 616 | /* |
622 | * Will let policy->cpus know about dependency only when software | 617 | * Will let policy->cpus know about dependency only when software |
623 | * coordination is required. | 618 | * coordination is required. |
624 | */ | 619 | */ |
625 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || | 620 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || |
@@ -667,9 +662,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
667 | goto err_unreg; | 662 | goto err_unreg; |
668 | } | 663 | } |
669 | 664 | ||
670 | data->freq_table = | 665 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * |
671 | kmalloc(sizeof(struct cpufreq_frequency_table) * | 666 | (perf->state_count+1), GFP_KERNEL); |
672 | (perf->state_count + 1), GFP_KERNEL); | ||
673 | if (!data->freq_table) { | 667 | if (!data->freq_table) { |
674 | result = -ENOMEM; | 668 | result = -ENOMEM; |
675 | goto err_unreg; | 669 | goto err_unreg; |
@@ -677,7 +671,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
677 | 671 | ||
678 | /* detect transition latency */ | 672 | /* detect transition latency */ |
679 | policy->cpuinfo.transition_latency = 0; | 673 | policy->cpuinfo.transition_latency = 0; |
680 | for (i = 0; i < perf->state_count; i++) { | 674 | for (i=0; i<perf->state_count; i++) { |
681 | if ((perf->states[i].transition_latency * 1000) > | 675 | if ((perf->states[i].transition_latency * 1000) > |
682 | policy->cpuinfo.transition_latency) | 676 | policy->cpuinfo.transition_latency) |
683 | policy->cpuinfo.transition_latency = | 677 | policy->cpuinfo.transition_latency = |
@@ -687,9 +681,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
687 | 681 | ||
688 | data->max_freq = perf->states[0].core_frequency * 1000; | 682 | data->max_freq = perf->states[0].core_frequency * 1000; |
689 | /* table init */ | 683 | /* table init */ |
690 | for (i = 0; i < perf->state_count; i++) { | 684 | for (i=0; i<perf->state_count; i++) { |
691 | if (i > 0 && perf->states[i].core_frequency == | 685 | if (i>0 && perf->states[i].core_frequency == |
692 | perf->states[i - 1].core_frequency) | 686 | perf->states[i-1].core_frequency) |
693 | continue; | 687 | continue; |
694 | 688 | ||
695 | data->freq_table[valid_states].index = i; | 689 | data->freq_table[valid_states].index = i; |
@@ -700,9 +694,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
700 | data->freq_table[perf->state_count].frequency = CPUFREQ_TABLE_END; | 694 | data->freq_table[perf->state_count].frequency = CPUFREQ_TABLE_END; |
701 | 695 | ||
702 | result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); | 696 | result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); |
703 | if (result) { | 697 | if (result) |
704 | goto err_freqfree; | 698 | goto err_freqfree; |
705 | } | ||
706 | 699 | ||
707 | switch (data->cpu_feature) { | 700 | switch (data->cpu_feature) { |
708 | case ACPI_ADR_SPACE_SYSTEM_IO: | 701 | case ACPI_ADR_SPACE_SYSTEM_IO: |
@@ -724,9 +717,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
724 | if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) { | 717 | if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) { |
725 | unsigned int ecx; | 718 | unsigned int ecx; |
726 | ecx = cpuid_ecx(6); | 719 | ecx = cpuid_ecx(6); |
727 | if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) { | 720 | if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) |
728 | acpi_cpufreq_driver.getavg = get_measured_perf; | 721 | acpi_cpufreq_driver.getavg = get_measured_perf; |
729 | } | ||
730 | } | 722 | } |
731 | 723 | ||
732 | dprintk("CPU%u - ACPI performance management activated.\n", cpu); | 724 | dprintk("CPU%u - ACPI performance management activated.\n", cpu); |
@@ -747,11 +739,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
747 | 739 | ||
748 | return result; | 740 | return result; |
749 | 741 | ||
750 | err_freqfree: | 742 | err_freqfree: |
751 | kfree(data->freq_table); | 743 | kfree(data->freq_table); |
752 | err_unreg: | 744 | err_unreg: |
753 | acpi_processor_unregister_performance(perf, cpu); | 745 | acpi_processor_unregister_performance(perf, cpu); |
754 | err_free: | 746 | err_free: |
755 | kfree(data); | 747 | kfree(data); |
756 | drv_data[cpu] = NULL; | 748 | drv_data[cpu] = NULL; |
757 | 749 | ||
@@ -827,7 +819,8 @@ static void __exit acpi_cpufreq_exit(void) | |||
827 | 819 | ||
828 | module_param(acpi_pstate_strict, uint, 0644); | 820 | module_param(acpi_pstate_strict, uint, 0644); |
829 | MODULE_PARM_DESC(acpi_pstate_strict, | 821 | MODULE_PARM_DESC(acpi_pstate_strict, |
830 | "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes."); | 822 | "value 0 or non-zero. non-zero -> strict ACPI checks are " |
823 | "performed during frequency changes."); | ||
831 | 824 | ||
832 | late_initcall(acpi_cpufreq_init); | 825 | late_initcall(acpi_cpufreq_init); |
833 | module_exit(acpi_cpufreq_exit); | 826 | module_exit(acpi_cpufreq_exit); |