diff options
author | Feng Tang <feng.tang@intel.com> | 2010-11-18 22:33:35 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-12-09 15:52:06 -0500 |
commit | 2d8009ba67f9503ceadf9d5a3b5637cee291ea8d (patch) | |
tree | ab3ca6aacc84b5fb0135909e788c5b65830cd75f /arch/x86/platform/mrst | |
parent | 60d79fd99ff3b9c692b260a4d53a203f537c052a (diff) |
x86: Unify 3 similar ways of saving mp_irqs info
There are 3 places defining similar functions of saving IRQ vector
info into mp_irqs[] array: mmparse/acpi/mrst.
Replace the redundant code by a common function in io_apic.c as it's
only called when CONFIG_X86_IO_APIC=y
Signed-off-by: Feng Tang <feng.tang@intel.com>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <20101207133204.4d913c5a@feng-i7>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/platform/mrst')
-rw-r--r-- | arch/x86/platform/mrst/mrst.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index fee0b4914e0..ea6529e93c6 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
@@ -71,32 +71,6 @@ struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; | |||
71 | EXPORT_SYMBOL_GPL(sfi_mrtc_array); | 71 | EXPORT_SYMBOL_GPL(sfi_mrtc_array); |
72 | int sfi_mrtc_num; | 72 | int sfi_mrtc_num; |
73 | 73 | ||
74 | static inline void assign_to_mp_irq(struct mpc_intsrc *m, | ||
75 | struct mpc_intsrc *mp_irq) | ||
76 | { | ||
77 | memcpy(mp_irq, m, sizeof(struct mpc_intsrc)); | ||
78 | } | ||
79 | |||
80 | static inline int mp_irq_cmp(struct mpc_intsrc *mp_irq, | ||
81 | struct mpc_intsrc *m) | ||
82 | { | ||
83 | return memcmp(mp_irq, m, sizeof(struct mpc_intsrc)); | ||
84 | } | ||
85 | |||
86 | static void save_mp_irq(struct mpc_intsrc *m) | ||
87 | { | ||
88 | int i; | ||
89 | |||
90 | for (i = 0; i < mp_irq_entries; i++) { | ||
91 | if (!mp_irq_cmp(&mp_irqs[i], m)) | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]); | ||
96 | if (++mp_irq_entries == MAX_IRQ_SOURCES) | ||
97 | panic("Max # of irq sources exceeded!!\n"); | ||
98 | } | ||
99 | |||
100 | /* parse all the mtimer info to a static mtimer array */ | 74 | /* parse all the mtimer info to a static mtimer array */ |
101 | static int __init sfi_parse_mtmr(struct sfi_table_header *table) | 75 | static int __init sfi_parse_mtmr(struct sfi_table_header *table) |
102 | { | 76 | { |
@@ -130,7 +104,7 @@ static int __init sfi_parse_mtmr(struct sfi_table_header *table) | |||
130 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ | 104 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ |
131 | mp_irq.dstapic = MP_APIC_ALL; | 105 | mp_irq.dstapic = MP_APIC_ALL; |
132 | mp_irq.dstirq = pentry->irq; | 106 | mp_irq.dstirq = pentry->irq; |
133 | save_mp_irq(&mp_irq); | 107 | mp_save_irq(&mp_irq); |
134 | } | 108 | } |
135 | 109 | ||
136 | return 0; | 110 | return 0; |
@@ -200,7 +174,7 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table) | |||
200 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ | 174 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ |
201 | mp_irq.dstapic = MP_APIC_ALL; | 175 | mp_irq.dstapic = MP_APIC_ALL; |
202 | mp_irq.dstirq = pentry->irq; | 176 | mp_irq.dstirq = pentry->irq; |
203 | save_mp_irq(&mp_irq); | 177 | mp_save_irq(&mp_irq); |
204 | } | 178 | } |
205 | return 0; | 179 | return 0; |
206 | } | 180 | } |