| 4568 | */ |
| 4569 | |
| 4570 | int |
| 4571 | bus_alloc_resources(device_t dev, struct resource_spec *rs, |
| 4572 | struct resource **res) |
| 4573 | { |
| 4574 | int i; |
| 4575 | |
| 4576 | for (i = 0; rs[i].type != -1; i++) |
| 4577 | res[i] = NULL; |
| 4578 | for (i = 0; rs[i].type != -1; i++) { |
| 4579 | res[i] = bus_alloc_resource_any(dev, |
| 4580 | rs[i].type, &rs[i].rid, rs[i].flags); |
| 4581 | if (res[i] == NULL && !(rs[i].flags & RF_OPTIONAL)) { |
| 4582 | bus_release_resources(dev, rs, res); |
| 4583 | return (ENXIO); |
| 4584 | } |
| 4585 | } |
| 4586 | return (0); |
| 4587 | } |
| 4588 | |
| 4589 | void |
| 4590 | bus_release_resources(device_t dev, const struct resource_spec *rs, |
no test coverage detected