irqdomain: Simplify simple and legacy domain creation
authorMatti Vaittinen <mazziesaccount@gmail.com>
Thu, 8 Aug 2024 12:34:02 +0000 (15:34 +0300)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 9 Aug 2024 20:37:54 +0000 (22:37 +0200)
commit70114e7f7585ef078c2b7033ee14218f95f55e22
tree623665f916d5774c92ea44ab75f668e74d1df722
parent8400291e289ee6b2bf9779ff1c83a291501f017b
irqdomain: Simplify simple and legacy domain creation

irq_domain_create_simple() and irq_domain_create_legacy() use
__irq_domain_instantiate(), but have extra handling of allocating interrupt
descriptors and associating interrupts in them. Some of that is duplicated.

There are also call sites which have conditonals to invoke different
interrupt domain creator functions, where one of them is usually
irq_domain_create_legacy(). Alternatively they associate the interrupts for
the legacy case after creating the domain.

Moving the extra logic of irq_domain_create_simple()/legacy() into
__irq_domain_instantiate() allows to consolidate that.

Introduce hwirq_base and virq_base members in the irq_domain_info
structure, which allows to transport the required information and add the
conditional interrupt descriptor allocation and interrupt association into
__irq_domain_instantiate().

This reduces irq_domain_create_legacy() and irq_domain_create_simple() to
trivial wrappers which fill in the info structure and allows call sites
which must support the legacy case along with more modern mechanism to
select the domain type via the parameters of the info struct.

[ tglx: Massaged change log ]

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/32d07bd79eb2b5416e24da9e9e8fe5955423dcf9.1723120028.git.mazziesaccount@gmail.com
include/linux/irqdomain.h
kernel/irq/irqdomain.c