[PATCH v2 1/2] ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled

Li Chen posted 2 patches 3 months, 2 weeks ago
[PATCH v2 1/2] ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled
Posted by Li Chen 3 months, 2 weeks ago
From: Li Chen <chenl311@chinatelecom.cn>

If CONFIG_ACPI_SPCR_TABLE is disabled, acpi_parse_spcr()
currently returns 0, which may incorrectly suggest that
SPCR parsing was successful. This patch changes the behavior
to return -ENODEV to clearly indicate that SPCR support
is not available.

This prepares the codebase for future changes that depend
on acpi_parse_spcr() failure detection, such as suppressing
misleading console messages.

Signed-off-by: Li Chen <chenl311@chinatelecom.cn>
---
 include/linux/acpi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index f102c0fe34318..71e692f952905 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1503,7 +1503,7 @@ int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
 #else
 static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
 {
-	return 0;
+	return -ENODEV;
 }
 #endif
 
-- 
2.49.0
Re: [PATCH v2 1/2] ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled
Posted by Catalin Marinas 3 months, 1 week ago
On Fri, Jun 20, 2025 at 09:13:07PM +0800, Li Chen wrote:
> From: Li Chen <chenl311@chinatelecom.cn>
> 
> If CONFIG_ACPI_SPCR_TABLE is disabled, acpi_parse_spcr()
> currently returns 0, which may incorrectly suggest that
> SPCR parsing was successful. This patch changes the behavior
> to return -ENODEV to clearly indicate that SPCR support
> is not available.
> 
> This prepares the codebase for future changes that depend
> on acpi_parse_spcr() failure detection, such as suppressing
> misleading console messages.
> 
> Signed-off-by: Li Chen <chenl311@chinatelecom.cn>
> ---
>  include/linux/acpi.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index f102c0fe34318..71e692f952905 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -1503,7 +1503,7 @@ int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
>  #else
>  static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
>  {
> -	return 0;
> +	return -ENODEV;
>  }
>  #endif

Rafael, are you ok with this patch going via the arm64 tree?

Thanks.

-- 
Catalin
Re: [PATCH v2 1/2] ACPI: Return -ENODEV from acpi_parse_spcr() when SPCR support is disabled
Posted by Rafael J. Wysocki 3 months, 1 week ago
On Tue, Jul 1, 2025 at 1:53 PM Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Fri, Jun 20, 2025 at 09:13:07PM +0800, Li Chen wrote:
> > From: Li Chen <chenl311@chinatelecom.cn>
> >
> > If CONFIG_ACPI_SPCR_TABLE is disabled, acpi_parse_spcr()
> > currently returns 0, which may incorrectly suggest that
> > SPCR parsing was successful. This patch changes the behavior
> > to return -ENODEV to clearly indicate that SPCR support
> > is not available.
> >
> > This prepares the codebase for future changes that depend
> > on acpi_parse_spcr() failure detection, such as suppressing
> > misleading console messages.
> >
> > Signed-off-by: Li Chen <chenl311@chinatelecom.cn>
> > ---
> >  include/linux/acpi.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> > index f102c0fe34318..71e692f952905 100644
> > --- a/include/linux/acpi.h
> > +++ b/include/linux/acpi.h
> > @@ -1503,7 +1503,7 @@ int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
> >  #else
> >  static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
> >  {
> > -     return 0;
> > +     return -ENODEV;
> >  }
> >  #endif
>
> Rafael, are you ok with this patch going via the arm64 tree?

Yes, I am, thanks!