diff options
author | Feng Tang <feng.tang@intel.com> | 2010-12-08 02:18:57 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-12-09 15:52:06 -0500 |
commit | 0e3fa13f4ee110de007bca3bf395b77997319fc8 (patch) | |
tree | 801ee02881f6619822fae46e7ce52317d14d19d9 /arch/x86/kernel/apic | |
parent | 2d8009ba67f9503ceadf9d5a3b5637cee291ea8d (diff) |
x86: Further simplify mp_irq info handling
assign_to_mp_irq() is copying the struct mpc_intsrc members one by
one. That's silly. Use memcpy() and let the compiler figure it out.
Same for the identical function assign_to_mpc_intsrc()
mp_irq_mpc_intsrc_cmp() is comparing the struct members one by one,
but no caller ever checks the different return codes. Use memcmp()
instead.
Remove the extra printk in MP_ioapic_info()
Signed-off-by: Feng Tang <feng.tang@linux.intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: "Alan Cox <alan@linux.intel.com>
Cc: Len Brown <len.brown@intel.com>
LKML-Reference: <20101208151857.212f0018@feng-i7>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index c6b44f78ac14..bb61a552d8c6 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -126,39 +126,6 @@ static int __init parse_noapic(char *str) | |||
126 | } | 126 | } |
127 | early_param("noapic", parse_noapic); | 127 | early_param("noapic", parse_noapic); |
128 | 128 | ||
129 | static void assign_to_mp_irq(struct mpc_intsrc *m, | ||
130 | struct mpc_intsrc *mp_irq) | ||
131 | { | ||
132 | mp_irq->dstapic = m->dstapic; | ||
133 | mp_irq->type = m->type; | ||
134 | mp_irq->irqtype = m->irqtype; | ||
135 | mp_irq->irqflag = m->irqflag; | ||
136 | mp_irq->srcbus = m->srcbus; | ||
137 | mp_irq->srcbusirq = m->srcbusirq; | ||
138 | mp_irq->dstirq = m->dstirq; | ||
139 | } | ||
140 | |||
141 | static int mp_irq_mpc_intsrc_cmp(struct mpc_intsrc *mp_irq, | ||
142 | struct mpc_intsrc *m) | ||
143 | { | ||
144 | if (mp_irq->dstapic != m->dstapic) | ||
145 | return 1; | ||
146 | if (mp_irq->type != m->type) | ||
147 | return 2; | ||
148 | if (mp_irq->irqtype != m->irqtype) | ||
149 | return 3; | ||
150 | if (mp_irq->irqflag != m->irqflag) | ||
151 | return 4; | ||
152 | if (mp_irq->srcbus != m->srcbus) | ||
153 | return 5; | ||
154 | if (mp_irq->srcbusirq != m->srcbusirq) | ||
155 | return 6; | ||
156 | if (mp_irq->dstirq != m->dstirq) | ||
157 | return 7; | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ | 129 | /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ |
163 | void mp_save_irq(struct mpc_intsrc *m) | 130 | void mp_save_irq(struct mpc_intsrc *m) |
164 | { | 131 | { |
@@ -170,11 +137,11 @@ void mp_save_irq(struct mpc_intsrc *m) | |||
170 | m->srcbusirq, m->dstapic, m->dstirq); | 137 | m->srcbusirq, m->dstapic, m->dstirq); |
171 | 138 | ||
172 | for (i = 0; i < mp_irq_entries; i++) { | 139 | for (i = 0; i < mp_irq_entries; i++) { |
173 | if (!mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m)) | 140 | if (!memcmp(&mp_irqs[i], m, sizeof(*m))) |
174 | return; | 141 | return; |
175 | } | 142 | } |
176 | 143 | ||
177 | assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]); | 144 | memcpy(&mp_irqs[mp_irq_entries], m, sizeof(*m)); |
178 | if (++mp_irq_entries == MAX_IRQ_SOURCES) | 145 | if (++mp_irq_entries == MAX_IRQ_SOURCES) |
179 | panic("Max # of irq sources exceeded!!\n"); | 146 | panic("Max # of irq sources exceeded!!\n"); |
180 | } | 147 | } |