diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-05-18 19:31:34 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-20 07:40:54 -0400 |
commit | 15bac20bd8a039e9acb274785be82772e1237eed (patch) | |
tree | 81ff9581d36a2fa078f2273c1f1dc67931995b4c | |
parent | 31dce14a3269843f98ce1bc37d0c91b22f1991ee (diff) |
x86, ioapic: Remove duplicate code for saving/restoring RTEs
Code flow for enabling interrupt-remapping has its own routines
for saving and restoring io-apic RTE's. ioapic suspend/resume
code flow also has similar routines. Remove the duplicate code.
Tested-by: Daniel J Blueman <daniel.blueman@gmail.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/20110518233157.673130611@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 08b794d07a52..4fc544dcf7f1 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2887,37 +2887,11 @@ static int __init io_apic_bug_finalize(void) | |||
2887 | 2887 | ||
2888 | late_initcall(io_apic_bug_finalize); | 2888 | late_initcall(io_apic_bug_finalize); |
2889 | 2889 | ||
2890 | static void suspend_ioapic(int ioapic_id) | 2890 | static void resume_ioapic_id(int ioapic_id) |
2891 | { | 2891 | { |
2892 | struct IO_APIC_route_entry *saved_data = ioapic_saved_data[ioapic_id]; | ||
2893 | int i; | ||
2894 | |||
2895 | if (!saved_data) | ||
2896 | return; | ||
2897 | |||
2898 | for (i = 0; i < nr_ioapic_registers[ioapic_id]; i++) | ||
2899 | saved_data[i] = ioapic_read_entry(ioapic_id, i); | ||
2900 | } | ||
2901 | |||
2902 | static int ioapic_suspend(void) | ||
2903 | { | ||
2904 | int ioapic_id; | ||
2905 | |||
2906 | for (ioapic_id = 0; ioapic_id < nr_ioapics; ioapic_id++) | ||
2907 | suspend_ioapic(ioapic_id); | ||
2908 | |||
2909 | return 0; | ||
2910 | } | ||
2911 | |||
2912 | static void resume_ioapic(int ioapic_id) | ||
2913 | { | ||
2914 | struct IO_APIC_route_entry *saved_data = ioapic_saved_data[ioapic_id]; | ||
2915 | unsigned long flags; | 2892 | unsigned long flags; |
2916 | union IO_APIC_reg_00 reg_00; | 2893 | union IO_APIC_reg_00 reg_00; |
2917 | int i; | ||
2918 | 2894 | ||
2919 | if (!saved_data) | ||
2920 | return; | ||
2921 | 2895 | ||
2922 | raw_spin_lock_irqsave(&ioapic_lock, flags); | 2896 | raw_spin_lock_irqsave(&ioapic_lock, flags); |
2923 | reg_00.raw = io_apic_read(ioapic_id, 0); | 2897 | reg_00.raw = io_apic_read(ioapic_id, 0); |
@@ -2926,8 +2900,6 @@ static void resume_ioapic(int ioapic_id) | |||
2926 | io_apic_write(ioapic_id, 0, reg_00.raw); | 2900 | io_apic_write(ioapic_id, 0, reg_00.raw); |
2927 | } | 2901 | } |
2928 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | 2902 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); |
2929 | for (i = 0; i < nr_ioapic_registers[ioapic_id]; i++) | ||
2930 | ioapic_write_entry(ioapic_id, i, saved_data[i]); | ||
2931 | } | 2903 | } |
2932 | 2904 | ||
2933 | static void ioapic_resume(void) | 2905 | static void ioapic_resume(void) |
@@ -2935,11 +2907,13 @@ static void ioapic_resume(void) | |||
2935 | int ioapic_id; | 2907 | int ioapic_id; |
2936 | 2908 | ||
2937 | for (ioapic_id = nr_ioapics - 1; ioapic_id >= 0; ioapic_id--) | 2909 | for (ioapic_id = nr_ioapics - 1; ioapic_id >= 0; ioapic_id--) |
2938 | resume_ioapic(ioapic_id); | 2910 | resume_ioapic_id(ioapic_id); |
2911 | |||
2912 | restore_ioapic_entries(); | ||
2939 | } | 2913 | } |
2940 | 2914 | ||
2941 | static struct syscore_ops ioapic_syscore_ops = { | 2915 | static struct syscore_ops ioapic_syscore_ops = { |
2942 | .suspend = ioapic_suspend, | 2916 | .suspend = save_ioapic_entries, |
2943 | .resume = ioapic_resume, | 2917 | .resume = ioapic_resume, |
2944 | }; | 2918 | }; |
2945 | 2919 | ||