X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fof%2Firq.c;h=ca0189308d72025f61406d4440b20f7486fda99e;hb=274eb7bf1dce97dac496d7b9ded91f9de5719cf0;hp=9bcf2cf19357837dcb6dd8e5cce637150a7a32d0;hpb=878a876b2e10888afe53766dcca33f723ae20edc;p=karo-tx-linux.git diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 9bcf2cf19357..ca0189308d72 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -379,6 +379,32 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) } EXPORT_SYMBOL_GPL(of_irq_to_resource); +/** + * of_irq_get - Decode a node's IRQ and return it as a Linux irq number + * @dev: pointer to device tree node + * @index: zero-based index of the irq + * + * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain + * is not yet created. + * + */ +int of_irq_get(struct device_node *dev, int index) +{ + int rc; + struct of_phandle_args oirq; + struct irq_domain *domain; + + rc = of_irq_parse_one(dev, index, &oirq); + if (rc) + return rc; + + domain = irq_find_host(oirq.np); + if (!domain) + return -EPROBE_DEFER; + + return irq_create_of_mapping(&oirq); +} + /** * of_irq_count - Count the number of IRQs a node uses * @dev: pointer to device tree node