All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / APEI: Add is_ghes_type() to identify GHES sources
@ 2021-01-22 18:03 Terry Bowman
  2021-01-25 16:41 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Terry Bowman @ 2021-01-22 18:03 UTC (permalink / raw)
  Cc: rjw, lenb, james.morse, tony.luck, bp, yazen.ghannam,
	terry.bowman, guohanjun, colin.king, linux-acpi, linux-kernel,
	jon.grimm

From: Yazen Ghannam <yazen.ghannam@amd.com>

Refactor duplicated GHES identity logic into is_ghes_type().

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Reviewed-by: Robert Richter <rrichter@amd.com>
Signed-off-by: Terry Bowman <terry.bowman@amd.com>
---
 drivers/acpi/apei/hest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
index 6e980fe16772..bd702e0ef339 100644
--- a/drivers/acpi/apei/hest.c
+++ b/drivers/acpi/apei/hest.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / APEI: Add is_ghes_type() to identify GHES sources
  2021-01-22 18:03 [PATCH] ACPI / APEI: Add is_ghes_type() to identify GHES sources Terry Bowman
@ 2021-01-25 16:41 ` Rafael J. Wysocki
  2021-01-25 17:14   ` Borislav Petkov
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-01-25 16:41 UTC (permalink / raw)
  To: Terry Bowman, Borislav Petkov, James Morse
  Cc: Rafael J. Wysocki, Len Brown, Tony Luck, Yazen Ghannam,
	Hanjun Guo, Colin Ian King, ACPI Devel Maling List,
	Linux Kernel Mailing List, jon.grimm

On Fri, Jan 22, 2021 at 7:05 PM Terry Bowman <terry.bowman@amd.com> wrote:
>
> From: Yazen Ghannam <yazen.ghannam@amd.com>
>
> Refactor duplicated GHES identity logic into is_ghes_type().
>
> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
> Reviewed-by: Robert Richter <rrichter@amd.com>
> Signed-off-by: Terry Bowman <terry.bowman@amd.com>

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?

> ---
>  drivers/acpi/apei/hest.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
> index 6e980fe16772..bd702e0ef339 100644
> --- a/drivers/acpi/apei/hest.c
> +++ b/drivers/acpi/apei/hest.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / APEI: Add is_ghes_type() to identify GHES sources
  2021-01-25 16:41 ` Rafael J. Wysocki
@ 2021-01-25 17:14   ` Borislav Petkov
  2021-01-25 22:42     ` Terry Bowman
  0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2021-01-25 17:14 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Terry Bowman, James Morse, Rafael J. Wysocki, Len Brown,
	Tony Luck, Yazen Ghannam, Hanjun Guo, Colin Ian King,
	ACPI Devel Maling List, Linux Kernel Mailing List, jon.grimm

On Mon, Jan 25, 2021 at 05:41:04PM +0100, Rafael J. Wysocki wrote:
> On Fri, Jan 22, 2021 at 7:05 PM Terry Bowman <terry.bowman@amd.com> wrote:
> >
> > From: Yazen Ghannam <yazen.ghannam@amd.com>
> >
> > Refactor duplicated GHES identity logic into is_ghes_type().
> >
> > Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
> > Reviewed-by: Robert Richter <rrichter@amd.com>
> > Signed-off-by: Terry Bowman <terry.bowman@amd.com>
> 
> 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?
> 
> > ---
> >  drivers/acpi/apei/hest.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
> > index 6e980fe16772..bd702e0ef339 100644
> > --- a/drivers/acpi/apei/hest.c
> > +++ b/drivers/acpi/apei/hest.c
> > @@ -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;

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.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / APEI: Add is_ghes_type() to identify GHES sources
  2021-01-25 17:14   ` Borislav Petkov
@ 2021-01-25 22:42     ` Terry Bowman
  0 siblings, 0 replies; 4+ messages in thread
From: Terry Bowman @ 2021-01-25 22:42 UTC (permalink / raw)
  To: Borislav Petkov, Rafael J. Wysocki
  Cc: James Morse, Rafael J. Wysocki, Len Brown, Tony Luck,
	Yazen Ghannam, Hanjun Guo, Colin Ian King,
	ACPI Devel Maling List, Linux Kernel Mailing List, jon.grimm

On 1/25/21 11:14 AM, Borislav Petkov wrote:
> On Mon, Jan 25, 2021 at 05:41:04PM +0100, Rafael J. Wysocki wrote:
>> On Fri, Jan 22, 2021 at 7:05 PM Terry Bowman<terry.bowman@amd.com>  wrote:
>>> From: Yazen Ghannam<yazen.ghannam@amd.com>
>>>
>>> Refactor duplicated GHES identity logic into is_ghes_type().
>>>
>>> Signed-off-by: Yazen Ghannam<yazen.ghannam@amd.com>
>>> Reviewed-by: Robert Richter<rrichter@amd.com>
>>> Signed-off-by: Terry Bowman<terry.bowman@amd.com>
>> 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.
>> Boris, James, any objections to the changes below?
>>
>>> ---
>>>   drivers/acpi/apei/hest.c | 12 ++++++++----
>>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
>>> index 6e980fe16772..bd702e0ef339 100644
>>> --- a/drivers/acpi/apei/hest.c
>>> +++ b/drivers/acpi/apei/hest.c
>>> @@ -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;
> 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.
Sure, I'll rename is_ghes_type() to is_generic_error() in v2.
> Thx.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-25 22:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 18:03 [PATCH] ACPI / APEI: Add is_ghes_type() to identify GHES sources Terry Bowman
2021-01-25 16:41 ` Rafael J. Wysocki
2021-01-25 17:14   ` Borislav Petkov
2021-01-25 22:42     ` Terry Bowman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.