of/irq: Add interrupts-names property to name an irq resource

Add a interrupts-names property to allow the possibility to provide a name
to any interrupts entries.  If the name is available, use it to name the
resource, otherwise keep the device full name.

Signed-off-by: Benoit Cousson <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Rob Herring <[email protected]>
[grant.likely: use "interrupt-names" and tidy documentation]
Signed-off-by: Grant Likely <[email protected]>
This commit is contained in:
Benoit Cousson 2011-12-05 15:23:56 +01:00 • committed by Grant Likely
commit 661db794eb
2 changed files with 14 additions and 1 deletions

View 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;