Add comment about why the deletion of children is necessary in detach.
This commit is contained in:
parent
6428802638
commit
f5c4d53efc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65241
@ -1524,6 +1524,14 @@ pcic_detach(device_t dev)
|
||||
ret = bus_generic_detach(dev);
|
||||
if (ret != 0)
|
||||
return (ret);
|
||||
/*
|
||||
* Normally, one wouldn't delete the children. However, detach
|
||||
* merely detaches the children w/o deleting them. So if
|
||||
* we were to reattach, we add additional children and wind up
|
||||
* with duplicates. So, we remove them here following the
|
||||
* implicit "if you add it in attach, you should delete it in
|
||||
* detach" rule that may or may not be documented.
|
||||
*/
|
||||
device_get_children(dev, &kids, &nkids);
|
||||
for (i = 0; i < nkids; i++) {
|
||||
if ((ret = device_delete_child(dev, kids[i])) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user