Skip to content

Commit 8cf2527

Browse files
vlsunilrafaeljw
authored andcommitted
ACPI: scan: Define weak function to populate dependencies
Some architectures like RISC-V need to add dependencies without explicit _DEP. Define a weak function which can be implemented by the architecture. Signed-off-by: Sunil V L <[email protected]> Tested-by: Björn Töpel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 15f210f commit 8cf2527

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

drivers/acpi/scan.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,11 +2077,22 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev)
20772077
}
20782078
}
20792079

2080+
u32 __weak arch_acpi_add_auto_dep(acpi_handle handle) { return 0; }
2081+
20802082
static u32 acpi_scan_check_dep(acpi_handle handle)
20812083
{
20822084
struct acpi_handle_list dep_devices;
20832085
u32 count = 0;
20842086

2087+
/*
2088+
* Some architectures like RISC-V need to add dependencies for
2089+
* all devices which use GSI to the interrupt controller so that
2090+
* interrupt controller is probed before any of those devices.
2091+
* Instead of mandating _DEP on all the devices, detect the
2092+
* dependency and add automatically.
2093+
*/
2094+
count += arch_acpi_add_auto_dep(handle);
2095+
20852096
/*
20862097
* Check for _HID here to avoid deferring the enumeration of:
20872098
* 1. PCI devices.

include/acpi/acpi_bus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,7 @@ static inline void acpi_put_acpi_dev(struct acpi_device *adev)
994994
int acpi_wait_for_acpi_ipmi(void);
995995

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

9991000
static inline int register_acpi_bus_type(void *bus) { return 0; }

0 commit comments

Comments
 (0)