[RFC PATCH v3 05/17] ACPI: irq: Add support for deferred probe in acpi_register_gsi()

From: Sunil V L
Date: Tue Dec 19 2023 - 12:47:44 EST


The chip which provides the GSI support may not be initialized at the
time of acpi_register_gsi(). Return -EPROBE_DEFER to support deferred
probing similar to acpi_irq_get().

This is required to support ResourceSource as supported by ACPI spec for
Interrupt resource.

Signed-off-by: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>
---
drivers/acpi/irq.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
index b3409e2e2041..c4605fdcda77 100644
--- a/drivers/acpi/irq.c
+++ b/drivers/acpi/irq.c
@@ -52,6 +52,7 @@ EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
*
* Returns: a valid linux IRQ number on success
* -EINVAL on failure
+ * -EPROBE_DEFER if irqdomain not created yet
*/
int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
int polarity)
@@ -65,6 +66,9 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
return -EINVAL;
}

+ if (!irq_find_matching_fwnode(fwspec.fwnode, DOMAIN_BUS_ANY))
+ return -EPROBE_DEFER;
+
fwspec.param[0] = gsi;
fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
fwspec.param_count = 2;
--
2.39.2