ACPI / APEI: Add is_ghes_type() to identify GHES sources
PATCH 1/1 ACPI / APEI: Add is_ghes_type() to identify GHES sources
From: Yazen Ghannam <[email protected]>
Refactor duplicated GHES identity logic into is_ghes_type().
--- drivers/acpi/apei/hest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/acpi/apei/hest.c +8 -4
@@ -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_ghes_type (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_ghes_type (hest_hdr)) (*count)++;return 0 ; }
@@ -153,8 +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_ghes_type (hest_hdr))return 0 ;if (!((struct acpi_hest_generic *)hest_hdr)->enabled)
Signature · 1 line
2.27.0
Rafael J. Wysocki
maintainerQuoted 8 lines · Terry Bowman
From: Yazen Ghannam <[email protected]>
Refactor duplicated GHES identity logic into
is_ghes_type().Signed-off-by Yazen Ghannam <[email protected]>Reviewed-by Robert Richter <[email protected]>Signed-off-by Terry Bowman <[email protected]>
If Terry was a co-author of the patch, please add a Co-developed-by:
tag for him in addition to the s-o-b. Otherwise the meaning of his s-o-b is unclear.
Boris, James, any objections to the changes below?
Quoted 44 lines
--- drivers/acpi/apei/hest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/acpi/apei/hest.c +8
-5@@ -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_ghes_type (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_ghes_type (hest_hdr)) (*count)++;return 0 ; }@@ -153,8 +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_ghes_type (hest_hdr))return 0 ;if (!((struct acpi_hest_generic *)hest_hdr)->enabled) --2.27.0
Borislav Petkov
reviewerQuoted 28 lines · Rafael J. Wysocki
Quoted 8 lines · Terry Bowman
From: Yazen Ghannam <[email protected]>
Refactor duplicated GHES identity logic into
is_ghes_type().Signed-off-by Yazen Ghannam <[email protected]>Reviewed-by Robert Richter <[email protected]>Signed-off-by Terry Bowman <[email protected]>If Terry was a co-author of the patch, please add a Co-developed-by:
tag for him in addition to the s-o-b. Otherwise the meaning of his s-o-b is unclear.Boris, James, any objections to the changes below?
Quoted 12 lines
--- drivers/acpi/apei/hest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/acpi/apei/hest.c +0
-0@@ -49,6 +49,12 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { [ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1, };
Quoted 4 lines
drivers/acpi/apei/hest.c static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { · line 55
Quoted 4 lines
drivers/acpi/apei/hest.c +4
-0+static inline bool is_ghes_type (struct acpi_hest_header *hest_hdr) +{ +return hest_hdr->type ==ACPI_HEST_TYPE_GENERIC_ERROR || + hest_hdr->type ==ACPI_HEST_TYPE_GENERIC_ERROR_V2 ;
I realize that this is supposed to test whether the table point to a generic hardware error source but everything in our code pertaining to GHES is called, well, "ghes".
So I'd prefer to call that is_generic_error() or so.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 4 lines · Borislav Petkov
Quoted 3 lines · Rafael J. Wysocki
Quoted 2 lines · Terry Bowman
From: Yazen Ghannam<[email protected]>
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Refactor duplicated GHES identity logic into
is_ghes_type().Signed-off-by Yazen Ghannam<[email protected]>Reviewed-by Robert Richter<[email protected]>Signed-off-by Terry Bowman<[email protected]>If Terry was a co-author of the patch, please add a Co-developed-by:
tag for him in addition to the s-o-b. Otherwise the meaning of his s-o-b is unclear.
I will add "co-developed-by" in V2.
Quoted 22 lines
Quoted 14 lines
Boris, James, any objections to the changes below?
Quoted 12 lines
--- drivers/acpi/apei/hest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/acpi/apei/hest.c +0
-0@@ -49,6 +49,12 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { [ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1, };Quoted 4 lines
drivers/acpi/apei/hest.c static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { · line 55
Quoted 4 lines
drivers/acpi/apei/hest.c +4
-0+static inline bool is_ghes_type (struct acpi_hest_header *hest_hdr) +{ +return hest_hdr->type ==ACPI_HEST_TYPE_GENERIC_ERROR || + hest_hdr->type ==ACPI_HEST_TYPE_GENERIC_ERROR_V2 ;I realize that this is supposed to test whether the table point to a generic hardware error source but everything in our code pertaining to GHES is called, well, "ghes".
Quoted 1 line
So I'd prefer to call that
is_generic_error()or so.
Sure, I'll rename is_ghes_type() to is_generic_error() in v2.
Quoted 2 lines
Thx.