Re: [PATCH] ACPI: APEI: ghes: mark ghes_in_nmi_spool_from_list maybe unused
From: Rui Qi
Date: Mon Mar 16 2026 - 23:56:40 EST
On 3/16/26 5:03 PM, Breno Leitao wrote:
> On Mon, Mar 16, 2026 at 04:28:42PM +0800, Rui Qi wrote:
>> When CONFIG_ACPI_APEI_SEA and CONFIG_HAVE_ACPI_APEI_NMI are both
>> disabled, ghes_in_nmi_spool_from_list() becomes an unused static
>> function and triggers -Werror=unused-function in some configs (e.g.
>> riscv defconfig with APEI disabled).
>>
>> Mark it as __maybe_unused to silence the warning while keeping the
>> code available for configurations that use SEA or APEI NMI.
>
> Isn't it better to move it to the "#ifdef CONFIG_ACPI_APEI_SEA" below?
> Similarly to ghes_sea_add() and ghes_sea_remove()?
Thanks for the suggestion.
ghes_in_nmi_spool_from_list() is currently used by both the SEA and
NMI paths:
• ghes_notify_sea() under #ifdef CONFIG_ACPI_APEI_SEA
• ghes_notify_nmi() under #ifdef CONFIG_HAVE_ACPI_APEI_NMI
These two Kconfig options can be enabled independently. If we moved
ghes_in_nmi_spool_from_list() into
the #ifdef CONFIG_ACPI_APEI_SEA block, a configuration that enables
CONFIG_HAVE_ACPI_APEI_NMI but not
CONFIG_ACPI_APEI_SEA would end up missing this symbol for the NMI
path.
The __maybe_unused annotation in this patch is intended to be
consistent with the nearby helpers (such
as ghes_has_active_errors(), ghes_map_error_status() and
ghes_unmap_error_status()): when both SEA and
APEI NMI support are disabled, they may be unused, and this avoids
compiler warnings about unused
static functions.
If there is consensus that we should address this via conditional
compilation instead, I can follow up
with another patch that wraps these helpers in something like #if
IS_ENABLED(CONFIG_ACPI_APEI_SEA) ||
IS_ENABLED(CONFIG_HAVE_ACPI_APEI_NMI).