Skip to content

Commit ab7e531

Browse files
romank-msftliuw
authored andcommitted
ACPI: irq: Introduce acpi_get_gsi_dispatcher()
Using acpi_irq_create_hierarchy() in the cases where the code also handles OF leads to code duplication as the ACPI subsystem doesn't provide means to compute the IRQ domain parent whereas the OF does. Introduce acpi_get_gsi_dispatcher() so that the drivers relying on both ACPI and OF may use irq_domain_create_hierarchy() in the common code paths. No functional changes. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/20250428210742.435282-11-romank@linux.microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org> Message-ID: <20250428210742.435282-11-romank@linux.microsoft.com>
1 parent 18a34bb commit ab7e531

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

drivers/acpi/irq.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
enum acpi_irq_model_id acpi_irq_model;
1414

15-
static struct fwnode_handle *(*acpi_get_gsi_domain_id)(u32 gsi);
15+
static acpi_gsi_domain_disp_fn acpi_get_gsi_domain_id;
1616
static u32 (*acpi_gsi_to_irq_fallback)(u32 gsi);
1717

1818
/**
@@ -307,12 +307,24 @@ EXPORT_SYMBOL_GPL(acpi_irq_get);
307307
* for a given GSI
308308
*/
309309
void __init acpi_set_irq_model(enum acpi_irq_model_id model,
310-
struct fwnode_handle *(*fn)(u32))
310+
acpi_gsi_domain_disp_fn fn)
311311
{
312312
acpi_irq_model = model;
313313
acpi_get_gsi_domain_id = fn;
314314
}
315315

316+
/*
317+
* acpi_get_gsi_dispatcher() - Get the GSI dispatcher function
318+
*
319+
* Return the dispatcher function that computes the domain fwnode for
320+
* a given GSI.
321+
*/
322+
acpi_gsi_domain_disp_fn acpi_get_gsi_dispatcher(void)
323+
{
324+
return acpi_get_gsi_domain_id;
325+
}
326+
EXPORT_SYMBOL_GPL(acpi_get_gsi_dispatcher);
327+
316328
/**
317329
* acpi_set_gsi_to_irq_fallback - Register a GSI transfer
318330
* callback to fallback to arch specified implementation.

include/linux/acpi.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,11 @@ int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity
335335
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
336336
int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
337337

338+
typedef struct fwnode_handle *(*acpi_gsi_domain_disp_fn)(u32);
339+
338340
void acpi_set_irq_model(enum acpi_irq_model_id model,
339-
struct fwnode_handle *(*)(u32));
341+
acpi_gsi_domain_disp_fn fn);
342+
acpi_gsi_domain_disp_fn acpi_get_gsi_dispatcher(void);
340343
void acpi_set_gsi_to_irq_fallback(u32 (*)(u32));
341344

342345
struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags,

0 commit comments

Comments
 (0)