Revision 81699d8a hw/qdev.c
b/hw/qdev.c | ||
---|---|---|
449 | 449 |
return NULL; |
450 | 450 |
} |
451 | 451 |
|
452 |
int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn, |
|
453 |
qbus_walkerfn *busfn, void *opaque) |
|
454 |
{ |
|
455 |
DeviceState *dev; |
|
456 |
int err; |
|
457 |
|
|
458 |
if (busfn) { |
|
459 |
err = busfn(bus, opaque); |
|
460 |
if (err) { |
|
461 |
return err; |
|
462 |
} |
|
463 |
} |
|
464 |
|
|
465 |
QLIST_FOREACH(dev, &bus->children, sibling) { |
|
466 |
err = qdev_walk_children(dev, devfn, busfn, opaque); |
|
467 |
if (err < 0) { |
|
468 |
return err; |
|
469 |
} |
|
470 |
} |
|
471 |
|
|
472 |
return 0; |
|
473 |
} |
|
474 |
|
|
475 |
int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, |
|
476 |
qbus_walkerfn *busfn, void *opaque) |
|
477 |
{ |
|
478 |
BusState *bus; |
|
479 |
int err; |
|
480 |
|
|
481 |
if (devfn) { |
|
482 |
err = devfn(dev, opaque); |
|
483 |
if (err) { |
|
484 |
return err; |
|
485 |
} |
|
486 |
} |
|
487 |
|
|
488 |
QLIST_FOREACH(bus, &dev->child_bus, sibling) { |
|
489 |
err = qbus_walk_children(bus, devfn, busfn, opaque); |
|
490 |
if (err < 0) { |
|
491 |
return err; |
|
492 |
} |
|
493 |
} |
|
494 |
|
|
495 |
return 0; |
|
496 |
} |
|
497 |
|
|
452 | 498 |
static BusState *qbus_find_recursive(BusState *bus, const char *name, |
453 | 499 |
const BusInfo *info) |
454 | 500 |
{ |
Also available in: Unified diff