acpi_driver_added() snapshots the ACPI bus children before probing and
attaching them. Attaching an ig4iic controller can attach acpi_iicbus,
whose enumeration deletes unattached ACPI placeholders for I2C slaves.
If a deleted placeholder is pending in the outer snapshot, the scan can
subsequently probe a freed device_t, potentially faulting in
kobj_delete() during a driver change. ACPI SPI enumeration can likewise
delete placeholders belonging to the ACPI bus.
Add bus_foreach_child_safe() to track child snapshots under the bus
topology lock, and use it in acpi_driver_added(). Before freeing a
device, device_delete_child() clears matching entries in all active
snapshots, including nested scans. Invalidating entries before freeing
also prevents a newly allocated device at the same address from being
mistaken for a pending child. The walk skips deleted children and
children no longer belonging to the parent, and does not visit newly
added children.
MFC after: 2 weeks
Sponsored by: FreeBSD Foundation