[PATCH v5 1/2] ACPI: Add stub for acpi_has_method() for !CONFIG_ACPI
From: Bowen Yu
Date: Tue Sep 29 2026 - 08:20:35 EST
acpi_has_method() is declared in <acpi/acpi_bus.h>, which is only
included by <linux/acpi.h> when CONFIG_ACPI is enabled. Unlike the
ACPICA core helpers (acpi_evaluate_object(), acpi_format_exception(),
...) that get automatic static-inline stubs via the
ACPI_EXTERNAL_RETURN_* macros when !CONFIG_ACPI, acpi_has_method() is
Linux glue and has no stub in the #else section of <linux/acpi.h>.
This forces drivers referencing acpi_has_method() to wrap the call
site in #ifdef CONFIG_ACPI to avoid -Werror=implicit-function-declaration
on !CONFIG_ACPI builds -- a valid config for drivers that
"depends on ARM64 || COMPILE_TEST" with no ACPI dependency.
Add a static inline stub returning false, consistent with the existing
stubs for acpi_check_dsm() and friends, so drivers can drop the #ifdef
and rely on the runtime acpi_disabled check instead.
Signed-off-by: Bowen Yu <yubowen8@xxxxxxxxxx>
---
include/linux/acpi.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ddacac812094..141a322435c2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1028,6 +1028,11 @@ static inline bool acpi_driver_match_device(struct device *dev,
return false;
}
+static inline bool acpi_has_method(acpi_handle handle, char *name)
+{
+ return false;
+}
+
static inline bool acpi_check_dsm(acpi_handle handle, const guid_t *guid,
u64 rev, u64 funcs)
{
--
2.33.0