>From 82278a843e968ed98f18cd7a3cca515aabe2ab3a Mon Sep 17 00:00:00 2001 From: Sinan Kaya Date: Wed, 28 Sep 2016 19:08:34 -0400 Subject: [PATCH 1/2] ACPI, PCI, IRQ: remove double penalty calculation acpi_irq_get_penalty returns the penalty for both PCI and ISA penalties. Now that we don't have any storage place for PCI IRQs, we run into some math problem such as follows: The original code was as simple as this: acpi_isa_irq_penalty += penalty In order to hide PCI IRQ calculation difference vs. ISA IRQ difference, we created the acpi_irq_get_penalty function and replaced the above statement as acpi_isa_irq_penalty = acpi_irq_get_penalty() + penalty This is what acpi_irq_get_penalty returns. acpi_irq_get_penalty()= acpi_isa_irq_penalty + SCI penalty When you call acpi_penalize_isa_irq twice, you end up with: acpi_isa_irq_penalty = 2 * SCI penalty + acpi_isa_irq_penalty Fixing this by directly modifying acpi_isa_irq_penalty for the new penalty added. Signed-off-by: Sinan Kaya --- drivers/acpi/pci_link.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index c983bf7..59326ac 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -870,9 +870,10 @@ static int __init acpi_irq_penalty_update(char *str, int used) */ void acpi_penalize_isa_irq(int irq, int active) { + int penalty = active ? PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING; + if ((irq >= 0) && (irq < ARRAY_SIZE(acpi_isa_irq_penalty))) - acpi_isa_irq_penalty[irq] = acpi_irq_get_penalty(irq) + - (active ? PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING); + acpi_isa_irq_penalty[irq] += penalty; } bool acpi_isa_irq_available(int irq) -- 1.9.1