Move attachment of pccard children into exca library. Attach the

cardbus and pccard children before the sysctls are added rather than
after.
This commit is contained in:
Warner Losh 2019-12-16 21:35:02 +00:00
parent 1187f0cad2
commit 2e1d04ae9b
2 changed files with 14 additions and 13 deletions

View File

@ -646,6 +646,11 @@ exca_init(struct exca_softc *sc, device_t dev,
sc->flags = 0;
sc->getb = exca_mem_getb;
sc->putb = exca_mem_putb;
sc->pccarddev = device_add_child(dev, "pccard", -1);
if (sc->pccarddev == NULL)
DEVPRINTF(brdev, "WARNING: cannot add pccard bus.\n");
else if (device_probe_and_attach(sc->pccarddev) != 0)
DEVPRINTF(brdev, "WARNING: cannot attach pccard bus.\n");
}
/*
@ -742,6 +747,8 @@ exca_valid_slot(struct exca_softc *exca)
* Intel i82365sl-DF step or maybe a vlsi 82c146
* we detected the vlsi case earlier, so if the controller
* isn't set, we know it is a i82365sl step D.
* XXXX Except we didn't -- this is a regression but VLSI
* controllers are super hard to find these days for testing.
*/
exca->chipset = EXCA_I82365SL_DF;
break;

View File

@ -317,6 +317,13 @@ cbb_pci_attach(device_t brdev)
rman_get_start(sc->base_res)));
}
/* attach children */
sc->cbdev = device_add_child(brdev, "cardbus", -1);
if (sc->cbdev == NULL)
DEVPRINTF((brdev, "WARNING: cannot add cardbus bus.\n"));
else if (device_probe_and_attach(sc->cbdev) != 0)
DEVPRINTF((brdev, "WARNING: cannot attach cardbus bus!\n"));
sc->bst = rman_get_bustag(sc->base_res);
sc->bsh = rman_get_bushandle(sc->base_res);
exca_init(&sc->exca, brdev, sc->bst, sc->bsh, CBB_EXCA_OFFSET);
@ -373,19 +380,6 @@ cbb_pci_attach(device_t brdev)
}
#endif
/* attach children */
sc->cbdev = device_add_child(brdev, "cardbus", -1);
if (sc->cbdev == NULL)
DEVPRINTF((brdev, "WARNING: cannot add cardbus bus.\n"));
else if (device_probe_and_attach(sc->cbdev) != 0)
DEVPRINTF((brdev, "WARNING: cannot attach cardbus bus!\n"));
sc->exca.pccarddev = device_add_child(brdev, "pccard", -1);
if (sc->exca.pccarddev == NULL)
DEVPRINTF((brdev, "WARNING: cannot add pccard bus.\n"));
else if (device_probe_and_attach(sc->exca.pccarddev) != 0)
DEVPRINTF((brdev, "WARNING: cannot attach pccard bus.\n"));
/* Map and establish the interrupt. */
rid = 0;
sc->irq_res = bus_alloc_resource_any(brdev, SYS_RES_IRQ, &rid,