| 478 | } |
| 479 | |
| 480 | int dtb_node_irq_get(struct dtb_node *dev, int index) |
| 481 | { |
| 482 | int rc = 0; |
| 483 | struct fdt_phandle_args out_irq; |
| 484 | struct dtb_node *p; |
| 485 | uint32_t intsize; |
| 486 | int res, i; |
| 487 | |
| 488 | p = dtb_node_irq_find_parent(dev); |
| 489 | if (p == NULL) |
| 490 | return -EINVAL; |
| 491 | /* Get size of interrupt specifier */ |
| 492 | if (dtb_node_read_u32_array(p, "#interrupt-cells", &intsize, 1)) |
| 493 | { |
| 494 | res = -EINVAL; |
| 495 | goto out; |
| 496 | } |
| 497 | |
| 498 | debug(" path:%s, parent=%pOF, intsize=%d\n", p->path,p, intsize); |
| 499 | |
| 500 | /* Copy intspec into irq structure */ |
| 501 | out_irq.np = p; |
| 502 | out_irq.args_count = intsize; |
| 503 | for (i = 0; i < intsize; i++) |
| 504 | { |
| 505 | res = dtb_node_read_u32_index(dev, "interrupts", |
| 506 | (index * 3 + i), |
| 507 | out_irq.args + i); |
| 508 | if (res) |
| 509 | goto out; |
| 510 | } |
| 511 | rc = out_irq.args[1]; |
| 512 | out: |
| 513 | dtb_node_put(p); |
| 514 | return rc; |
| 515 | |
| 516 | } |
| 517 | |
| 518 | /** |
| 519 | * dtb_node_irq_get_byname - Decode a node's IRQ and return it as a Linux IRQ number |
no test coverage detected