Skip to content

Commit 4ee2ec1

Browse files
Vikas C SajjanKAGA-KOKO
authored andcommitted
x86/acpi: Reduce code duplication in mp_override_legacy_irq()
The new function mp_register_ioapic_irq() is a subset of the code in mp_override_legacy_irq(). Replace the code duplication by invoking mp_register_ioapic_irq() from mp_override_legacy_irq(). Signed-off-by: Vikas C Sajjan <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 2527141 commit 4ee2ec1

File tree

1 file changed

+5
-22
lines changed

1 file changed

+5
-22
lines changed

arch/x86/kernel/acpi/boot.c

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,12 @@ acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long e
342342
#ifdef CONFIG_X86_IO_APIC
343343
#define MP_ISA_BUS 0
344344

345+
static int __init mp_register_ioapic_irq(u8 bus_irq, u8 polarity,
346+
u8 trigger, u32 gsi);
347+
345348
static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
346349
u32 gsi)
347350
{
348-
int ioapic;
349-
int pin;
350-
struct mpc_intsrc mp_irq;
351-
352351
/*
353352
* Check bus_irq boundary.
354353
*/
@@ -357,14 +356,6 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
357356
return;
358357
}
359358

360-
/*
361-
* Convert 'gsi' to 'ioapic.pin'.
362-
*/
363-
ioapic = mp_find_ioapic(gsi);
364-
if (ioapic < 0)
365-
return;
366-
pin = mp_find_ioapic_pin(ioapic, gsi);
367-
368359
/*
369360
* TBD: This check is for faulty timer entries, where the override
370361
* erroneously sets the trigger to level, resulting in a HUGE
@@ -373,16 +364,8 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
373364
if ((bus_irq == 0) && (trigger == 3))
374365
trigger = 1;
375366

376-
mp_irq.type = MP_INTSRC;
377-
mp_irq.irqtype = mp_INT;
378-
mp_irq.irqflag = (trigger << 2) | polarity;
379-
mp_irq.srcbus = MP_ISA_BUS;
380-
mp_irq.srcbusirq = bus_irq; /* IRQ */
381-
mp_irq.dstapic = mpc_ioapic_id(ioapic); /* APIC ID */
382-
mp_irq.dstirq = pin; /* INTIN# */
383-
384-
mp_save_irq(&mp_irq);
385-
367+
if (mp_register_ioapic_irq(bus_irq, polarity, trigger, gsi) < 0)
368+
return;
386369
/*
387370
* Reset default identity mapping if gsi is also an legacy IRQ,
388371
* otherwise there will be more than one entry with the same GSI

0 commit comments

Comments
 (0)