diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-13 17:42:53 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-13 17:52:47 -0500 |
commit | 3620437a73b0ba68bac9c4e8d0fc9b809efca521 (patch) | |
tree | 3790fa23a3b8d262aab59a97484456ce651de8f5 | |
parent | 8e7f8d0b30d4e3e30007b10eb2916d970b5f8c93 (diff) |
PCI/AER: Consolidate HEST error source parsers
aer_hest_parse() and aer_hest_parse_aff() are almost identical. We use
aer_hest_parse() to check the ACPI_HEST_FIRMWARE_FIRST flag for a specific
device, and we use aer_hest_parse_aff() to check to see if any device sets
the flag.
This drops aer_hest_parse_aff() and enhances aer_hest_parse() so it
collects the union of the PCIe ACPI_HEST_FIRMWARE_FIRST flag settings when
no specific device is supplied.
No functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Betty Dall <betty.dall@hp.com>
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_acpi.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index a23995749f1d..4d6991794fa2 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
@@ -70,6 +70,17 @@ static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data) | |||
70 | 70 | ||
71 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); | 71 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); |
72 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); | 72 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); |
73 | |||
74 | /* | ||
75 | * If no specific device is supplied, determine whether | ||
76 | * FIRMWARE_FIRST is set for *any* PCIe device. | ||
77 | */ | ||
78 | if (!info->pci_dev) { | ||
79 | info->firmware_first |= ff; | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | /* Otherwise, check the specific device */ | ||
73 | if (p->flags & ACPI_HEST_GLOBAL) { | 84 | if (p->flags & ACPI_HEST_GLOBAL) { |
74 | if (hest_match_type(hest_hdr, info->pci_dev)) | 85 | if (hest_match_type(hest_hdr, info->pci_dev)) |
75 | info->firmware_first = ff; | 86 | info->firmware_first = ff; |
@@ -109,30 +120,20 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev) | |||
109 | 120 | ||
110 | static bool aer_firmware_first; | 121 | static bool aer_firmware_first; |
111 | 122 | ||
112 | static int aer_hest_parse_aff(struct acpi_hest_header *hest_hdr, void *data) | ||
113 | { | ||
114 | struct acpi_hest_aer_common *p; | ||
115 | |||
116 | if (aer_firmware_first) | ||
117 | return 0; | ||
118 | |||
119 | if (!hest_source_is_pcie_aer(hest_hdr)) | ||
120 | return 0; | ||
121 | |||
122 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); | ||
123 | aer_firmware_first = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | /** | 123 | /** |
128 | * aer_acpi_firmware_first - Check if APEI should control AER. | 124 | * aer_acpi_firmware_first - Check if APEI should control AER. |
129 | */ | 125 | */ |
130 | bool aer_acpi_firmware_first(void) | 126 | bool aer_acpi_firmware_first(void) |
131 | { | 127 | { |
132 | static bool parsed = false; | 128 | static bool parsed = false; |
129 | struct aer_hest_parse_info info = { | ||
130 | .pci_dev = NULL, /* Check all PCIe devices */ | ||
131 | .firmware_first = 0, | ||
132 | }; | ||
133 | 133 | ||
134 | if (!parsed) { | 134 | if (!parsed) { |
135 | apei_hest_parse(aer_hest_parse_aff, NULL); | 135 | apei_hest_parse(aer_hest_parse, &info); |
136 | aer_firmware_first = info.firmware_first; | ||
136 | parsed = true; | 137 | parsed = true; |
137 | } | 138 | } |
138 | return aer_firmware_first; | 139 | return aer_firmware_first; |