The fwnode framework did not have means to obtain the IRQ number from the name of a node. Add that now, in form of the fwnode_irq_get_by_name() function. Signed-off-by: Puranjay Mohan <puranjay12@xxxxxxxxx> --- drivers/base/property.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index f1f35b48ab8b..627e4e6d3ebd 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -958,6 +958,30 @@ int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index) } EXPORT_SYMBOL(fwnode_irq_get); +/** + * fwnode_irq_get_by_name - Get IRQ directly from its name. + * @fwnode: Pointer to the firmware node + * @name: IRQ Name + * + * Returns Linux IRQ number on success. Other values are determined + * accordingly to acpi_/of_ irq_get() operation. + */ +int fwnode_irq_get_by_name(const struct fwnode_handle *fwnode, const char *name) +{ + int index; + + if (unlikely(!name)) + return -EINVAL; + + index = of_property_match_string(to_of_node(fwnode), "interrupt-names", + name); + if (index < 0) + return index; + + return fwnode_irq_get(fwnode, index); +} +EXPORT_SYMBOL(fwnode_irq_get_by_name); + /** * fwnode_graph_get_next_endpoint - Get next endpoint firmware node * @fwnode: Pointer to the parent firmware node -- 2.30.1