From: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
To: grant.likely@secretlab.ca
Cc: devicetree@vger.kernel.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, robh+dt@kernel.org,
gregory.clement@free-electrons.com,
linux-arm-kernel@lists.infradead.org,
Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Subject: [PATCH v3 1/2] of: irq: Added of_find_irq_domain() to get the domain of an irq
Date: Fri, 21 Mar 2014 15:46:24 +0100 [thread overview]
Message-ID: <1395413185-29763-2-git-send-email-jjhiblot@traphandler.com> (raw)
In-Reply-To: <1395413185-29763-1-git-send-email-jjhiblot@traphandler.com>
This functions does the same parsing as irq_of_parse_and_map but instead
of doing the mapping, it returns a pointer to the irq domain
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
drivers/of/irq.c | 20 ++++++++++++++++++++
include/linux/of_irq.h | 2 ++
2 files changed, 22 insertions(+)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 9bcf2cf..7d3184f 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -46,6 +46,26 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
/**
+ * of_find_irq_domain - Parse the DT and returns a pointer to the irq domain
+ * @dev: Device node of the device whose interrupt is concerned
+ * @index: Index of the interrupt to get the domain for
+ *
+ * This function is a wrapper that chains of_irq_parse_one() and
+ * irq_find_host() to make things easier to callers
+ */
+struct irq_domain *of_find_irq_domain(struct device_node *dev, int index)
+{
+ int rc;
+ struct of_phandle_args oirq;
+
+ rc = of_irq_parse_one(dev, index, &oirq);
+ if (rc)
+ return ERR_PTR(rc);
+
+ return irq_find_host(oirq.np);
+}
+
+/**
* of_irq_find_parent - Given a device node, find its interrupt parent node
* @child: pointer to device node
*
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 3f23b44..600ff0a 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -58,6 +58,8 @@ static inline int of_irq_count(struct device_node *dev)
* so declare it here regardless of the CONFIG_OF_IRQ setting.
*/
extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
+extern struct irq_domain *of_find_irq_domain(struct device_node *dev,
+ int index);
extern struct device_node *of_irq_find_parent(struct device_node *child);
#else /* !CONFIG_OF */
--
1.9.0
next prev parent reply other threads:[~2014-03-21 14:50 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 9:57 [PATCH] dt: platform driver: Fill the resources before probe and defer if needed Jean-Jacques Hiblot
2014-02-13 10:06 ` Jean-Jacques Hiblot
2014-02-18 20:22 ` Greg KH
2014-02-18 22:34 ` Grant Likely
2014-02-20 15:30 ` Grant Likely
[not found] ` < 1392988720-20976-1-git-send-email-jjhiblot@traphandler.com>
[not found] ` <20140308073758 .DA63FC408EC@trevor.secretlab.ca>
[not found] ` < CACh+v5P=tcc-h_9r7Btwyu+jWjwH2ocmW4VCgDYqY7VMWsHuOA@mail.gmail.com>
[not found] ` < 20140317142443.A2447C40A85@trevor.secretlab.ca>
[not found] ` < 902E09E6452B0E43903E4F2D568737AB0B9D2959@DFRE01.ent.ti.com>
[not found] ` < CACh+v5MPTx6nwVj1s3krntJqQ6DMTQ2hQ93Hc+rRNAuFa9+qPw@mail.gmail.com>
2014-02-21 13:18 ` [PATCH v2] " Jean-Jacques Hiblot
2014-02-21 15:37 ` Strashko, Grygorii
2014-02-21 16:22 ` Jean-Jacques Hiblot
2014-02-27 16:43 ` Jean-Jacques Hiblot
2014-03-08 7:32 ` Grant Likely
2014-02-27 15:01 ` Ludovic Desroches
2014-03-08 7:37 ` Grant Likely
2014-03-08 11:59 ` Russell King - ARM Linux
2014-03-17 11:07 ` Jean-Jacques Hiblot
2014-03-17 14:24 ` Grant Likely
2014-03-17 15:20 ` Jean-Jacques Hiblot
2014-03-20 16:11 ` Grant Likely
2014-03-21 14:46 ` [PATCH v3 0/2] " Jean-Jacques Hiblot
2014-03-21 14:46 ` Jean-Jacques Hiblot [this message]
2014-03-21 14:46 ` [PATCH v3 2/2] " Jean-Jacques Hiblot
2014-04-11 17:28 ` Rob Herring
2014-04-18 20:52 ` Tony Lindgren
2014-04-18 21:39 ` Rob Herring
2014-04-18 21:58 ` Tony Lindgren
2014-04-18 23:03 ` Russell King - ARM Linux
2014-04-18 23:24 ` Tony Lindgren
2014-04-21 13:47 ` Rob Herring
2014-04-21 15:54 ` Tony Lindgren
2014-04-21 19:01 ` Rob Herring
2014-04-21 20:25 ` Tony Lindgren
2014-04-22 3:05 ` Tony Lindgren
2014-04-22 4:57 ` Tony Lindgren
2014-04-23 22:03 ` Rob Herring
2014-04-23 17:38 ` Russell King - ARM Linux
2014-04-23 15:02 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395413185-29763-2-git-send-email-jjhiblot@traphandler.com \
--to=jjhiblot@traphandler.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®