[PATCH v1 01/17] ACPI: bus: Use acpi/acpi_bus.h without CONFIG_ACPI

From: Rafael J. Wysocki

Date: Mon Sep 21 2026 - 16:06:40 EST


From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>

Corrently acpi/acpi_bus.h is included in linux/acpi.h only if
CONFIG_ACPI is set, but it contains declarations that are useful
otherwise too.

For consistency, modify linux/acpi.h to always include acpi/acpi_bus.h
and update the latter to avoid exposing too much when CONFIG_ACPI is
not set.

Since acpi_has_method() is called from some code build when
CONFIG_ACPI is unset, add a stub for it to the !CONFIG_ACPI
block in acpi/acpi_bus.h.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
include/acpi/acpi_bus.h | 12 ++++++++----
include/linux/acpi.h | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a10a591c18b2..32837f507f40 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -9,6 +9,8 @@
#ifndef __ACPI_BUS_H__
#define __ACPI_BUS_H__

+#ifdef CONFIG_ACPI
+
#include <linux/completion.h>
#include <linux/container_of.h>
#include <linux/device.h>
@@ -58,7 +60,6 @@ bool acpi_dock_match(acpi_handle handle);
bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs);
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
u64 rev, u64 func, union acpi_object *argv4);
-#ifdef CONFIG_ACPI
bool
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);

@@ -77,7 +78,6 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,

return obj;
}
-#endif

#define ACPI_INIT_DSM_ARGV4(cnt, eles) \
{ \
@@ -90,8 +90,6 @@ bool acpi_dev_found(const char *hid);
bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
bool acpi_reduced_hardware(void);

-#ifdef CONFIG_ACPI
-
struct proc_dir_entry;

#define ACPI_BUS_FILE_ROOT "acpi"
@@ -942,8 +940,14 @@ int acpi_wait_for_acpi_ipmi(void);

int acpi_scan_add_dep(acpi_handle handle, struct acpi_handle_list *dep_devices);
u32 arch_acpi_add_auto_dep(acpi_handle handle);
+
#else /* CONFIG_ACPI */

+static inline bool acpi_has_method(acpi_handle handle, char *name)
+{
+ return false;
+}
+
static inline struct device *acpi_bus_get_primary_device(struct acpi_device *adev)
{
return NULL;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ddacac812094..ba5234bd93a2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -25,6 +25,7 @@ struct irq_domain_ops;
#define _LINUX
#endif
#include <acpi/acpi.h>
+#include <acpi/acpi_bus.h>
#include <acpi/acpi_numa.h>

#ifdef CONFIG_ACPI
@@ -35,7 +36,6 @@ struct irq_domain_ops;
#include <linux/mutex.h>
#include <linux/fw_table.h>

-#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_io.h>
#include <asm/acpi.h>
--
2.51.0