aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/irq.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2014-04-23 18:57:41 -0400
committerGrant Likely <grant.likely@linaro.org>2014-04-24 16:40:22 -0400
commit9ec36cafe43bf835f8f29273597a5b0cbc8267ef (patch)
tree3a4d486b89eb7bf3ddd0f2efd070ebf38e98c994 /drivers/of/irq.c
parent82c0f5897a8708dbf7abe08e49efd9a4a8d8cd3a (diff)
of/irq: do irq resolution in platform_get_irq
Currently we get the following kind of errors if we try to use interrupt phandles to irqchips that have not yet initialized: irq: no irq domain found for /ocp/pinmux@48002030 ! ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x144/0x184() Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.0-00038-g42a9708 #1012 (show_stack+0x14/0x1c) (dump_stack+0x6c/0xa0) (warn_slowpath_common+0x64/0x84) (warn_slowpath_null+0x1c/0x24) (of_device_alloc+0x144/0x184) (of_platform_device_create_pdata+0x44/0x9c) (of_platform_bus_create+0xd0/0x170) (of_platform_bus_create+0x12c/0x170) (of_platform_populate+0x60/0x98) This is because we're wrongly trying to populate resources that are not yet available. It's perfectly valid to create irqchips dynamically, so let's fix up the issue by resolving the interrupt resources when platform_get_irq is called. And then we also need to accept the fact that some irqdomains do not exist that early on, and only get initialized later on. So we can make the current WARN_ON into just into a pr_debug(). We still attempt to populate irq resources when we create the devices. This allows current drivers which don't use platform_get_irq to continue to function. Once all drivers are fixed, this code can be removed. Suggested-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Cc: stable@vger.kernel.org # v3.10+ Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of/irq.c')
-rw-r--r--drivers/of/irq.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index e2e4c548a42f..5aeb89411350 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -380,6 +380,32 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
380EXPORT_SYMBOL_GPL(of_irq_to_resource); 380EXPORT_SYMBOL_GPL(of_irq_to_resource);
381 381
382/** 382/**
383 * of_irq_get - Decode a node's IRQ and return it as a Linux irq number
384 * @dev: pointer to device tree node
385 * @index: zero-based index of the irq
386 *
387 * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain
388 * is not yet created.
389 *
390 */
391int of_irq_get(struct device_node *dev, int index)
392{
393 int rc;
394 struct of_phandle_args oirq;
395 struct irq_domain *domain;
396
397 rc = of_irq_parse_one(dev, index, &oirq);
398 if (rc)
399 return rc;
400
401 domain = irq_find_host(oirq.np);
402 if (!domain)
403 return -EPROBE_DEFER;
404
405 return irq_create_of_mapping(&oirq);
406}
407
408/**
383 * of_irq_count - Count the number of IRQs a node uses 409 * of_irq_count - Count the number of IRQs a node uses
384 * @dev: pointer to device tree node 410 * @dev: pointer to device tree node
385 */ 411 */