[PATCH 1/4] ACPI,PCI,IRQ: add PCI_USING penalty only if the link is initialized

From: Sinan Kaya
Date: Wed Sep 28 2016 - 18:54:10 EST


The change introduced in commit 103544d86976 ("ACPI,PCI,IRQ: reduce
resource requirements") removed PCI_USING penalty from
acpi_pci_link_allocate function as there is no longer a fixed size penalty
array for both PCI and IRQ interrupts. Instead PCI_USING is determined by
scanning all link objects' active value against the IRQ value we are
interested.

The original code would add the PCI_USING penalty only if the link
initialization is successful. The current code is blindly adding this
regardless of the link object initialization state.

Fixing this by adding an additional check.

Signed-off-by: Sinan Kaya <okaya@xxxxxxxxxxxxxx>
---
drivers/acpi/pci_link.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index c983bf7..1edda48 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -477,7 +477,8 @@ static int acpi_irq_pci_sharing_penalty(int irq)
* If a link is active, penalize its IRQ heavily
* so we try to choose a different IRQ.
*/
- if (link->irq.active && link->irq.active == irq)
+ if (link->irq.active && (link->irq.active == irq) &&
+ (link->irq.initialized == 1))
penalty += PIRQ_PENALTY_PCI_USING;

/*
--
1.9.1


--------------97707A6EB943ECEA41FEED52--