From: Bjorn Helgaas <helgaas@kernel.org>
To: LeoLiu-oc <LeoLiu-oc@zhaoxin.com>
Cc: tony.luck@intel.com, linux-pci@vger.kernel.org,
robert.moore@intel.com, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, bp@alien8.de, bhelgaas@google.com,
james.morse@arm.com, acpica-devel@lists.linuxfoundation.org,
lenb@kernel.org
Subject: Re: [Acpica-devel] [PATCH v3 2/5] ACPI/APEI: Remove static from apei_hest_parse()
Date: Thu, 10 Aug 2023 18:17:18 -0500 [thread overview]
Message-ID: <20230810231718.GA49532@bhelgaas> (raw)
In-Reply-To: <20230704120517.1322195-1-LeoLiu-oc@zhaoxin.com>
On Tue, Jul 04, 2023 at 08:05:17PM +0800, LeoLiu-oc wrote:
> From: leoliu-oc <leoliu-oc@zhaoxin.com>
>
> Each dev with AER capability needs to call the apei_hest_parse function to
> match and extract register values from HEST PCIe AER structures.
> Therefore, remove static from apei_hest_parse() so that it can be called
> in another file.
Can you reword the subject line and commit log in the positive?
"Removing static" is a negative thing and it's semantically a bit too
low level -- it's clearly what the *code* does, but we can see that
from the patch, and what we want to know here is *why* it's important.
What this really does is expose apei_hest_parse() for use by other
subsystems.
Browsing the drivers/acpi commit log history, I see that Rafael adds
"()" after function names, so please do the same here (you did do that
once above, but not in the first line).
> Signed-off-by: leoliu-oc <leoliu-oc@zhaoxin.com>
> ---
> drivers/acpi/apei/hest.c | 2 +-
> include/acpi/apei.h | 5 +++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
> index fb839a5c480ee..fd40c035c9b2e 100644
> --- a/drivers/acpi/apei/hest.c
> +++ b/drivers/acpi/apei/hest.c
> @@ -132,7 +132,7 @@ static bool hest_match_pci(struct acpi_hest_header *hest_hdr,
> return false;
> }
>
> -static int apei_hest_parse(apei_hest_func_t func, void *data)
> +int apei_hest_parse(apei_hest_func_t func, void *data)
If this is going to exported to the PCI subsystem, I think it needs
some kernel-doc. For example, it's important to know that it stops
parsing the HEST if func returns anything non-zero. This is how
pci_acpi_program_hest_aer_params() knows that it got good data that
matches the device it wants.
Given the fact that apei_hest_parse_aer() fills in the struct
acpi_hest_parse_aer_info with pointers into the HEST table data, it's
also important to know that this HEST table data is persistent.
> {
> struct acpi_hest_header *hest_hdr;
> int i, rc, len;
> diff --git a/include/acpi/apei.h b/include/acpi/apei.h
> index 8a0b2b9edbafe..f975e4fe78fcb 100644
> --- a/include/acpi/apei.h
> +++ b/include/acpi/apei.h
> @@ -37,9 +37,14 @@ typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);
>
> #ifdef CONFIG_ACPI_APEI
> void __init acpi_hest_init(void);
> +int apei_hest_parse(apei_hest_func_t func, void *data);
> int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data);
> #else
> static inline void acpi_hest_init(void) { }
> +static inline int apei_hest_parse(apei_hest_func_t func, void *data)
> +{
> + return -EINVAL;
> +}
> static inline int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data)
> {
> return -EINVAL;
> --
> 2.34.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org>
To: LeoLiu-oc <LeoLiu-oc@zhaoxin.com>
Cc: lenb@kernel.org, james.morse@arm.com, tony.luck@intel.com,
bp@alien8.de, bhelgaas@google.com, robert.moore@intel.com,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org,
acpica-devel@lists.linuxfoundation.org
Subject: Re: [PATCH v3 2/5] ACPI/APEI: Remove static from apei_hest_parse()
Date: Thu, 10 Aug 2023 18:17:18 -0500 [thread overview]
Message-ID: <20230810231718.GA49532@bhelgaas> (raw)
In-Reply-To: <20230704120517.1322195-1-LeoLiu-oc@zhaoxin.com>
On Tue, Jul 04, 2023 at 08:05:17PM +0800, LeoLiu-oc wrote:
> From: leoliu-oc <leoliu-oc@zhaoxin.com>
>
> Each dev with AER capability needs to call the apei_hest_parse function to
> match and extract register values from HEST PCIe AER structures.
> Therefore, remove static from apei_hest_parse() so that it can be called
> in another file.
Can you reword the subject line and commit log in the positive?
"Removing static" is a negative thing and it's semantically a bit too
low level -- it's clearly what the *code* does, but we can see that
from the patch, and what we want to know here is *why* it's important.
What this really does is expose apei_hest_parse() for use by other
subsystems.
Browsing the drivers/acpi commit log history, I see that Rafael adds
"()" after function names, so please do the same here (you did do that
once above, but not in the first line).
> Signed-off-by: leoliu-oc <leoliu-oc@zhaoxin.com>
> ---
> drivers/acpi/apei/hest.c | 2 +-
> include/acpi/apei.h | 5 +++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
> index fb839a5c480ee..fd40c035c9b2e 100644
> --- a/drivers/acpi/apei/hest.c
> +++ b/drivers/acpi/apei/hest.c
> @@ -132,7 +132,7 @@ static bool hest_match_pci(struct acpi_hest_header *hest_hdr,
> return false;
> }
>
> -static int apei_hest_parse(apei_hest_func_t func, void *data)
> +int apei_hest_parse(apei_hest_func_t func, void *data)
If this is going to exported to the PCI subsystem, I think it needs
some kernel-doc. For example, it's important to know that it stops
parsing the HEST if func returns anything non-zero. This is how
pci_acpi_program_hest_aer_params() knows that it got good data that
matches the device it wants.
Given the fact that apei_hest_parse_aer() fills in the struct
acpi_hest_parse_aer_info with pointers into the HEST table data, it's
also important to know that this HEST table data is persistent.
> {
> struct acpi_hest_header *hest_hdr;
> int i, rc, len;
> diff --git a/include/acpi/apei.h b/include/acpi/apei.h
> index 8a0b2b9edbafe..f975e4fe78fcb 100644
> --- a/include/acpi/apei.h
> +++ b/include/acpi/apei.h
> @@ -37,9 +37,14 @@ typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);
>
> #ifdef CONFIG_ACPI_APEI
> void __init acpi_hest_init(void);
> +int apei_hest_parse(apei_hest_func_t func, void *data);
> int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data);
> #else
> static inline void acpi_hest_init(void) { }
> +static inline int apei_hest_parse(apei_hest_func_t func, void *data)
> +{
> + return -EINVAL;
> +}
> static inline int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data)
> {
> return -EINVAL;
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-08-10 23:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 12:05 [PATCH v3 2/5] ACPI/APEI: Remove static from apei_hest_parse() LeoLiu-oc
2023-07-04 12:16 ` [Acpica-devel] " LeoLiu-oc
2023-08-10 23:17 ` Bjorn Helgaas [this message]
2023-08-10 23:17 ` Bjorn Helgaas
2023-09-11 9:54 ` LeoLiu-oc
2023-09-11 9:55 ` [Acpica-devel] " LeoLiu-oc
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=20230810231718.GA49532@bhelgaas \
--to=helgaas@kernel.org \
--cc=LeoLiu-oc@zhaoxin.com \
--cc=acpica-devel@lists.linuxfoundation.org \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=james.morse@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=robert.moore@intel.com \
--cc=tony.luck@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 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.