of/irq: Add interrupts-names property to name an irq resource
[~shefty/rdma-dev.git] / drivers / of / irq.c
index 0f0cfa3bca301e2d824ad64ebdaba23d6c617825..9cf00602f5665b289d1279666504af0010a3fa0f 100644 (file)
@@ -341,9 +341,18 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
        /* Only dereference the resource if both the
         * resource and the irq are valid. */
        if (r && irq) {
+               const char *name = NULL;
+
+               /*
+                * Get optional "interrupts-names" property to add a name
+                * to the resource.
+                */
+               of_property_read_string_index(dev, "interrupt-names", index,
+                                             &name);
+
                r->start = r->end = irq;
                r->flags = IORESOURCE_IRQ;
-               r->name = dev->full_name;
+               r->name = name ? name : dev->full_name;
        }
 
        return irq;