diff options
Diffstat (limited to 'sys/dev/imcsmb/imcsmb_pci.c')
-rw-r--r-- | sys/dev/imcsmb/imcsmb_pci.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/sys/dev/imcsmb/imcsmb_pci.c b/sys/dev/imcsmb/imcsmb_pci.c index e4dd10d6dd1e..6e9e601989b1 100644 --- a/sys/dev/imcsmb/imcsmb_pci.c +++ b/sys/dev/imcsmb/imcsmb_pci.c @@ -146,7 +146,6 @@ static struct imcsmb_pci_device { /* Device methods. */ static int imcsmb_pci_attach(device_t dev); -static int imcsmb_pci_detach(device_t dev); static int imcsmb_pci_probe(device_t dev); /** @@ -174,7 +173,7 @@ imcsmb_pci_attach(device_t dev) /* Create the imcsmbX children */ for (unit = 0; unit < 2; unit++) { - child = device_add_child(dev, "imcsmb", -1); + child = device_add_child(dev, "imcsmb", DEVICE_UNIT_ANY); if (child == NULL) { /* Nothing has been allocated, so there's no cleanup. */ device_printf(dev, "Child imcsmb not added\n"); @@ -188,40 +187,14 @@ imcsmb_pci_attach(device_t dev) } /* Attach the imcsmbX children. */ - if ((rc = bus_generic_attach(dev)) != 0) { - device_printf(dev, "failed to attach children: %d\n", rc); - goto out; - } + bus_attach_children(dev); + rc = 0; out: return (rc); } /** - * device_detach() method. attach() didn't do any allocations, so all that's - * needed here is to free up any downstream drivers and children. - * - * @author Joe Kloss - * - * @param[in] dev - * Device being detached. - */ -static int -imcsmb_pci_detach(device_t dev) -{ - int rc; - - /* Detach any attached drivers */ - rc = bus_generic_detach(dev); - if (rc == 0) { - /* Remove all children */ - rc = device_delete_children(dev); - } - - return (rc); -} - -/** * device_probe() method. Look for the right PCI vendor/device IDs. * * @author Joe Kloss, rpokala @@ -320,7 +293,7 @@ imcsmb_pci_request_bus(device_t dev) static device_method_t imcsmb_pci_methods[] = { /* Device interface */ DEVMETHOD(device_attach, imcsmb_pci_attach), - DEVMETHOD(device_detach, imcsmb_pci_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_probe, imcsmb_pci_probe), DEVMETHOD_END |