linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] mfd: Use interrupt-parent as IRQ controller if specified in DT
Date: Mon,  6 Aug 2012 11:46:40 +0100	[thread overview]
Message-ID: <1344250002-6011-5-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1344250002-6011-1-git-send-email-lee.jones@linaro.org>

Without this patch the default behaviour is to climb the Device
Tree and use the first encountered interrupt controller. This
does not take into account if a device node has specified to use
a particular IRQ controller using the interrupt-parent property.
This patch ensures that property is adhered to.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/mfd-core.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 0c3a01c..f10f27b 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -20,6 +20,7 @@
 #include <linux/module.h>
 #include <linux/irqdomain.h>
 #include <linux/of.h>
+#include <linux/of_irq.h>
 
 int mfd_cell_enable(struct platform_device *pdev)
 {
@@ -78,7 +79,7 @@ static int mfd_add_device(struct device *parent, int id,
 {
 	struct resource *res;
 	struct platform_device *pdev;
-	struct device_node *np = NULL;
+	struct device_node *np, *parent_node = NULL;
 	struct irq_domain *domain = NULL;
 	int ret = -ENOMEM;
 	int r;
@@ -97,7 +98,12 @@ static int mfd_add_device(struct device *parent, int id,
 		for_each_child_of_node(parent->of_node, np) {
 			if (of_device_is_compatible(np, cell->of_compatible)) {
 				pdev->dev.of_node = np;
-				domain = irq_find_host(parent->of_node);
+#ifdef CONFIG_OF
+				parent_node = of_irq_find_parent(np);
+#endif
+				if (!parent_node)
+					parent_node = parent->of_node;
+				domain = irq_find_host(parent_node);
 				break;
 			}
 		}
-- 
1.7.9.5

  parent reply	other threads:[~2012-08-06 10:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 10:46 [PATCH 0/6] Device Tree IRQ related enablement patches Lee Jones
2012-08-06 10:46 ` [PATCH 1/6] ARM: ux500: Identify the PRCMU as an interrupt controller Lee Jones
2012-08-06 10:46 ` [PATCH 2/6] mfd: Provide the PRCMU with its own IRQ domain Lee Jones
2012-08-06 11:50   ` Arnd Bergmann
2012-08-06 10:46 ` [PATCH 3/6] ARM: ux500: Force AB8500 to use the GIC as its interrupt controller Lee Jones
2012-08-06 10:46 ` Lee Jones [this message]
2012-08-06 15:54   ` [PATCH 4/6] mfd: Use interrupt-parent as IRQ controller if specified in DT Mark Brown
2012-08-06 17:21     ` Lee Jones
2012-08-06 10:46 ` [PATCH 5/6] ARM: ux500: Match-up compatible stings with associated MFD cell Lee Jones
2012-08-06 10:46 ` [PATCH 6/6] Input: ab8500-ponkey: Make the distinction between DT and non-DT boots Lee Jones
2012-08-06 11:17   ` Linus Walleij
2012-08-06 12:36   ` Lee Jones
2012-08-06 16:00   ` Mark Brown
2012-08-06 17:22     ` Lee Jones

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=1344250002-6011-5-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).