From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH 07/20] ACPI: PCI: add a helper to convert _PRT INTx pin number to name
Date: Mon, 08 Dec 2008 21:30:36 -0700 [thread overview]
Message-ID: <20081209043036.26415.23011.stgit@bob.kio> (raw)
In-Reply-To: <20081209042833.26415.24906.stgit@bob.kio>
This adds a helper function to convert INTx pin numbers from the _PRT
(0, 1, 2, 3) to the pin name ('A', 'B', 'C', 'D').
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/acpi/pci_irq.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 04b9df4..ccbb163 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -62,6 +62,11 @@ struct acpi_prt_list {
static struct acpi_prt_list acpi_prt;
static DEFINE_SPINLOCK(acpi_prt_lock);
+static inline char pin_name(int pin)
+{
+ return 'A' + pin;
+}
+
/* --------------------------------------------------------------------------
PCI IRQ Routing Table (PRT) Support
-------------------------------------------------------------------------- */
@@ -176,14 +181,14 @@ do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt)
entry->id.segment == quirk->segment &&
entry->id.bus == quirk->bus &&
entry->id.device == quirk->device &&
- entry->pin + 'A' == quirk->pin &&
+ pin_name(entry->pin) == quirk->pin &&
!strcmp(prt->source, quirk->source) &&
strlen(prt->source) >= strlen(quirk->actual_source)) {
printk(KERN_WARNING PREFIX "firmware reports "
"%04x:%02x:%02x PCI INT %c connected to %s; "
"changing to %s\n",
entry->id.segment, entry->id.bus,
- entry->id.device, 'A' + entry->pin,
+ entry->id.device, pin_name(entry->pin),
prt->source, quirk->actual_source);
strcpy(prt->source, quirk->actual_source);
}
@@ -237,8 +242,8 @@ acpi_pci_irq_add_entry(acpi_handle handle,
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
" %04x:%02x:%02x[%c] -> %s[%d]\n",
entry->id.segment, entry->id.bus,
- entry->id.device, ('A' + entry->pin), prt->source,
- entry->link.index));
+ entry->id.device, pin_name(entry->pin),
+ prt->source, entry->link.index));
spin_lock(&acpi_prt_lock);
list_add_tail(&entry->node, &acpi_prt.entries);
@@ -389,7 +394,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus,
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Searching for _PRT entry for %04x:%02x:%02x[%c]\n",
- segment, bus_nr, device, ('A' + pin)));
+ segment, bus_nr, device, pin_name(pin)));
entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
if (!entry) {
@@ -446,7 +451,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
if (irq < 0) {
dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n",
- 'A' + orig_pin);
+ pin_name(orig_pin));
return -1;
}
@@ -513,7 +518,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
* driver reported one, then use it. Exit in any case.
*/
if (gsi < 0) {
- dev_warn(&dev->dev, "PCI INT %c: no GSI", 'A' + pin);
+ dev_warn(&dev->dev, "PCI INT %c: no GSI", pin_name(pin));
/* Interrupt Line values above 0xF are forbidden */
if (dev->irq > 0 && (dev->irq <= 0xF)) {
printk(" - using IRQ %d\n", dev->irq);
@@ -529,7 +534,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
rc = acpi_register_gsi(gsi, triggering, polarity);
if (rc < 0) {
dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n",
- 'A' + pin);
+ pin_name(pin));
return rc;
}
dev->irq = rc;
@@ -540,7 +545,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
link_desc[0] = '\0';
dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n",
- 'A' + pin, link_desc, gsi,
+ pin_name(pin), link_desc, gsi,
(triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
(polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
@@ -587,6 +592,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
* (e.g. PCI_UNDEFINED_IRQ).
*/
- dev_info(&dev->dev, "PCI INT %c disabled\n", 'A' + pin);
+ dev_info(&dev->dev, "PCI INT %c disabled\n", pin_name(pin));
acpi_unregister_gsi(gsi);
}
next prev parent reply other threads:[~2008-12-09 4:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 4:30 [PATCH 00/20] ACPI: PCI: simplify _PRT handling Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 01/20] ACPI: PCI: use conventional PCI address format Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 02/20] ACPI: PCI: remove unnecessary null pointer checks Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 03/20] ACPI: PCI: simplify buffer management for evaluating _PRT Bjorn Helgaas
2008-12-31 4:15 ` [PATCH] ACPI: simplify buffer management for acpi_pci_bind() etc Len Brown
2008-12-09 4:30 ` [PATCH 04/20] ACPI: PCI: ignore _PRT function information Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 05/20] ACPI: PCI: fix GSI/IRQ naming confusion Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 06/20] ACPI: PCI: move struct acpi_prt_entry declaration out of public header file Bjorn Helgaas
2008-12-09 4:30 ` Bjorn Helgaas [this message]
2008-12-09 4:30 ` [PATCH 08/20] ACPI: PCI: always use the PCI INTx pin values, not the _PRT ones Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 09/20] ACPI: PCI: use 1-based encoding for _PRT quirks Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 10/20] ACPI: PCI: lookup _PRT entry by PCI dev and pin, not segment/bus/dev/pin Bjorn Helgaas
2008-12-09 4:30 ` [PATCH 11/20] ACPI: PCI: tweak _PRT lookup debug Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 12/20] ACPI: PCI: remove callback from acpi_pci_irq_lookup & acpi_pci_irq_derive Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 13/20] ACPI: PCI: use positive logic to simplify code Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 14/20] ACPI: PCI: follow typical PCI INTx swizzling pattern Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 15/20] ACPI: PCI: combine lookup and derive Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 16/20] ACPI: PCI: simplify list of _PRT entries Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 17/20] ACPI: PCI: simplify struct acpi_prt_entry Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 18/20] ACPI: PCI: expand acpi_pci_allocate_irq() and acpi_pci_free_irq() inline Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 19/20] ACPI: PCI: whitespace and useless initialization cleanup Bjorn Helgaas
2008-12-09 4:31 ` [PATCH 20/20] ACPI: PCI: add HP copyright Bjorn Helgaas
2008-12-31 4:17 ` [PATCH 00/20] ACPI: PCI: simplify _PRT handling Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081209043036.26415.23011.stgit@bob.kio \
--to=bjorn.helgaas@hp.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox