From: Betty Dall <betty.dall@hp.com>
To: rjw@sisk.pl, bhelgaas@google.com, gong.chen@linux.intel.com,
greg.pearson@hp.com
Cc: ying.huang@intel.com, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
Betty Dall <betty.dall@hp.com>
Subject: [PATCH v3 2/6] PCI/AER: Factor out HEST device type matching
Date: Thu, 6 Jun 2013 12:10:47 -0600 [thread overview]
Message-ID: <1370542251-27387-3-git-send-email-betty.dall@hp.com> (raw)
In-Reply-To: <1370542251-27387-1-git-send-email-betty.dall@hp.com>
This factors out the matching of HEST structure type and PCIe device type
to improve readability. No functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Betty Dall <betty.dall@hp.com>
---
drivers/pci/pcie/aer/aerdrv_acpi.c | 35 +++++++++++++++++------------------
1 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index 4f798ab..e7ea573 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -29,6 +29,22 @@ static inline int hest_match_pci(struct acpi_hest_aer_common *p,
p->function == PCI_FUNC(pci->devfn));
}
+static inline bool hest_match_type(struct acpi_hest_header *hest_hdr,
+ struct pci_dev *dev)
+{
+ u16 hest_type = hest_hdr->type;
+ u8 pcie_type = pci_pcie_type(dev);
+
+ if ((hest_type == ACPI_HEST_TYPE_AER_ROOT_PORT &&
+ pcie_type == PCI_EXP_TYPE_ROOT_PORT) ||
+ (hest_type == ACPI_HEST_TYPE_AER_ENDPOINT &&
+ pcie_type == PCI_EXP_TYPE_ENDPOINT) ||
+ (hest_type == ACPI_HEST_TYPE_AER_BRIDGE &&
+ (dev->class >> 16) == PCI_BASE_CLASS_BRIDGE))
+ return true;
+ return false;
+}
+
struct aer_hest_parse_info {
struct pci_dev *pci_dev;
int firmware_first;
@@ -38,28 +54,11 @@ static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data)
{
struct aer_hest_parse_info *info = data;
struct acpi_hest_aer_common *p;
- u8 pcie_type = 0;
- u8 bridge = 0;
int ff = 0;
- switch (hest_hdr->type) {
- case ACPI_HEST_TYPE_AER_ROOT_PORT:
- pcie_type = PCI_EXP_TYPE_ROOT_PORT;
- break;
- case ACPI_HEST_TYPE_AER_ENDPOINT:
- pcie_type = PCI_EXP_TYPE_ENDPOINT;
- break;
- case ACPI_HEST_TYPE_AER_BRIDGE:
- if ((info->pci_dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
- bridge = 1;
- break;
- default:
- return 0;
- }
-
p = (struct acpi_hest_aer_common *)(hest_hdr + 1);
if (p->flags & ACPI_HEST_GLOBAL) {
- if ((pci_pcie_type(info->pci_dev) == pcie_type) || bridge)
+ if (hest_match_type(hest_hdr, info->pci_dev))
ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST);
} else
if (hest_match_pci(p, info->pci_dev))
next prev parent reply other threads:[~2013-06-06 18:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 18:10 [PATCH v3 0/6] PCI/ACPI: Fix firmware first error recovery with root port in reset Betty Dall
2013-06-06 18:10 ` [PATCH v3 1/6] PCI/AER: Don't parse HEST table for non-PCIe devices Betty Dall
2013-06-06 18:10 ` Betty Dall [this message]
2013-06-06 18:10 ` [PATCH v3 3/6] PCI/AER: Set dev->__aer_firmware_first only for matching devices Betty Dall
2013-06-06 18:10 ` [PATCH v2 4/6] PCI/ACPI: Move AER severity defines to aer.h Betty Dall
2013-06-06 18:23 ` Joe Perches
2013-06-06 19:28 ` Bjorn Helgaas
2013-06-06 20:19 ` Rafael J. Wysocki
2013-06-06 18:10 ` [PATCH v3 5/6] ACPI/APEI: Force fatal AER severity when bus has been reset Betty Dall
2013-06-06 18:10 ` [PATCH v3 6/6] PCI/AER: Provide reset_link for firmware first root port Betty Dall
2013-06-06 21:04 ` [PATCH v3 0/6] PCI/ACPI: Fix firmware first error recovery with root port in reset Bjorn Helgaas
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=1370542251-27387-3-git-send-email-betty.dall@hp.com \
--to=betty.dall@hp.com \
--cc=bhelgaas@google.com \
--cc=gong.chen@linux.intel.com \
--cc=greg.pearson@hp.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=ying.huang@intel.com \
/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
all inboxes | Powered by JetHome®