Skip to contentSkip to conversation

ACPI / APEI: Add is_generic_error() to identify GHES sources

PATCH Applied Terry Bowman 3 participants 3 messages Jan 26, 2021 – Jan 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ACPI / APEI: Add is_generic_error() to identify GHES sources

From: Yazen Ghannam <[email protected]>

Refactor duplicated GHES identity logic into is_generic_error().

---
Changes in v2:
- Rename is_ghes_type() to is_generic_error()
- Add co-developed-by

 drivers/acpi/apei/hest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/acpi/apei/hest.c +8 -5
index 6e980fe16772..f220bb00e91b 100644
@@ -49,6 +49,12 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
 	[ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1,
 };
 
+static inline bool is_generic_error(struct acpi_hest_header *hest_hdr)
+{
+	return hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR ||
+	       hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2;
+}
+
 static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
 {
 	u16 hest_type = hest_hdr->type;
@@ -141,8 +147,7 @@ static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void
 {
 	int *count = data;
 
-	if (hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR ||
-	    hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2)
+	if (is_generic_error(hest_hdr))
 		(*count)++;
 	return 0;
 }
@@ -153,9 +158,7 @@ static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
 	struct ghes_arr *ghes_arr = data;
 	int rc, i;
 
-	if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR &&
-	    hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR_V2)
+	if (!is_generic_error(hest_hdr))
 		return 0;
 
 	if (!((struct acpi_hest_generic *)hest_hdr)->enabled)
--

2.27.0

reviewer Acked-by on v2 1/1
#1 lore raw
Quoted 44 lines · Terry Bowman

From: Yazen Ghannam <[email protected]>

Refactor duplicated GHES identity logic into is_generic_error().

---
Changes in v2:
- Rename is_ghes_type() to is_generic_error()
- Add co-developed-by

 drivers/acpi/apei/hest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/acpi/apei/hest.c +7 -2
index 6e980fe16772..f220bb00e91b 100644
@@ -49,6 +49,12 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
 	[ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1,
 };
 
+static inline bool is_generic_error(struct acpi_hest_header *hest_hdr)
+{
+	return hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR ||
+	       hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2;
+}
+
 static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
 {
 	u16 hest_type = hest_hdr->type;
@@ -141,8 +147,7 @@ static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void
 {
 	int *count = data;
 
-	if (hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR ||
-	    hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2)
+	if (is_generic_error(hest_hdr))
 		(*count)++;
 	return 0;
 }

drivers/acpi/apei/hest.c static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) · line 161

Quoted 10 lines
drivers/acpi/apei/hest.c +1 -3
@@ -153,9 +158,7 @@ static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
 	struct ghes_arr *ghes_arr = data;
 	int rc, i;
 
-	if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR &&
-	    hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR_V2)
+	if (!is_generic_error(hest_hdr))
 		return 0;
 
 	if (!((struct acpi_hest_generic *)hest_hdr)->enabled)
--
Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
maintainer Applied
#2 lore raw
Quoted 54 lines · Borislav Petkov
Quoted 52 lines · Terry Bowman

From: Yazen Ghannam <[email protected]>

Refactor duplicated GHES identity logic into is_generic_error().

---
Changes in v2:
- Rename is_ghes_type() to is_generic_error()
- Add co-developed-by

 drivers/acpi/apei/hest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/acpi/apei/hest.c +8 -4
index 6e980fe16772..f220bb00e91b 100644
@@ -49,6 +49,12 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
      [ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1,
 };
 
+static inline bool is_generic_error(struct acpi_hest_header *hest_hdr)
+{
+     return hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR ||
+            hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2;
+}
+
 static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
 {
      u16 hest_type = hest_hdr->type;
@@ -141,8 +147,7 @@ static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void
 {
      int *count = data;
 
-     if (hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR ||
-         hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2)
+     if (is_generic_error(hest_hdr))
              (*count)++;
      return 0;
 }
@@ -153,9 +158,7 @@ static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
      struct ghes_arr *ghes_arr = data;
      int rc, i;
 
-     if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR &&
-         hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR_V2)
+     if (!is_generic_error(hest_hdr))
              return 0;
 
Quoted 4 lines

drivers/acpi/apei/hest.c static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) · line 161

Quoted 2 lines
drivers/acpi/apei/hest.c +0 -1
      if (!((struct acpi_hest_generic *)hest_hdr)->enabled)
--

Applied as 5.12 material, thanks!