diff options
author | Christoph Lameter <cl@linux.com> | 2011-03-12 06:51:12 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-03-29 04:18:30 -0400 |
commit | 9d42a53e0f46505b39494041d514372235817e15 (patch) | |
tree | 1a4f87d700097cb03c1c6b9fdc98496849a971c9 /drivers/acpi | |
parent | fe5042138b6fc60edde3b60025078884c2eb71ac (diff) |
acpi throttling: Use this_cpu_has and simplify code current cpu
With the this_cpu_xx we no longer need to pass an acpi
structure to the msr management code. Simplifies code and improves
performance.
NOTE: This code is x86 specific (see #ifdef CONFIG_X86) but not under
arch/x86.
Signed-off-by: Christoph Lameter <cl@linux.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/processor_throttling.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index fa84e9744330..6f2c6d914cbc 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -710,20 +710,14 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) | |||
710 | } | 710 | } |
711 | 711 | ||
712 | #ifdef CONFIG_X86 | 712 | #ifdef CONFIG_X86 |
713 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | 713 | static int acpi_throttling_rdmsr(u64 *value) |
714 | u64 *value) | ||
715 | { | 714 | { |
716 | struct cpuinfo_x86 *c; | ||
717 | u64 msr_high, msr_low; | 715 | u64 msr_high, msr_low; |
718 | unsigned int cpu; | ||
719 | u64 msr = 0; | 716 | u64 msr = 0; |
720 | int ret = -1; | 717 | int ret = -1; |
721 | 718 | ||
722 | cpu = pr->id; | 719 | if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) || |
723 | c = &cpu_data(cpu); | 720 | !this_cpu_has(X86_FEATURE_ACPI)) { |
724 | |||
725 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
726 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
727 | printk(KERN_ERR PREFIX | 721 | printk(KERN_ERR PREFIX |
728 | "HARDWARE addr space,NOT supported yet\n"); | 722 | "HARDWARE addr space,NOT supported yet\n"); |
729 | } else { | 723 | } else { |
@@ -738,18 +732,13 @@ static int acpi_throttling_rdmsr(struct acpi_processor *pr, | |||
738 | return ret; | 732 | return ret; |
739 | } | 733 | } |
740 | 734 | ||
741 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value) | 735 | static int acpi_throttling_wrmsr(u64 value) |
742 | { | 736 | { |
743 | struct cpuinfo_x86 *c; | ||
744 | unsigned int cpu; | ||
745 | int ret = -1; | 737 | int ret = -1; |
746 | u64 msr; | 738 | u64 msr; |
747 | 739 | ||
748 | cpu = pr->id; | 740 | if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) || |
749 | c = &cpu_data(cpu); | 741 | !this_cpu_has(X86_FEATURE_ACPI)) { |
750 | |||
751 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
752 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
753 | printk(KERN_ERR PREFIX | 742 | printk(KERN_ERR PREFIX |
754 | "HARDWARE addr space,NOT supported yet\n"); | 743 | "HARDWARE addr space,NOT supported yet\n"); |
755 | } else { | 744 | } else { |
@@ -761,15 +750,14 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value) | |||
761 | return ret; | 750 | return ret; |
762 | } | 751 | } |
763 | #else | 752 | #else |
764 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | 753 | static int acpi_throttling_rdmsr(u64 *value) |
765 | u64 *value) | ||
766 | { | 754 | { |
767 | printk(KERN_ERR PREFIX | 755 | printk(KERN_ERR PREFIX |
768 | "HARDWARE addr space,NOT supported yet\n"); | 756 | "HARDWARE addr space,NOT supported yet\n"); |
769 | return -1; | 757 | return -1; |
770 | } | 758 | } |
771 | 759 | ||
772 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value) | 760 | static int acpi_throttling_wrmsr(u64 value) |
773 | { | 761 | { |
774 | printk(KERN_ERR PREFIX | 762 | printk(KERN_ERR PREFIX |
775 | "HARDWARE addr space,NOT supported yet\n"); | 763 | "HARDWARE addr space,NOT supported yet\n"); |
@@ -801,7 +789,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr, | |||
801 | ret = 0; | 789 | ret = 0; |
802 | break; | 790 | break; |
803 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 791 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
804 | ret = acpi_throttling_rdmsr(pr, value); | 792 | ret = acpi_throttling_rdmsr(value); |
805 | break; | 793 | break; |
806 | default: | 794 | default: |
807 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 795 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
@@ -834,7 +822,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr, | |||
834 | ret = 0; | 822 | ret = 0; |
835 | break; | 823 | break; |
836 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 824 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
837 | ret = acpi_throttling_wrmsr(pr, value); | 825 | ret = acpi_throttling_wrmsr(value); |
838 | break; | 826 | break; |
839 | default: | 827 | default: |
840 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 828 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |