|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 1/6] xen: dt: add dt_for_each_irq_map helper
Hi Ian, On 08/05/2015 13:26, Ian Campbell wrote: This function iterates over a nodes interrupt-map property and calls a callback for each interrupt. For now it only supplies the translated IRQ since my use case has no need of e.g. child unit address. These can be added as needed by any future users. This follows much the same logic as dt_irq_map_raw when parsing the interrupt-map, but doesn't walk up the tree doing the actual translation and it iterates over all entries instead of just looking for the first match. I looked into refactoring dt_irq_map_raw but I couldn't find a way which I was confident in, plus I was reluctant to diverge from the Linux roots of this function any further. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Reviewed-by: Julien Grall <julien.grall@xxxxxxxxxx> This loop doesn't seem useful. AFAIU the spec, the PCI node (i.e your variable dev) will always have property #interrupt-cells. We will break directly. [..] [..] [..] [..] + dt_raw_irq.controller = ipar; + dt_raw_irq.size = pintsize; Don't you need to check that pintsize is < DT_MAX_IRQ_SPEC?The previous "if ( ... > DT_MAX_IRQ_SPEC )" will likely be done on a different parent. For instance with the following incomplete DT (based on the apm-storm.dsi in Linux):
pcie0 {
#interrupt-cells = <1>;
...
#interrupt-map = < 0x0 0x0 0x0 0x1 &gic ... >
}
The first ipar will point to pcie0 because it has a property
"#interrupt-cells", while the second time ipar will point to the gic node.
+ for ( i = 0; i < pintsize; i++ ) + dt_raw_irq.specifier[i] = dt_read_number(imap + i, 1); + + ret = dt_irq_translate(&dt_raw_irq, &dt_irq); + if ( ret < 0 ) The other caller of dt_irq_translate returns an error when ret is not 0. I would do the same here. Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |