Page MenuHomeFreeBSD

bus_generic_detach: Delete children after detaching them
ClosedPublic

Authored by jhb on Dec 6 2024, 10:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 3, 12:43 AM
Unknown Object (File)
Wed, Dec 25, 4:20 PM
Unknown Object (File)
Wed, Dec 25, 5:43 AM
Unknown Object (File)
Dec 11 2024, 8:59 AM
Unknown Object (File)
Dec 8 2024, 5:22 PM
Subscribers

Details

Summary

This provides better semantics as a standalone DEVMETHOD for
device_attach as bus drivers should remove child devices they created
as part of detach cleanup. The implementation calls
bus_detach_children() first to permit child devices an opportunity to
veto the detach operation. If that succeeds, device_delete_children()
is used to delete the child devices.

This requires fixing various drivers that were deleting devices
explicitly (via a device_t pointer cached in the softc) after calling
bus_generic_detach to stop doing that and just rely on
bus_generic_detach to remove child devices.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 61000
Build 57884: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Dec 6 2024, 10:30 PM
jhb added a subscriber: bz.

I will bump __FreeBSD_version as well in this commit.

This revision is now accepted and ready to land.Dec 7 2024, 4:23 PM

We have no manpages for this stuff. :( I've thought about writing a new manpage for bus_*_children and maybe some manpages for bus_generic_* (similar to the breakout I used on the slides for my talk in Dublin).

In D47959#1093747, @jhb wrote:

We have no manpages for this stuff. :( I've thought about writing a new manpage for bus_*_children and maybe some manpages for bus_generic_* (similar to the breakout I used on the slides for my talk in Dublin).

That would be great. I'm cool with vague future promises..