aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-12-08 21:31:06 -0700
committerLen Brown <len.brown@intel.com>2008-12-30 21:34:53 -0500
commit3b1ea18d3b3542b55861d7f968ded705e3bc2aa6 (patch)
tree6e0b4198e2e6b7d5552a93c30daacba2e7f3d3ea
parentbeba8a643d7f774cf27c3c92a51b99cebf787415 (diff)
ACPI: PCI: use positive logic to simplify code
This doesn't change anything functionally; it just changes tests so we test for success instead of failure. This makes the code read more easily and allows us to remove the "!entry" in the while loop condition. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/pci_irq.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 28338227dd5..e42481f6449 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -384,16 +384,15 @@ acpi_pci_irq_lookup(struct pci_dev *dev, int pin)
struct acpi_prt_entry *entry;
entry = acpi_pci_irq_find_prt_entry(dev, pin);
- if (!entry) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No %s[%c] _PRT entry\n",
+ if (entry) {
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %s[%c] _PRT entry\n",
pci_name(dev), pin_name(pin)));
- return NULL;
+ return entry;
}
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %s[%c] _PRT entry\n",
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No %s[%c] _PRT entry\n",
pci_name(dev), pin_name(pin)));
-
- return entry;
+ return NULL;
}
static struct acpi_prt_entry *
@@ -408,7 +407,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, int pin)
* Attempt to derive an IRQ for this device from a parent bridge's
* PCI interrupt routing entry (eg. yenta bridge and add-in card bridge).
*/
- while (!entry && bridge->bus->self) {
+ while (bridge->bus->self) {
pin = (((pin - 1) + PCI_SLOT(bridge->devfn)) % 4) + 1;
bridge = bridge->bus->self;
@@ -425,18 +424,18 @@ acpi_pci_irq_derive(struct pci_dev *dev, int pin)
}
entry = acpi_pci_irq_lookup(bridge, pin);
+ if (entry) {
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Derived GSI for %s INT %c from %s\n",
+ pci_name(dev), pin_name(orig_pin),
+ pci_name(bridge)));
+ return entry;
+ }
}
- if (!entry) {
- dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n",
- pin_name(orig_pin));
- return NULL;
- }
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derived GSI for %s INT %c from %s\n",
- pci_name(dev), pin_name(orig_pin), pci_name(bridge)));
-
- return entry;
+ dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n",
+ pin_name(orig_pin));
+ return NULL;
}
/*