git: d174ffca3a79 - main - mfi: Use bus_generic_detach to simplify deleting children during detach
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Jan 2025 18:28:34 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d174ffca3a79171069cb041f81c2680a6e4809ed commit d174ffca3a79171069cb041f81c2680a6e4809ed Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2025-01-02 18:25:27 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2025-01-02 18:25:27 +0000 mfi: Use bus_generic_detach to simplify deleting children during detach Differential Revision: https://reviews.freebsd.org/D47973 --- sys/dev/mfi/mfi_pci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/mfi/mfi_pci.c b/sys/dev/mfi/mfi_pci.c index 82082e6b72cf..65e8e30bf994 100644 --- a/sys/dev/mfi/mfi_pci.c +++ b/sys/dev/mfi/mfi_pci.c @@ -279,8 +279,7 @@ static int mfi_pci_detach(device_t dev) { struct mfi_softc *sc; - int error, devcount, i; - device_t *devlist; + int error; sc = device_get_softc(dev); @@ -294,13 +293,11 @@ mfi_pci_detach(device_t dev) sc->mfi_detaching = 1; mtx_unlock(&sc->mfi_io_lock); - if ((error = device_get_children(sc->mfi_dev, &devlist, &devcount)) != 0) { + error = bus_generic_detach(sc->mfi_dev); + if (error != 0) { sx_xunlock(&sc->mfi_config_lock); return error; } - for (i = 0; i < devcount; i++) - device_delete_child(sc->mfi_dev, devlist[i]); - free(devlist, M_TEMP); sx_xunlock(&sc->mfi_config_lock); EVENTHANDLER_DEREGISTER(shutdown_final, sc->mfi_eh);