lkml.org 
[lkml]   [2021]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] device property: Add fwnode_irq_get_by_name
Date
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@gmail.com>
---
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
\
 
 \ /
  Last update: 2021-11-06 18:40    [W:0.060 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site